Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fAKFecm29763 for ; Tue, 20 Nov 2001 10:40:38 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id fAKFeXc29638; Tue, 20 Nov 2001 10:40:39 -0500 (EST) To: frbn@efbs-seafrigo.fr cc: pgsql-sql@postgresql.org Subject: Re: SELECT * FROM t where p or q; In-reply-to: <3BF51764.8BEAC873@efbs-seafrigo.fr> References: <3BF51764.8BEAC873@efbs-seafrigo.fr> Comments: In-reply-to frbn@efbs-seafrigo.fr message dated "Fri, 16 Nov 2001 14:40:52 +0100" Date: Tue, 20 Nov 2001 10:40:33 -0500 Message-ID: <29635.1006270833@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200111/295 X-Sequence-Number: 5677 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