Re: 'cost' and 'rows' for volitile function

From: Richard Huxton <dev(at)archonet(dot)com>
To: Rob Sargent <robjsargent(at)gmail(dot)com>, PostgreSQL <pgsql-sql(at)postgresql(dot)org>
Subject: Re: 'cost' and 'rows' for volitile function
Date: 2009-06-08 17:34:03
Message-ID: 4A2D4B8B.1080501@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Rob Sargent wrote:
> Richard Huxton wrote:
>> Rob Sargent wrote:
>>> pg-admin is showing 'COST 100' and 'ROWS 1000' for my explicitly
>>> VOLATILE functions.

> Thanks for the pointer back to CREATE FUNCTION docs. That would have
> told me that those value are indeed the defaults. I guess I'm somewhat
> surprised that they are in fact defautled. "COST" is too arbitrary for
> me to comment on, but my functions' results sets fall on both sides of
> 1000 rows, so I'm not sure giving this value to the planner does a lot
> of good. Luckily, my functions are typically pretty much stand-alone
> calls, and not part of some larger query.

If your functions are all called at the top-level then indeed it doesn't
matter. At a low level though, telling the planner function F1 costs
1000 times more than F2 is useful.

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Madison Kelly 2009-06-08 17:41:13 Re: Adding the host name to the PgSQL shell
Previous Message Scott Mead 2009-06-08 17:33:38 Re: Adding the host name to the PgSQL shell

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2009-06-08 17:57:47 Re: 'cost' and 'rows' for volitile function
Previous Message Richard Huxton 2009-06-08 17:16:41 Re: [SQL] 'cost' and 'rows' for volitile function