Re: Special meaning of NL string - Mailing list pgsql-sql

From Tom Lane
Subject Re: Special meaning of NL string
Date
Msg-id 3250.1144724277@sss.pgh.pa.us
Whole thread Raw
In response to Special meaning of NL string  ("Vellinga, Fred" <fred.vellinga@nl.verizonbusiness.com>)
List pgsql-sql
"Vellinga, Fred" <fred.vellinga@nl.verizonbusiness.com> 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


pgsql-sql by date:

Previous
From: FavoYang@gmail.com
Date:
Subject: slow 'IN' clause
Next
From: John DeSoi
Date:
Subject: Re: global variables in plpgsql?