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 A768411F6708 for ; Tue, 4 Apr 2006 05:40:40 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55726-03 for ; Tue, 4 Apr 2006 05:40:30 -0300 (ADT) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 6FD9E11F670B for ; Tue, 4 Apr 2006 05:40:28 -0300 (ADT) Received: from sirius.emea.verizonbusiness.com (sirius.wcom.co.uk [193.131.254.154]) by svr4.postgresql.org (Postfix) with ESMTP id B447D5AF8CD for ; Tue, 4 Apr 2006 08:40:28 +0000 (GMT) Received: from sirius.wcom.co.uk ([166.59.190.29] helo=sirius.emea.mci.com) by sirius.emea.verizonbusiness.com with esmtp (Exim 4.42) id 1FQh5L-000112-K0 for pgsql-sql@postgresql.org; Tue, 04 Apr 2006 08:40:24 +0000 Received: from ocampa.emea.verizonbusiness.com (leste.wcom.co.uk [166.59.190.250]) by sirius.emea.mci.com (4.7.0.120) with ESMTP id for ; Tue, 4 Apr 2006 09:40:05 +0100 (BST) Received: from ms-lon-exgw01.uk.mcilink.com ([170.127.78.40]) by ocampa.emea.verizonbusiness.com with esmtp (Exim 4.42) id 1FQh52-0007Rp-S8 for pgsql-sql@postgresql.org; Tue, 04 Apr 2006 08:40:04 +0000 Received: by ms-lon-exgw01.uk.mcilink.com with Internet Mail Service (5.5.2657.72) id <1LFV7WHV>; Tue, 4 Apr 2006 09:40:04 +0100 Message-ID: From: "Vellinga, Fred" To: "'pgsql-sql@postgresql.org'" Subject: Special meaning of NL string Date: Tue, 4 Apr 2006 09:40:12 +0100 X-Mailer: Internet Mail Service (5.5.2657.72) MIME-Version: 1.0 (Generated by NET-TEL Mailguard SMTP version 4.0.1.40) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C657C1.FDD656A8" X-VZ-EMEA-Spam-Score: -498.3 (---------------------------------------------------) X-VZ-EMEA-Signature: 14b134cffdd26cc33bde30f84b90c96d X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.127 required=5 tests=[HTML_MESSAGE=0.001, HTML_TAG_EXIST_TBODY=0.126] X-Spam-Score: 0.127 X-Spam-Level: X-Archive-Number: 200604/72 X-Sequence-Number: 24881 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C657C1.FDD656A8 Content-Type: text/plain Hello, I wonder if there is an issue with the string 'NL'. In my application NL stands for Netherlands and is thus a country code abreviation. 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. If I replace OR by AND it also does an index scan. So apparently the string NL in the OR Where clause decides the query planner not to execute an index scan. The database encoding schema is SQL_ASCII. Thanks, Fred Vellinga ------_=_NextPart_001_01C657C1.FDD656A8 Content-Type: text/html Content-Transfer-Encoding: quoted-printable Message
Hello,
 
I = wonder if there=20 is an issue with the string 'NL'. In my application NL stands for = Netherlands and is thus a country code = abreviation.
 
The = query
 
SELECT = COUNT(*)=20 FROM Table WHERE Field1 =3D 'NL' OR Field2 =3D = 'NL'
 
does a sequence scan = instead of an=20 index scan, and is thus very slow. If I replace NL by BE = (Belgium) the=20 query does an index scan. If I replace OR by AND it also does an = index=20 scan. So apparently the string NL in the OR Where clause decides = the query=20 planner not to execute an index scan. The database = encoding schema=20 is SQL_ASCII.
 
Thanks,
Fred Vellinga
 
 
------_=_NextPart_001_01C657C1.FDD656A8--