From: | Dorian Hoxha <dorian(dot)hoxha(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Complex sql, limit-for-each group by, arrays, updates |
Date: | 2013-11-27 12:51:53 |
Message-ID: | CANsFX05S8tRcskFx5_HqMHkx+acW41VFN7hRcNUXpsEV1R52TA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
So i have (table where data will be read) :
CREATE TABLE data (vid,cid,pid,number);
Tables where data will be writen/updated:
CREATE TABLE pid_top_vids (pid, vid[])
CREATE TABLE pid_top_cids (pid, cid[])
CREATE TABLE cid_top_vids (cid, vid[])
I need to , possibly in 1 query, this will run once in a while:
Get top(10) vids , sorted by 'number',grouped by pid and update the row in
TABLE(pid_top_vids).
Get top(10) vids, sorted by 'number', grouped by cid and update the row in
TABLE(cid_top_vids).
Get top(10) cids, sorted by 'number', where number is the SUM() of each vid
GROUP_BY(cid) and update the row in TABLE (cid_top_vids);
So, get data, create sorted array, and update the rows (they exist, so only
the arrays have to be updated).
Possible ?
Thanks
From | Date | Subject | |
---|---|---|---|
Next Message | Vik Fearing | 2013-11-27 13:29:42 | Re: help interpreting "explain analyze" output |
Previous Message | David Rysdam | 2013-11-27 11:49:56 | Re: having difficulty with explain analyze output |