X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9E1E35513E for ; Tue, 8 Mar 2005 19:02:55 +0000 (GMT) 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 64373-07 for ; Tue, 8 Mar 2005 19:02:52 +0000 (GMT) Received: from rwcrmhc11.comcast.net (rwcrmhc11.comcast.net [204.127.198.35]) by svr1.postgresql.org (Postfix) with ESMTP id 4AC0A54EE6 for ; Tue, 8 Mar 2005 19:02:51 +0000 (GMT) Received: from dell8200 (pcp05158174pcs.rte20201.de.comcast.net[69.139.132.79]) by comcast.net (rwcrmhc11) with SMTP id <2005030819025101300ofegue>; Tue, 8 Mar 2005 19:02:51 +0000 From: "Rick Schumeyer" To: "'Thomas F.O'Connell'" Cc: Subject: Re: index scan on =, but not < ? Date: Tue, 8 Mar 2005 14:02:50 -0500 Message-ID: <002801c52411$6d510f40$0200a8c0@dell8200> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 In-Reply-To: <9b7a46c3c46a4fdf1beeef7eb5727493@sitening.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/135 X-Sequence-Number: 10840 That makes a lot of sense. Sure enough, if I change the query from WHERE x > 0 (which return a lot of rows) to WHERE x > 0 AND x < 1 I now get an index scan. > As for why you see index usage in your first example query and not your > second: compare the number of rows in question. An index is extremely > useful if 19 rows will be returned. But when 62350411 rows will be > returned, you're talking about a substantial fraction of the table. A > sequential scan will probably correctly be judged to be faster by the > planner. >