Re: [HACKERS] CTE inlining
От
Andrew Dunstan
Тема
Re: [HACKERS] CTE inlining
Дата
Msg-id
60607f78-0c45-6f17-cce2-9cff6c8d8801@2ndQuadrant.com
Ответ на
Re: [HACKERS] CTE inlining (David G. Johnston)
Список
Дерево обсуждения
[HACKERS] CTE inlining Ilya Shkuratov <motr.ilya@ya.ru>
Re: [HACKERS] CTE inlining Yaroslav <ladayaroslav@yandex.ru>
Re: [HACKERS] CTE inlining Andreas Joseph Krogh <andreas@visena.com>
Re: [HACKERS] CTE inlining Thomas Kellerer <spam_eater@gmx.net>
Re: [HACKERS] CTE inlining Craig Ringer <craig.ringer@2ndquadrant.com>
Re: [HACKERS] CTE inlining Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] CTE inlining Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: [HACKERS] CTE inlining David Fetter <david@fetter.org>
Re: [HACKERS] CTE inlining Robert Haas <robertmhaas@gmail.com>
Re: [HACKERS] CTE inlining Andres Freund <andres@anarazel.de>
Re: [HACKERS] CTE inlining Gavin Flower <GavinFlower@archidevsys.co.nz>
Re: [HACKERS] CTE inlining Serge Rielau <serge@rielau.com>
Re: [HACKERS] CTE inlining Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] CTE inlining Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: [HACKERS] CTE inlining Andreas Karlsson <andreas@proxel.se>
Re: [HACKERS] CTE inlining Craig Ringer <craig.ringer@2ndquadrant.com>
Re: [HACKERS] CTE inlining "David G. Johnston" <david.g.johnston@gmail.com>
Re: [HACKERS] CTE inlining Andres Freund <andres@anarazel.de>
Re: [HACKERS] CTE inlining Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: [HACKERS] CTE inlining Alvaro Herrera <alvherre@2ndquadrant.com>
Re: [HACKERS] CTE inlining Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] CTE inlining Joe Conway <mail@joeconway.com>
Re: [HACKERS] CTE inlining Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: [HACKERS] CTE inlining Joe Conway <mail@joeconway.com>
Re: [HACKERS] CTE inlining Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: [HACKERS] CTE inlining Gavin Flower <GavinFlower@archidevsys.co.nz>
Re: [HACKERS] CTE inlining Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] CTE inlining Serge Rielau <serge@rielau.com>
Re: [HACKERS] CTE inlining Craig Ringer <craig.ringer@2ndquadrant.com>
Re: [HACKERS] CTE inlining Joe Conway <mail@joeconway.com>
Re: [HACKERS] CTE inlining Craig Ringer <craig.ringer@2ndquadrant.com>
Re: [HACKERS] CTE inlining Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] CTE inlining Stephen Frost <sfrost@snowman.net>
Re: [HACKERS] CTE inlining Joe Conway <mail@joeconway.com>
Re: [HACKERS] CTE inlining Andres Freund <andres@anarazel.de>
Re: [HACKERS] CTE inlining David Rowley <david.rowley@2ndquadrant.com>
Re: [HACKERS] CTE inlining Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Re: [HACKERS] CTE inlining "David G. Johnston" <david.g.johnston@gmail.com>
Re: [HACKERS] CTE inlining Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] CTE inlining "David G. Johnston" <david.g.johnston@gmail.com>
Re: [HACKERS] CTE inlining Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] CTE inlining Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: [HACKERS] CTE inlining Serge Rielau <serge@rielau.com>
Re: [HACKERS] CTE inlining Serge Rielau <serge@rielau.com>
Re: [HACKERS] CTE inlining Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: [HACKERS] CTE inlining Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: [HACKERS] CTE inlining Pavel Stehule <pavel.stehule@gmail.com>
Re: [HACKERS] CTE inlining Andres Freund <andres@anarazel.de>
Re: [HACKERS] CTE inlining Pavel Stehule <pavel.stehule@gmail.com>
Re: [HACKERS] CTE inlining Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: [HACKERS] CTE inlining Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: [HACKERS] CTE inlining David Fetter <david@fetter.org>
Re: [HACKERS] CTE inlining Andreas Karlsson <andreas@proxel.se>
Re: [HACKERS] CTE inlining Corey Huinker <corey.huinker@gmail.com>
Re: [HACKERS] CTE inlining "David G. Johnston" <david.g.johnston@gmail.com>
Re: [HACKERS] CTE inlining Andreas Karlsson <andreas@proxel.se>
Re: [HACKERS] CTE inlining "David G. Johnston" <david.g.johnston@gmail.com>
Re: [HACKERS] CTE inlining Craig Ringer <craig@2ndquadrant.com>
Re: [HACKERS] CTE inlining Andreas Karlsson <andreas@proxel.se>
Re: [HACKERS] CTE inlining David Fetter <david@fetter.org>
Re: [HACKERS] CTE inlining Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: [HACKERS] CTE inlining Merlin Moncure <mmoncure@gmail.com>
Re: [HACKERS] CTE inlining Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: [HACKERS] CTE inlining Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: [HACKERS] CTE inlining Craig Ringer <craig@2ndquadrant.com>
Re: [HACKERS] CTE inlining Thomas Kellerer <spam_eater@gmx.net>
Re: [HACKERS] CTE inlining Claudio Freire <klaussfreire@gmail.com>
Re: [HACKERS] CTE inlining David Fetter <david@fetter.org>
Re: [HACKERS] CTE inlining Claudio Freire <klaussfreire@gmail.com>
Re: [HACKERS] CTE inlining David Fetter <david@fetter.org>
Re: [HACKERS] CTE inlining Alvaro Herrera <alvherre@2ndquadrant.com>
Re: [HACKERS] CTE inlining Gavin Flower <GavinFlower@archidevsys.co.nz>
Re: [HACKERS] CTE inlining Thomas Kellerer <spam_eater@gmx.net>
Re: [HACKERS] CTE inlining Albe Laurenz <laurenz.albe@wien.gv.at>
Re: [HACKERS] CTE inlining Kenneth Marshall <ktm@rice.edu>
Re: [HACKERS] CTE inlining Gavin Flower <GavinFlower@archidevsys.co.nz>
Re: [HACKERS] CTE inlining Andreas Karlsson <andreas@proxel.se>
Re: [HACKERS] CTE inlining Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: [HACKERS] CTE inlining Pavel Stehule <pavel.stehule@gmail.com>
Re: [HACKERS] CTE inlining Merlin Moncure <mmoncure@gmail.com>
Re: [HACKERS] CTE inlining Petr Jelinek <petr.jelinek@2ndquadrant.com>
Re: [HACKERS] CTE inlining Julien Rouhaud <julien.rouhaud@dalibo.com>
Re: [HACKERS] CTE inlining Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: [HACKERS] CTE inlining Vik Fearing <vik.fearing@2ndquadrant.com>
Re: [HACKERS] CTE inlining Ilya Shkuratov <motr.ilya@ya.ru>
Re: [HACKERS] CTE inlining Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] CTE inlining Bruce Momjian <bruce@momjian.us>
Re: [HACKERS] CTE inlining Merlin Moncure <mmoncure@gmail.com>
Re: [HACKERS] CTE inlining David Rowley <david.rowley@2ndquadrant.com>
Re: [HACKERS] CTE inlining Adam Brusselback <adambrusselback@gmail.com>
Re: [HACKERS] CTE inlining Pavel Stehule <pavel.stehule@gmail.com>
Re: [HACKERS] CTE inlining Corey Huinker <corey.huinker@gmail.com>
Re: [HACKERS] CTE inlining Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: [HACKERS] CTE inlining Craig Ringer <craig@2ndquadrant.com>
Re: [HACKERS] CTE inlining Craig Ringer <craig@2ndquadrant.com>
Re: [HACKERS] CTE inlining Craig Ringer <craig@2ndquadrant.com>
Re: [HACKERS] CTE inlining Thomas Kellerer <spam_eater@gmx.net>
Re: [HACKERS] CTE inlining Oleg Bartunov <obartunov@gmail.com>
Re: [HACKERS] CTE inlining Merlin Moncure <mmoncure@gmail.com>
Re: [HACKERS] CTE inlining Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: [HACKERS] CTE inlining Tomas Vondra <tomas.vondra@2ndquadrant.com>
On 05/04/2017 12:34 PM, David G. Johnston wrote: > On Thu, May 4, 2017 at 9:22 AM, Andrew Dunstan > >wrote: > > > Yeah, the idea that this won't cause possibly significant pain is > quite wrong. Quite by accident I came across an example just this > morning where rewriting as a CTE makes a big improvement. > > I wrote this query: > > select (json_populate_record(null::mytype, myjson)).* > from mytable; > > > It turned out that this was an order of magnitude faster: > > with r as > ( > select json_populate_record(null::mytype, myjson) as x > from mytable > ) > select (x).* > from r; > > > Except I suspect we at least have a chance to detect the above and > not de-optimize it by evaluating "json_populate_record" once for every > column in mytype. > > The now idiomatic solution to the above is to use LATERAL so the > above CTE is no longer actually a required workaround. Hadn't though about LATERAL, good point. Still, there will be other cases. cheers andrew -- Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
В списке pgsql-hackers по дате отправления
От: Robert Haas
Дата: