Re: table partitioning and select max(id) - Mailing list pgsql-performance

From Greg Smith
Subject Re: table partitioning and select max(id)
Date
Msg-id 4D4D0F14.7020500@2ndquadrant.com
Whole thread Raw
In response to Re: table partitioning and select max(id)  (Tobias Brox <tobixen@gmail.com>)
List pgsql-performance
Tobias Brox wrote:
> I did test "select id from table order by id desc limit 1" on my parent table
> yesterday, it would still do the seq-scan.  Even adding a
> where-restriction to make sure only one partition was queried I still
> got the seq-scan.
>

Right; you actually have to direct the query toward the specific
partition by name, nothing run against the parent table will work.  The
new logic for 9.1 essentially splits the query into this alternate form,
runs it against every partition individually, then combines the
results.  If you can afford to wait for 9.1, that is certainly the easy
path here.  It just works out of the box in that version.

--
Greg Smith   2ndQuadrant US    greg@2ndQuadrant.com   Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support  www.2ndQuadrant.us
"PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books


pgsql-performance by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: [HACKERS] Slow count(*) again...
Next
From: Greg Smith
Date:
Subject: Re: [HACKERS] Slow count(*) again...