Re: Query much slower when run from postgres function

Поиск
Список
Период
Сортировка
Искать
От
decibel
Тема
Re: Query much slower when run from postgres function
Дата
Msg-id
E6757F02-1F73-4DDE-A5D4-0606CC517B1C@decibel.org
Ответ на
Список
Дерево обсуждения
Query much slower when run from postgres function Mario Splivalo <mario.splivalo@megafon.hr>
Re: Query much slower when run from postgres function Tom Lane <tgl@sss.pgh.pa.us>
Re: Query much slower when run from postgres function Mario Splivalo <mario.splivalo@megafon.hr>
Re: Query much slower when run from postgres function Tom Lane <tgl@sss.pgh.pa.us>
Re: Query much slower when run from postgres function Mario Splivalo <mario.splivalo@megafon.hr>
Re: Query much slower when run from postgres function Tom Lane <tgl@sss.pgh.pa.us>
Re: Query much slower when run from postgres function Guillaume Cottenceau <gc@mnc.ch>
Re: [JDBC] Query much slower when run from postgres function Guillaume Smet <guillaume.smet@gmail.com>
Re: [JDBC] Query much slower when run from postgres function Tom Lane <tgl@sss.pgh.pa.us>
Re: [JDBC] Query much slower when run from postgres function Dave Cramer <pg@fastcrypt.com>
Re: [JDBC] Query much slower when run from postgres function James Mansion <james@mansionfamily.plus.com>
Re: [JDBC] Query much slower when run from postgres function Andreas Wenk <a.wenk@netzmeister-st-pauli.de>
Re: [JDBC] Query much slower when run from postgres function Scott Carey <scott@richrelevance.com>
Re: Query much slower when run from postgres function Mario Splivalo <mario.splivalo@megafon.hr>
Re: Query much slower when run from postgres function fche@redhat.com (Frank Ch. Eigler)
Re: Query much slower when run from postgres function Tom Lane <tgl@sss.pgh.pa.us>
Re: Query much slower when run from postgres function decibel <decibel@decibel.org>
Re: Query much slower when run from postgres function Віталій Тимчишин <tivv00@gmail.com>
Re: Query much slower when run from postgres function decibel <decibel@decibel.org>
On Mar 10, 2009, at 12:20 PM, Tom Lane wrote:
> fche@redhat.com (Frank Ch. Eigler) writes:
>> For a prepared statement, could the planner produce *several* plans,
>> if it guesses great sensitivity to the parameter values?  Then it
>> could choose amongst them at run time.
>
> We've discussed that in the past.  "Choose at runtime" is a bit more
> easily said than done though --- you can't readily flip between plan
> choices part way through, if you've already emitted some result rows.

True, but what if we planned for both high and low cardinality cases,  
assuming that pg_stats indicated both were a possibility? We would  
have to store multiple plans for one prepared statement, which  
wouldn't work well for more complex queries (if you did high and low  
cardinality estimates for each table you'd end up with 2^r plans,  
where r is the number of relations), so we'd need a way to cap it  
somehow. Of course, whether that's easier than having the ability to  
throw out a current result set and start over with a different plan  
is up for debate...

On a related note, I wish there was a way to tell plpgsql not to pre- 
plan a query. Sure, you can use EXECUTE, but building the query plan  
is a serious pain in the rear.
-- 
Decibel!, aka Jim C. Nasby, Database Architect  decibel@decibel.org
Give your computer some brain candy! www.distributed.net Team #1828


В списке pgsql-performance по дате отправления
От: decibel
Дата:
От: decibel
Дата:
FAQ