Re: totally different plan when using partitions

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Scara Maccai <m_lists(at)yahoo(dot)it>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: totally different plan when using partitions
Date: 2009-08-13 14:59:27
Message-ID: 20090813145927.GF5909@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Scara Maccai wrote:
> > Huh, clearly not the same query (you're using the partition directly
> > in the first query) ...  Doing two changes at once is not helping
> > your case.
>
> Sorry, I don't understand... of course I used the partition directly
> in the first query... it's the difference between the two... what I
> don't like is that since the tables used are in fact the same, the
> plan shouldn't be that different.

I misread your original email to say that you were changing the
parameter. What version are you using? Also, please post the table
definitions (preferably in pg_dump -s format)

> My conclusion is that the planner thinks there could be some data in
> the "root" partition, even if that will always be empty.
> What I would like is a way to tell Postgres "hey, don't even look at
> the root table. That's just a placeholder for the partitions. It will
> never contain any data" when I create the tables.
>
> Otherwise the planner might get fooled by an empty table index scan in
> a loop (which is what happens here), thinking that that will take
> time.

I'm not sure I agree with your assessment of the problem.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dan Halbert 2009-08-13 15:02:37 array syntax and geometric type syntax
Previous Message Devrim GÜNDÜZ 2009-08-13 14:55:23 Re: PostgreSQL for Firefox Bookmarks?