Re: SQL Function Performance

From: "Adnan DURSUN" <a_dursun(at)hotmail(dot)com>
To: <pgsql-performance(at)postgresql(dot)org>, <mliberman(at)goldpocket(dot)com>
Subject: Re: SQL Function Performance
Date: 2006-02-14 00:16:49
Message-ID: BAY106-DAV167164E55CB76586C2046FA060@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

-------Original Message-------

From: Mark Liberman
Date: 02/14/06 01:46:16
To: Adnan DURSUN; pgsql-performance(at)postgresql(dot)org
Subject: RE: [PERFORM] SQL Function 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).

Yes, i have got sql function prepared execution plan using PREPARE and EXECUTE that he suggested to me.

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

But i believe that, that behavior of PostgreSQL is not good. It should handle this case. PostgreSQL has this "sql function" functionality and it should
give good serve...Of course, i will do your suggesion if i dont solve it.

>Prior to that, however, you might try just recreating the function. The plan may be re-evaluated at that point.
Ok. i did it many times. But nothing was changed..
- Mark

Adnan DURSUN
ASRIN Bilişim Ltd.Şti

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2006-02-14 00:57:07 Re: SQL Function Performance
Previous Message Mark Liberman 2006-02-13 23:45:13 Re: SQL Function Performance