From: Jim C. Nasby <jim@nasby.net>
To: Frederic Jolliton <fred-pg@jolliton.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Important speed difference between a query and a function with the same query
Date: Fri, 25 Apr 2003 10:09:05 -0500
Message-ID: <20030425100905.D66185@flake.decibel.org> (raw)
In-Reply-To: <8665p56qx8.fsf@mau.localdomain>
References: <8665p56qx8.fsf@mau.localdomain>
On Wed, Apr 23, 2003 at 07:53:55PM +0200, Frederic Jolliton wrote:
> CREATE FUNCTION get_info (integer) RETURNS SETOF type_get_info
> AS '...' <- here the query show below, where 'LIMIT $1' is used instead of 'LIMIT 10'
> LANGUAGE sql;
You should probably define the function to be STABLE.
LANGUAGE sql STABLE;
See
http://www.postgresql.org/docs/view.php?version=7.3&idoc=1&file=sql-createfunction.html
for more info.
--
Jim C. Nasby (aka Decibel!) jim@nasby.net
Member: Triangle Fraternity, Sports Car Club of America
Give your computer some brain candy! www.distributed.net Team #1828
Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"
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-performance@postgresql.org
Cc: jim@nasby.net, fred-pg@jolliton.com
Subject: Re: Important speed difference between a query and a function with the same query
In-Reply-To: <20030425100905.D66185@flake.decibel.org>
References: <8665p56qx8.fsf@mau.localdomain> <20030425100905.D66185@flake.decibel.org>
* 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