pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Smith <greg@2ndquadrant.com>
To: Tobias Brox <tobixen@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: table partitioning and select max(id)
Date: Sat, 05 Feb 2011 03:49:24 -0500
Message-ID: <4D4D0F14.7020500@2ndquadrant.com> (raw)
In-Reply-To: <AANLkTimU90yx4NEvHRE+otSDjWCDmG5Zjyhxecr-AGZ5@mail.gmail.com>
References: <AANLkTi=pzBtH4i_WYrbR9JEyq+49vPPVJf-q08z_Bhu=@mail.gmail.com>
	<4D4CDA0C.20000@2ndquadrant.com>
	<AANLkTimU90yx4NEvHRE+otSDjWCDmG5Zjyhxecr-AGZ5@mail.gmail.com>

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




view thread (5+ messages)

Message-ID: <4D4D0F14.7020500@2ndquadrant.com>
Permalink:  ../4D4D0F14.7020500@2ndquadrant.com/
Also on:    postgresql.org/message-id/4D4D0F14.7020500@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: greg@2ndquadrant.com, tobixen@gmail.com
  Subject: Re: table partitioning and select max(id)
  In-Reply-To: <4D4D0F14.7020500@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox