Re: Hints (was Poor performance using CTE)

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
Cc: cedric(at)2ndquadrant(dot)com, pgsql-performance(at)postgresql(dot)org, Craig James <cjames(at)emolecules(dot)com>, Kevin Grittner <kgrittn(at)mail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Claudio Freire <klaussfreire(at)gmail(dot)com>, Merlin Moncure <mmoncure(at)gmail(dot)com>, David Greco <David_Greco(at)harte-hanks(dot)com>
Subject: Re: Hints (was Poor performance using CTE)
Date: 2012-11-28 02:17:36
Message-ID: 50B57440.1040802@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 27/11/2012 3:42 PM, Scott Marlowe wrote:

> Here here! PostgreSQL is well known for its extensibility and this is
> the perfect place for hints.
I agree with the sentiment and your concerns. However, this doesn't
solve the CTE problem.

Some people are relying on the planner's inability to push conditions
into / pull conditions out of CTEs, and otherwise re-arrange them. If
support for optimising into eligible CTEs (ie CTE terms that contain
only SELECT or VALUES and call no VOLATILE functions) then these
applications will potentially encounter serious performance regressions.

Should this feature never be added to Pg, making it different and
incompatible with other DBs that implement CTE optimisation, just
because some people are using it for a hacky hint like OFFSET 0?

Should these applications just be broken by the update, with people told
to add `OFFSET 0` or load some not-yet-existing hints module after
reporting the performance issue to the list?

I don't think either of those are acceptable. Sooner or later somebody's
going to want to add CTE optimisation, and I don't think that "you
can't" or "great, we'll do it and break everything" are acceptable
responses to any proposed patch someone might come up with to add that.

A GUC might be OK, as apps can always SET it before problem queries or
not-yet-ported code. It'd probably reduce the rate at which people fixed
their code considerably, though, going by past experience with
standard_conforming_strings, etc, but it'd work.

--
Craig Ringer

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Scott Marlowe 2012-11-28 02:26:20 Re: Hints (was Poor performance using CTE)
Previous Message Claudio Freire 2012-11-28 01:16:28 Re: Savepoints in transactions for speed?