Received: from sid.trust.ee (sid.trust.ee [194.204.23.180]) by hub.org (8.8.8/8.7.5) with ESMTP id LAA00766 for ; Thu, 14 May 1998 11:09:48 -0400 (EDT) Received: from trust.ee (wink.trust.ee [194.204.23.184]) by sid.trust.ee (8.8.7/8.8.7) with ESMTP id SAA09154; Thu, 14 May 1998 18:08:27 +0300 Message-ID: <355B094A.43F1DAAE@trust.ee> Date: Thu, 14 May 1998 18:10:02 +0300 From: Hannu Krosing X-Mailer: Mozilla 4.05 [en] (Win95; I) MIME-Version: 1.0 To: Olaf Mittelstaedt CC: pgsql-interfaces@postgreSQL.org Subject: Re: [INTERFACES] Re: Index unused with OR? References: <199805141321.PAA04595@gate.va.fh-ulm.de> <199805141359.PAA04711@gate.va.fh-ulm.de> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Olaf Mittelstaedt wrote: This is probably the wrong list, but ... > Actually, I discovered the problem using a table containg more than > 8000 rows, using the latest release 6.3.2. > > > Not using the index in OR queries was some-time ago a bug in > > PostgreSQL 6.1 if my memory is good. Think that has been solved in > > new releases, am I wrong ? seems _not_ to be fixed :( > VACUUM > w=> explain select * from p where m = 29000; > NOTICE: QUERY PLAN: > > Index Scan on p (cost=0.00 size=0 width=10) > > EXPLAIN > w=> explain select * from p where (m=29000) or (m=30000); > NOTICE: QUERY PLAN: > > Seq Scan on p (cost=0.00 size=0 width=10) > As a work-around try select * from p where (m=29000) union select * from p where (m=30000); it should be much faster. Btw, EXPLAIN thinks this to cost nothing ;) Unique (cost=0.00 size=0 width=0) -> Sort (cost=0.00 size=0 width=0) -> Append (cost=0.00 size=0 width=0) Hannu