Re: SRF called with optional NULL input runs 7x slower

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: SRF called with optional NULL input runs 7x slower
Дата
Msg-id 20070924041812.GG5679@alvh.no-ip.org
обсуждение исходный текст
Ответ на SRF called with optional NULL input runs 7x slower  (Ow Mun Heng <Ow.Mun.Heng@wdc.com>)
Ответы Re: SRF called with optional NULL input runs 7x slower  (Ow Mun Heng <Ow.Mun.Heng@wdc.com>)
Список pgsql-general
Ow Mun Heng wrote:

> how can I debug or diagnose where the issues lies? Explain analyse
> doesn't do much since this is a Function Scan anyway.

Take them out of the function and EXPLAIN ANALYZE them as plain SQL.
Note that you should take the parameters out of the literal, so you need
to do something like

PREPARE foo AS SELECT ...   replace code with $1, etc ...
EXPLAIN ANALYZE EXECUTE foo(code, ...)

Otherwise they would be treated as constants so the queries would be
planned differently.

(untested, so correct the syntax appropriately)

--
Alvaro Herrera                 http://www.amazon.com/gp/registry/DXLWNGRJD34J
"Before you were born your parents weren't as boring as they are now. They
got that way paying your bills, cleaning up your room and listening to you
tell them how idealistic you are."  -- Charles J. Sykes' advice to teenagers

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Out of Memory - 8.2.4
Следующее
От: "Derek E. Lewis"
Дата:
Сообщение: Re: Is this good spec for a PostgreSQL server?