Re: Special meaning of NL string

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Vellinga, Fred" <fred(dot)vellinga(at)nl(dot)verizonbusiness(dot)com>
Cc: "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Special meaning of NL string
Date: 2006-04-11 02:57:57
Message-ID: 3250.1144724277@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Vellinga, Fred" <fred(dot)vellinga(at)nl(dot)verizonbusiness(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message John DeSoi 2006-04-11 05:15:37 Re: global variables in plpgsql?
Previous Message dave.bath 2006-04-11 01:17:03 global variables in plpgsql?