Re: SQL Function Performance

Поиск
Список
Период
Сортировка
От Mark Liberman
Тема Re: SQL Function Performance
Дата
Msg-id 9D938282F8C6EE43B748B910386DE93E0138B3F3@srvgpimail1.GPI.local
обсуждение исходный текст
Ответ на SQL Function Performance  ("Adnan DURSUN" <a_dursun@hotmail.com>)
Список pgsql-performance

> in my case; both direct query and sql function gererate same execution plan. Also, execution plan belongs to the sql function better than direct sql > query plan. But, direct sql result comes less than 1 second. sql function result comes about in 50 seconds.

How are you getting at the plan inside your function?  If you just do an EXPLAIN on the function call you get a FUNCTION SCAN line in your plan, which tells you nothing.  I remember I had to work through some process for catching the output of the Explain plan in a cursor and returning that to actually see the plan.  I saw in a previous response he suggested using a PREPARE and EXECUTE against that.  I'm not sure that's the same as what's going on in the function (although I could be wrong).

Just humor me and try creating the sql query in the fuction in a text variable and then Executing it. 

Prior to that, however, you might try just recreating the function.  The plan may be re-evaluated at that point.

- Mark


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

Предыдущее
От: "Mark Liberman"
Дата:
Сообщение: Re: SQL Function Performance
Следующее
От: Chris
Дата:
Сообщение: Re: Optimizing performance of a like '%...%' condition