Re: 'cost' and 'rows' for volitile function - Mailing list pgsql-sql

From Richard Huxton
Subject Re: 'cost' and 'rows' for volitile function
Date
Msg-id 4A2D4B8B.1080501@archonet.com
Whole thread Raw
In response to 'cost' and 'rows' for volitile function  (Rob Sargent <robjsargent@gmail.com>)
List 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


pgsql-sql by date:

Previous
From: Rob Sargent
Date:
Subject: 'cost' and 'rows' for volitile function
Next
From: Richard Huxton
Date:
Subject: Re: 'cost' and 'rows' for volitile function