X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 75E6253715 for ; Fri, 13 May 2005 00:12:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51487-01 for ; Fri, 13 May 2005 03:12:32 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id D964252A72 for ; Fri, 13 May 2005 00:12:28 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j4D3CPIj019399; Thu, 12 May 2005 23:12:25 -0400 (EDT) To: dbadmin@nqadmin.com Cc: pgsql-admin@postgresql.org Subject: Re: using greater than or less than vs equals in where condition In-reply-to: <4283DD2A.10007@nqadmin.com> References: <4283DD2A.10007@nqadmin.com> Comments: In-reply-to Prasanth message dated "Thu, 12 May 2005 17:48:10 -0500" Date: Thu, 12 May 2005 23:12:25 -0400 Message-ID: <19398.1115953945@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200505/177 X-Sequence-Number: 17606 Prasanth writes: > PG Version: 7.4.7 > explain analyze select * from data where type_code >'2' AND type_code<'4'; > [ is slow ] > explain analyze select * from data where type_code = '3'; > [ isn't ] Are there a whole lot of rows with type_code = 2? If so, this is fixed in 8.0. 2003-12-20 20:23 tgl * src/: backend/access/nbtree/nbtinsert.c, backend/access/nbtree/nbtpage.c, backend/access/nbtree/nbtsearch.c, include/access/nbtree.h: Improve btree's initial-positioning-strategy code so that we never need to step more than one entry after descending the search tree to arrive at the correct place to start the scan. This can improve the behavior substantially when there are many entries equal to the chosen boundary value. Per suggestion from Dmitry Tkach, 14-Jul-03. regards, tom lane