Re: Query runs fast or slow

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Query runs fast or slow
Дата
Msg-id 18620.1145219545@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Query runs fast or slow  (felix-accts-pgsql@crowfix.com)
Ответы Re: Query runs fast or slow  (felix@crowfix.com)
Re: Query runs fast or slow  (felix@crowfix.com)
Список pgsql-general
felix-accts-pgsql@crowfix.com writes:
> EXPLAIN ANALYZE doesn't show the slow timing
> because it requires values, not $n placeholders,

To analyze the plan used for a parameterized query, try

    PREPARE foo(...) AS SELECT ... $n ...

    EXPLAIN ANALYZE EXECUTE foo(...)

But I already know what you're going to find: the planner's estimates
for the range query are not going to be very good when it has no idea
what the range bounds are.  This is a situation where it may be best
to absorb the hit of re-planning each time instead of using a generic
parameterized plan.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: felix-accts-pgsql@crowfix.com
Дата:
Сообщение: Query runs fast or slow
Следующее
От: Tom Lane
Дата:
Сообщение: Re: unique index on variable time