Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id B08682E00B7 for ; Sat, 31 May 2008 12:51:57 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 27245-05 for ; Sat, 31 May 2008 12:51:46 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by developer.postgresql.org (Postfix) with ESMTP id 80DA22E00B6 for ; Sat, 31 May 2008 12:51:54 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m4VFpndB016476; Sat, 31 May 2008 11:51:50 -0400 (EDT) To: Vlad Arkhipov cc: pgsql-performance@postgresql.org Subject: Re: Statistics issue In-reply-to: <483FDED1.1070503@dc.baikal.ru> References: <483FDED1.1070503@dc.baikal.ru> Comments: In-reply-to Vlad Arkhipov message dated "Fri, 30 May 2008 20:02:41 +0900" Date: Sat, 31 May 2008 11:51:49 -0400 Message-ID: <16475.1212249109@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200805/380 X-Sequence-Number: 30348 Vlad Arkhipov writes: > EXPLAIN ANALYZE > SELECT * > FROM i > WHERE d BETWEEN '2007-05-12' AND '2007-05-12' > Index Scan using i_d on i (cost=0.00..2.39 rows=1 width=402) (actual > time=0.053..4.284 rows=1721 loops=1) > Index Cond: ((d >= '2007-05-12'::date) AND (d <= '2007-05-12'::date)) > Total runtime: 6.645 ms > EXPLAIN ANALYZE > SELECT * > FROM i > WHERE d = '2007-05-12' > Index Scan using i_d on i (cost=0.00..38.97 rows=1572 width=402) > (actual time=0.044..4.250 rows=1721 loops=1) > Index Cond: (d = '2007-05-12'::date) > Total runtime: 6.619 ms Hmm, I wonder whether we shouldn't do something like this http://archives.postgresql.org/pgsql-committers/2008-03/msg00128.php for all range conditions, not just those made up by prefix_selectivity(). regards, tom lane