Functions too slow, even with iscachable? - Mailing list pgsql-sql

From Ang Chin Han
Subject Functions too slow, even with iscachable?
Date
Msg-id 20000807171110.A31838@pintoo.com
Whole thread Raw
Responses Re: Functions too slow, even with iscachable?  (Philip Warner <pjw@rhyme.com.au>)
Re: Functions too slow, even with iscachable?  ("Ross J. Reedstrom" <reedstrm@rice.edu>)
Re: Functions too slow, even with iscachable?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
I have a query which runs fast:

SELECT passwd FROM ticket WHERE name = ticket2name('test-006kdt') AND   survey_id = ticket2survey_id('test-006kdt');

But slows down to a crawl when I wrapped it in a function:

CREATE FUNCTION ticket2passwd(text) RETURNS text AS   'SELECT passwd FROM ticket WHERE name = ticket2name($1) AND
ticket2survey_id($1)'LANGUAGE 'sql' WITH (iscachable);
 

which should be a shortform for the first query:

SELECT ticket2passwd('test-006kdt');

Any ideas? Thanks in advance.


ticket2name and ticket2survey_id are both iscachable.


BTW, pg_dump doesn't seem to preserve the iscachable attribute. Bug?


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Rules, Select, Union
Next
From: Philip Warner
Date:
Subject: Re: Functions too slow, even with iscachable?