Re: [PERFORM] Query tuning: partitioning, DISTINCT ON, and indexing

2013-06-21 Thread Maciek Sakrejda
On Fri, Jun 21, 2013 at 9:08 AM, bricklen wrote: > Did you try an index on (type, ts desc) ? I don't have much else to add at > this point, but maybe after posting some more server and table (parent and > child) details someone will have an answer for you. > No, this is exactly what I was missin

Re: [PERFORM] Query tuning: partitioning, DISTINCT ON, and indexing

2013-06-21 Thread bricklen
On Thu, Jun 20, 2013 at 10:14 PM, Maciek Sakrejda wrote: > On Thu, Jun 20, 2013 at 9:13 PM, bricklen wrote: > >> >> On Thu, Jun 20, 2013 at 6:24 PM, Maciek Sakrejda wrote: >> >>> SELECT >>> DISTINCT ON (type) ts, type, details >>> FROM >>> observations >>> WHERE >>> subject = '...' >>> ORDE

Re: [PERFORM] Query tuning: partitioning, DISTINCT ON, and indexing

2013-06-20 Thread Maciek Sakrejda
On Thu, Jun 20, 2013 at 9:13 PM, bricklen wrote: > > On Thu, Jun 20, 2013 at 6:24 PM, Maciek Sakrejda wrote: > >> SELECT >> DISTINCT ON (type) ts, type, details >> FROM >> observations >> WHERE >> subject = '...' >> ORDER BY >> type, ts DESC; >> > > First thing: What is your "work_mem" se

Re: [PERFORM] Query tuning: partitioning, DISTINCT ON, and indexing

2013-06-20 Thread bricklen
On Thu, Jun 20, 2013 at 6:24 PM, Maciek Sakrejda wrote: > SELECT > DISTINCT ON (type) ts, type, details > FROM > observations > WHERE > subject = '...' > ORDER BY > type, ts DESC; > First thing: What is your "work_mem" set to, and how much RAM is in the machine? If you look at the plan, y