Skip site navigation (1) Skip section navigation (2)

Re: Important speed difference between a query and a function with the same query

From: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>
To: Frederic Jolliton <fred-pg(at)jolliton(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Important speed difference between a query and a function with the same query
Date: 2003-04-25 15:09:05
Message-ID: 20030425100905.D66185@flake.decibel.org (view raw or flat)
Thread:
Lists: pgsql-performance
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(at)nasby(dot)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?"


In response to

pgsql-performance by date

Next:From: Hannu KrosingDate: 2003-04-25 16:28:06
Subject: Re: More tablescanning fun
Previous:From: Jim C. NasbyDate: 2003-04-25 14:38:01
Subject: Re: More tablescanning fun

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group