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?

Reply via email to