Functions too slow, even with iscachable?

From: Ang Chin Han <angch(at)pintoo(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Functions too slow, even with iscachable?
Date: 2000-08-07 09:11:10
Message-ID: 20000807171110.A31838@pintoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Philip Warner 2000-08-07 09:57:01 Re: Functions too slow, even with iscachable?
Previous Message Tom Lane 2000-08-07 01:09:20 Re: Rules, Select, Union