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

From Ross J. Reedstrom
Subject Re: Functions too slow, even with iscachable?
Date
Msg-id 20000807094753.A26007@rice.edu
Whole thread Raw
In response to Functions too slow, even with iscachable?  (Ang Chin Han <angch@pintoo.com>)
List 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@rice.edu> 
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005


pgsql-sql by date:

Previous
From: Philip Warner
Date:
Subject: Subselect and limit/order?
Next
From: Tom Lane
Date:
Subject: Re: Functions too slow, even with iscachable?