Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 711A664FCDE for ; Fri, 8 Aug 2008 02:39:05 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 16085-06 for ; Fri, 8 Aug 2008 02:39:01 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from asmtpout014.mac.com (asmtpout014.mac.com [17.148.16.89]) by postgresql.org (Postfix) with ESMTP id B13A064FCCF for ; Fri, 8 Aug 2008 02:39:02 -0300 (ADT) MIME-version: 1.0 Content-type: text/plain; charset=WINDOWS-1252; format=flowed; delsp=yes Received: from calcabrina.refactor.it ([88.149.177.167]) by asmtp014.mac.com (Sun Java(tm) System Messaging Server 6.3-6.03 (built Mar 14 2008; 32bit)) with ESMTPSA id <0K59006LPOZMZI90@asmtp014.mac.com> for pgsql-performance@postgresql.org; Thu, 07 Aug 2008 22:38:13 -0700 (PDT) Message-id: <3CA742D3-1D67-4572-AD4A-F7AA479771C7@mac.com> From: Giorgio Valoti To: pgsql-performance@postgresql.org In-reply-to: <27578.1218142907@sss.pgh.pa.us> Content-transfer-encoding: quoted-printable Subject: Re: Query Plan choice with timestamps Date: Fri, 08 Aug 2008 07:38:10 +0200 References: <321506D5-4400-470C-909E-C7700D49A540@mac.com> <12707.1218124259@sss.pgh.pa.us> <27578.1218142907@sss.pgh.pa.us> X-Mailer: Apple Mail (2.928.1) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.819 tagged_above=0 required=5 tests=MIME_QP_LONG_LINE=1.819 X-Spam-Level: * X-Archive-Number: 200808/65 X-Sequence-Number: 30946 On 07/ago/08, at 23:01, Tom Lane wrote: > Giorgio Valoti writes: >> On 07/ago/08, at 17:50, Tom Lane wrote: >>> These numbers seem pretty bogus: there is hardly any scenario in >>> which a >>> full-table indexscan should be costed as significantly cheaper =20 >>> than a >>> seqscan. Have you put in silly values for random_page_cost? > >> No, > > I looked at it more closely and realized that the cost discrepancy is > from the evaluation of the function: having to evaluate a SQL or =20 > plpgsql > function 247736 times more than explains the cost estimate =20 > differential > compared to a query that involves no function call. Some experiments > here suggest that it hardly matters whether the query uses indexscan =20= > or > seqscan because the time is dominated by the function calls anyway. I see, thank you Tom. Could it be a good idea adding some notes about =20= it in = ? As you said, since the function call dominates the query cost, in =20= this case, I think there=92s no point to use an index expression. Ciao -- Giorgio Valoti=