Re: Mystery function error

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: "Richard Sydney-Smith" <richard(at)ibisaustralia(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Mystery function error
Date: 2003-09-28 16:06:22
Message-ID: 9398.1064765182@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Josh Berkus <josh(at)agliodbs(dot)com> writes:
> Also, this will run faster if you do it as a SQL function:

> CREATE FUNCTION locate ( text, text ) RETURNS INT AS '
> SELECT POSITION($2, $1);
> ' LANGUAGE SQL IMMUTABLE STRICT;

This is definitely the solution I'd recommend for 7.4 (because 7.4 would
inline the SQL function definition, resulting in zero runtime overhead).
In 7.3 I suspect the plpgsql version might be a tad faster, or anyway
comparable. Has anyone done any head-to-head performance comparisons
on such simple functions?

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Joe Conway 2003-09-28 16:21:33 Re: Mystery function error
Previous Message Tom Lane 2003-09-28 16:02:43 Re: [SQL] plpgsql doesn't coerce boolean expressions to