Re: How can I make PostgreSQL to select another quey plan?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Yangyang <yangyangbm(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: How can I make PostgreSQL to select another quey plan?
Date: 2011-11-30 16:23:39
Message-ID: 12839.1322670219@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Yangyang <yangyangbm(at)gmail(dot)com> writes:
> If I don't change the database structures (like index), and only
> modify "Planner cost constants", is it possible to make DB change the
> query plan?

Yes, but usually these don't have huge impacts on estimated costs,
so you will only be able to get it to switch to plans that (it thinks)
are relatively close in cost anyway.

A bigger question is what sort of plan you think would be better, and
whether the planner is even capable of building that plan from the
given query. You didn't show the particular query you're concerned
about, but I gather from the EXPLAIN output that it involves
sub-selects, and those can act as optimization fences ...

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Yangyang 2011-11-30 21:19:49 Re: How can I make PostgreSQL to select another quey plan?
Previous Message Yangyang 2011-11-30 16:18:45 Re: How can I make PostgreSQL to select another quey plan?