pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ross J. Reedstrom <reedstrm@rice.edu>
To: pgsql-sql@postgresql.org
Subject: Re: Functions too slow, even with iscachable?
Date: Mon, 7 Aug 2000 09:47:53 -0500
Message-ID: <20000807094753.A26007@rice.edu> (raw)
In-Reply-To: <20000807171110.A31838@pintoo.com>
References: <20000807171110.A31838@pintoo.com>

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



view thread (8+ messages)  latest in thread

Message-ID: <20000807094753.A26007@rice.edu>
Permalink:  ../20000807094753.A26007@rice.edu/
Also on:    postgresql.org/message-id/20000807094753.A26007@rice.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: reedstrm@rice.edu
  Subject: Re: Functions too slow, even with iscachable?
  In-Reply-To: <20000807094753.A26007@rice.edu>
  References: <20000807171110.A31838@pintoo.com> <20000807094753.A26007@rice.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox