Re: Mystery function error - Mailing list pgsql-sql

From Tom Lane
Subject Re: Mystery function error
Date
Msg-id 9398.1064765182@sss.pgh.pa.us
Whole thread Raw
In response to Re: Mystery function error  (Josh Berkus <josh@agliodbs.com>)
Responses Re: Mystery function error  (Joe Conway <mail@joeconway.com>)
List pgsql-sql
Josh Berkus <josh@agliodbs.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


pgsql-sql by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Mystery function error
Next
From: Joe Conway
Date:
Subject: Re: Mystery function error