Re: Function execution costs 'n all that - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: Function execution costs 'n all that
Date
Msg-id 87wt3mly0y.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: Function execution costs 'n all that  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
"Tom Lane" <tgl@sss.pgh.pa.us> writes:

> Gregory Stark <gsstark@mit.edu> writes:
>> I imagine you've thought of this already but just in case, the cost of the
>> function call has to be combined with the selectivity to get this right. If
>> you can do an expensive but very selective clause first and save 100 cheap
>> calls that almost always return true it may still be worthwhile.
>
> I've thought of it, but I haven't figured out a reasonable algorithm for
> ordering the clauses in view of that.  Have you?

Hum, I hadn't tried. Now that I think about it it's certainly not obvious.

And picturing the possible failure modes I would rather it execute cheap
expressions more often than necessary than call some user-defined perl
function that could be doing i/o or involve waiting on other resources any
more than absolutely necessary. So I guess what you originally described is
safest.

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: [GENERAL] Checkpoint request failed on version 8.2.1.
Next
From: Enrico
Date:
Subject: Index for similarity search