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
Views: Raw Message | Whole Thread | Download mbox
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

Browse pgsql-performance by date

  From Date Subject
Next Message Hannu Krosing 2003-04-25 16:28:06 Re: More tablescanning fun
Previous Message Jim C. Nasby 2003-04-25 14:38:01 Re: More tablescanning fun