X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 13A7D11F6772 for ; Tue, 11 Apr 2006 00:07:12 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: 0.126 X-Spam-Level: X-Spam-Status: No, score=0.126 required=5 tests=[AWL=0.126] Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id QqAAPkjjE4Ci for ; Tue, 11 Apr 2006 00:05:49 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 7476011F60B3 for ; Mon, 10 Apr 2006 23:57:58 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k3B2vvFr003251; Mon, 10 Apr 2006 22:57:57 -0400 (EDT) To: "Vellinga, Fred" cc: "'pgsql-sql@postgresql.org'" Subject: Re: Special meaning of NL string In-reply-to: References: Comments: In-reply-to "Vellinga, Fred" message dated "Tue, 04 Apr 2006 09:40:12 +0100" Date: Mon, 10 Apr 2006 22:57:57 -0400 Message-ID: <3250.1144724277@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200604/78 X-Sequence-Number: 24887 "Vellinga, Fred" writes: > The query > SELECT COUNT(*) FROM Table WHERE Field1 = 'NL' OR Field2 = 'NL' > does a sequence scan instead of an index scan, and is thus very slow. If I > replace NL by BE (Belgium) the query does an index scan. Probably, 'NL' is a lot more common than 'BE' in your table ... the planner does examine statistics while deciding what sort of scan to use. regards, tom lane