Title: RE: [SQL] Special meaning of NL string

Tom,

Thanks for your answer. The problem is indeed related to the statistics.
The isssue now seems to find out why the statistics are 'incorrect' every day.
My gues is the following: we run every night the command VACUUM ANALYZE. This command return wrong statistics info. Because when I run ANALYZE only on a table, everything is fine.

We are on PosgreSQL 7.4.


Groet,
Fred Vellinga



-----Original Message-----
From: Tom Lane [mailto:[EMAIL PROTECTED]]
Sent: 11 April 2006 04:58
To: Vellinga, Fred
Cc: 'pgsql-sql@postgresql.org'
Subject: Re: [SQL] Special meaning of NL string


"Vellinga, Fred" <[EMAIL PROTECTED]> 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

Reply via email to