Re: Poor performance using CTE

Поиск
Список
Период
Сортировка
Искать
От
Craig Ringer
Тема
Re: Poor performance using CTE
Дата
Msg-id
50AD6D16.9040608@2ndQuadrant.com
Ответ на
Список
Дерево обсуждения
Poor performance using CTE David Greco <David_Greco@harte-hanks.com>
Re: Poor performance using CTE Merlin Moncure <mmoncure@gmail.com>
Re: Poor performance using CTE Claudio Freire <klaussfreire@gmail.com>
Re: Poor performance using CTE Merlin Moncure <mmoncure@gmail.com>
Re: Poor performance using CTE Claudio Freire <klaussfreire@gmail.com>
Re: Poor performance using CTE Craig Ringer <craig@2ndQuadrant.com>
Re: Poor performance using CTE Tom Lane <tgl@sss.pgh.pa.us>
Re: Poor performance using CTE Heikki Linnakangas <hlinnakangas@vmware.com>
Re: Poor performance using CTE Andrew Dunstan <andrew@dunslane.net>
Re: Poor performance using CTE Tom Lane <tgl@sss.pgh.pa.us>
Re: Poor performance using CTE Andrew Dunstan <andrew@dunslane.net>
Re: Poor performance using CTE Andres Freund <andres@anarazel.de>
Re: Poor performance using CTE Gavin Flower <GavinFlower@archidevsys.co.nz>
Re: Poor performance using CTE Heikki Linnakangas <hlinnakangas@vmware.com>
Re: Poor performance using CTE Gavin Flower <GavinFlower@archidevsys.co.nz>
Re: Poor performance using CTE Andrew Dunstan <andrew@dunslane.net>
Re: Poor performance using CTE Gavin Flower <GavinFlower@archidevsys.co.nz>
Re: Poor performance using CTE Craig Ringer <craig@2ndQuadrant.com>
Re: Poor performance using CTE Gavin Flower <GavinFlower@archidevsys.co.nz>
Re: Poor performance using CTE Craig Ringer <craig@2ndQuadrant.com>
Re: Poor performance using CTE Jeremy Harris <jgh@wizmail.org>
Re: Poor performance using CTE Jon Nelson <jnelson+pgsql@jamponi.net>
Re: Poor performance using CTE Claudio Freire <klaussfreire@gmail.com>
Re: Poor performance using CTE Andres Freund <andres@2ndquadrant.com>
Re: Poor performance using CTE Claudio Freire <klaussfreire@gmail.com>
Re: Poor performance using CTE Andres Freund <andres@2ndquadrant.com>
Re: Poor performance using CTE Andrew Dunstan <andrew@dunslane.net>
Re: Poor performance using CTE Claudio Freire <klaussfreire@gmail.com>
Re: Poor performance using CTE Tom Lane <tgl@sss.pgh.pa.us>
Re: Poor performance using CTE Peter Geoghegan <peter@2ndquadrant.com>
Re: Poor performance using CTE Peter Geoghegan <peter@2ndquadrant.com>
Re: Poor performance using CTE Claudio Freire <klaussfreire@gmail.com>
On 11/22/2012 03:30 AM, Gavin Flower wrote:
On 22/11/12 04:56, Heikki Linnakangas wrote:
On 21.11.2012 17:42, Gavin Flower wrote:
On 22/11/12 04:32, Andres Freund wrote:
On 2012-11-21 10:21:16 -0500, Andrew Dunstan wrote:
I wasn't talking about removing it. My point was that if the
optimization
fence around CTEs is removed a lot of people will need to rework apps
where
they have used them for that purpose. And I continue to think that
spelling
it "OFFSET 0" is horribly obscure.
+1

FWIW, I'm happy with "OFFSET 0". Granted, it's pretty obscure, but that's what we've historically recommended, and it's pretty ugly to have to specify a fence like that in the first place. Whenever you have to resort to it, you ought have a comment in the query explaining why you need to force the planner like that, anyway.

WITH foo AS (SELECT ...) (barrier=on|off)?

9.3 introduces the syntax, defaulting to on
9.4 switches the default to off.

WITH foo AS (SELECT ...) (fence=on|off)?

WITH foo AS (SELECT ...) (optimisation_fence=on|off)?

If we are to invent a new syntax for this, can we please come up with something that's more widely applicable than just the WITH syntax. Something that you could use to replace OFFSET 0 in a subquery, too.

- Heikki
WITH FENCE foo AS (SELECT ...)
default?
That doesn't bind tightly enough to a specific CTE term. Consider:

WITH
  FENCE foo AS (SELECT ...),
  bar AS (SELECT ...)
SELECT * FROM bar;

Are we fencing just foo? Or all expressions?


-- Craig Ringer                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services
В списке pgsql-performance по дате отправления
От: Andrew Dunstan
Дата:
Сообщение: Re: Poor performance using CTE
От: Craig Ringer
Дата:
Сообщение: Re: Poor performance using CTE
FAQ