X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id A02769FA1B0; Wed, 10 May 2006 12:04:31 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 13241-02; Wed, 10 May 2006 12:04:14 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.logix-tt.com (unknown [212.211.145.186]) by postgresql.org (Postfix) with ESMTP id F33479FA32D; Wed, 10 May 2006 12:04:13 -0300 (ADT) Received: from kingfisher.intern.logix-tt.com (p549D13DA.dip0.t-ipconnect.de [84.157.19.218]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id B2BC765837; Wed, 10 May 2006 17:05:24 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 4C25718222EEA; Wed, 10 May 2006 17:04:25 +0200 (CEST) Message-ID: <446200F9.3070109@logix-tt.com> Date: Wed, 10 May 2006 17:04:25 +0200 From: Markus Schaber Organization: Logical Tracking and Tracing International AG, Switzerland User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: en-us, en MIME-Version: 1.0 To: PFC Cc: pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: [HACKERS] Big IN() clauses etc : feature proposal References: <445F7FF8.6070707@comcast.net> <1147110142.32369.7.camel@archimedes> <20060508175013.GY99570@pervasive.com> <28288.1147111196@sss.pgh.pa.us> <20060509105214.P90693@vesihiisi.cksoft.de> <758d5e7f0605090943p1bbfdae2p4cb28ba128288316@mail.gmail.com> <4461EAAC.7030105@logix-tt.com> In-Reply-To: X-Enigmail-Version: 0.93.0.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/255 X-Sequence-Number: 19042 Hi, PFC, 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 know, but we only have to estmiate the number of rows to give a hint to the query planner, so we can use lots of simplifications. E. G. for generate_series we return ($2-$1)/$3, and for some functions even constant estimates will be good enough. > - please execute me and store my results in a temporary storage, > count the rows returned, and plan the outer query accordingly That's an interesting idea. Markus -- Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software Development GIS Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org