pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vellinga, Fred <fred.vellinga@nl.verizonbusiness.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: 'pgsql-sql@postgresql.org' <pgsql-sql@postgresql.org>
Subject: Re: Special meaning of NL string
Date: Thu, 13 Apr 2006 07:23:56 +0100
Message-ID: <DB8373C85B90D71191350008C784C7390306AF84@ms-ams-exch02.nl.mcilink.com> (raw)

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:tgl@sss.pgh.pa.us] 
Sent: 11 April 2006 04:58
To: Vellinga, Fred
Cc: 'pgsql-sql@postgresql.org'
Subject: Re: [SQL] Special meaning of NL string 


"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

view thread (3+ messages)

Message-ID: <DB8373C85B90D71191350008C784C7390306AF84@ms-ams-exch02.nl.mcilink.com>
Permalink:  ../DB8373C85B90D71191350008C784C7390306AF84@ms-ams-exch02.nl.mcilink.com/
Also on:    postgresql.org/message-id/DB8373C85B90D71191350008C784C7390306AF84@ms-ams-exch02.nl.mcilink.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: fred.vellinga@nl.verizonbusiness.com, tgl@sss.pgh.pa.us
  Subject: Re: Special meaning of NL string
  In-Reply-To: <DB8373C85B90D71191350008C784C7390306AF84@ms-ams-exch02.nl.mcilink.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox