Re: Getting query plan alternatives from query planner? - Mailing list pgsql-performance

From Shaun Thomas
Subject Re: Getting query plan alternatives from query planner?
Date
Msg-id 532C966D.2080500@optionshouse.com
Whole thread Raw
In response to Re: Getting query plan alternatives from query planner?  (Craig James <cjames@emolecules.com>)
Responses Re: Getting query plan alternatives from query planner?
List pgsql-performance
On 03/21/2014 08:34 AM, Craig James wrote:

> There have been many discussions about adding hints to Postgres over the
> years. All have been firmly rejected by the Postgres developers, with
> well-argued reasons.  Search the archives to learn more about this topic.

While that's true, and I agree with the sentiment, it could also be
argued that what we have now is actually worse than hints.

I've been bitten several times by wrong query plans. The cause is
usually due to bad correlation estimates or edge-cases due to incomplete
stats. Aside from cranking default_statistics_target up to 10,000, these
issues tend to get solved through optimization fences. Reorganize a
query into a CTE, or use the (gross) OFFSET 0 trick. How are these
nothing other than unofficial hints?

Well... they're worse, really. Hints can be deprecated, disabled in
configs, or ignored in extreme cases. Optimization fences are truly
forever. Unless of course they're removed. In which case, a bunch of
queries that exploited them will suddenly perform a whole lot worse,
causing organizations to delay upgrading PostgreSQL.

--
Shaun Thomas
OptionsHouse | 141 W. Jackson Blvd. | Suite 500 | Chicago IL, 60604
312-676-8870
sthomas@optionshouse.com

______________________________________________

See http://www.peak6.com/email_disclaimer/ for terms and conditions related to this email


pgsql-performance by date:

Previous
From: Claudio Freire
Date:
Subject: Re: Connection pooling - Number of connections
Next
From: Erik van Zijst
Date:
Subject: Suboptimal query plan when using expensive BCRYPT functions