pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nis Jorgensen <nis@superlativ.dk>
To: Martijn van Oosterhout <kleptog@svana.org>
Cc: PFC <lists@peufeu.com>
Cc: Markus Schaber <schabi@logix-tt.com>
Cc: pgsql-performance@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Big IN() clauses etc : feature proposal
Date: Wed, 10 May 2006 17:30:07 +0200
Message-ID: <446206FF.7050603@superlativ.dk> (raw)
In-Reply-To: <20060510145551.GB14476@svana.org>
References: <1147110142.32369.7.camel@archimedes>
	<20060508175013.GY99570@pervasive.com>
	<28288.1147111196@sss.pgh.pa.us>
	<op.s89zl30wcigqcu@apollo13>
	<20060509105214.P90693@vesihiisi.cksoft.de>
	<op.s8916gm6cigqcu@apollo13>
	<758d5e7f0605090943p1bbfdae2p4cb28ba128288316@mail.gmail.com>
	<op.s9amckxhcigqcu@apollo13>
	<4461EAAC.7030105@logix-tt.com>
	<op.s9cayhotcigqcu@apollo13>
	<20060510145551.GB14476@svana.org>

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





view thread (44+ messages)  latest in thread

Message-ID: <446206FF.7050603@superlativ.dk>
Permalink:  ../446206FF.7050603@superlativ.dk/
Also on:    postgresql.org/message-id/446206FF.7050603@superlativ.dk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: nis@superlativ.dk, kleptog@svana.org, lists@peufeu.com, schabi@logix-tt.com, pgsql-hackers@postgresql.org
  Subject: Re: [HACKERS] Big IN() clauses etc : feature proposal
  In-Reply-To: <446206FF.7050603@superlativ.dk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox