Received: from mailhost.efbs-seafrigo.fr ([217.167.38.10]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fAKHfgm34643 for ; Tue, 20 Nov 2001 12:41:43 -0500 (EST) (envelope-from frbn@efbs-seafrigo.fr) Received: from efbs-seafrigo.fr (franck.efbs-seafrigo.fr [192.168.84.50]) by mailhost.efbs-seafrigo.fr (Postfix) with ESMTP id C7B97CF8; Tue, 20 Nov 2001 19:40:37 -0500 (EST) Message-ID: <3BFA95ED.EE814258@efbs-seafrigo.fr> Date: Tue, 20 Nov 2001 18:42:05 +0100 From: frbn@efbs-seafrigo.fr X-Mailer: Mozilla 4.7 [fr] (Win98; I) X-Accept-Language: fr MIME-Version: 1.0 To: Tom Lane , sszabo@megazone23.bigpanda.com Cc: pgsql-sql@postgresql.org Subject: Re: SELECT * FROM t where p or q; References: <3BF51764.8BEAC873@efbs-seafrigo.fr> <29635.1006270833@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200111/320 X-Sequence-Number: 5702 thanks a lot to pay attention to my problem thanks to you, after a 15mn long "vacuum ANALYZE table" :( the "OR" works now just how it was supposed to. I wrongly thought that a "vacuum" did a "vacuum ANALYZE" by default. I can't figure out how Tera-bytes databases admins can deal with such vacuum delays! (except if a vacuum is only needed every 10 millions records :] ) Best regards, Franck. Tom Lane wrote : > > frbn@efbs-seafrigo.fr writes: > > on a +10 millions rec table, a simple select: > > SELECT * FROM tab where num = x; > > time: 5 secondes > > > SELECT * FROM tab WHERE num = x OR num = y; > > time: more than 10 mn !!! > > What does EXPLAIN show? Have you VACUUM ANALYZEd the table recently > (or indeed ever)? This looks a lot like the behavior on a > never-vacuumed table --- the default statistical assumptions are such > that an indexscan looks like a win for one equality clause, but not > for two ORed clauses. > > regards, tom lane