Re: [HACKERS] Big IN() clauses etc : feature proposal

From: Nis Jorgensen <nis(at)superlativ(dot)dk>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: PFC <lists(at)peufeu(dot)com>, Markus Schaber <schabi(at)logix-tt(dot)com>, pgsql-performance(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Big IN() clauses etc : feature proposal
Date: 2006-05-10 15:30:07
Message-ID: 446206FF.7050603@superlativ.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

Martijn van Oosterhout wrote:
> On Wed, May 10, 2006 at 04:38:31PM +0200, PFC wrote:
>> You need to do some processing to know how many rows the function
>> would return.
>> Often, this processing will be repeated in the function itself.
>> Sometimes it's very simple (ie. the function will RETURN NEXT each
>> element in an array, you know the array length...)
>> Sometimes, for functions returning few rows, it might be faster to
>> compute the entire result set in the cost estimator.
>
> I think the best would probably be to assign a constant. An SRF will
> generally return between one of 1-10, 10-100, 100-1000, etc. You don't
> need exact number, you just need to get within an order of magnitude
> and a constant will work fine for that.
>
> How many functions sometimes return one and sometimes a million rows?

It will probably be quite common for the number to depend on the number
of rows in other tables. Even if this is fairly constant within one db
(some assumption), it is likely to be different in others using the same
function definition. Perhaps a better solution would be to cache the
result of the estimator function.

/Nis

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dennis Bjorklund 2006-05-10 15:36:16 Re: BEGIN inside transaction should be an error
Previous Message Markus Schaber 2006-05-10 15:04:25 Re: [HACKERS] Big IN() clauses etc : feature proposal

Browse pgsql-performance by date

  From Date Subject
Next Message Thomas Vatter 2006-05-10 15:41:01 Re: in memory views
Previous Message Scott Marlowe 2006-05-10 15:11:57 Re: in memory views