Re: Functions too slow, even with iscachable?

From: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Functions too slow, even with iscachable?
Date: 2000-08-07 14:47:53
Message-ID: 20000807094753.A26007@rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, Aug 07, 2000 at 05:11:10PM +0800, Ang Chin Han wrote:
> 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);

Is this a cut-n-paste error, or did you drop half a term from your WHERE
clause? "survey_id =" seems to be missing in the functional form. I
din't see how that would make it run slowly, however.

Ross
--
Ross J. Reedstrom, Ph.D., <reedstrm(at)rice(dot)edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St., Houston, TX 77005

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2000-08-07 14:58:27 Re: Functions too slow, even with iscachable?
Previous Message Philip Warner 2000-08-07 14:43:55 Subselect and limit/order?