"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