Re: index not used if using IN or OR

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mario Ivankovits <mario(at)ops(dot)co(dot)at>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: index not used if using IN or OR
Date: 2004-11-04 14:52:03
Message-ID: 25181.1099579923@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Mario Ivankovits <mario(at)ops(dot)co(dot)at> writes:
> After populating the table with 8920 records and "analyze" the scenario
> gets even worser:

> select * from tt where seckey = 1;
> Seq Scan on tt (cost=0.00..168.50 rows=1669 width=12) (actual
> time=0.000..15.000 rows=1784 loops=1)
> Filter: (seckey = 1)
> Total runtime: 31.000 ms

> Now also this simple query uses a "Seq Scan".

Which is exactly what it *should* do, considering that it is selecting
1784 out of 8920 records. Indexscans only win for small selectivities
--- the rule of thumb is that retrieving more than about 1% of the
records should use a seqscan.

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Chris Browne 2004-11-04 15:47:31 Re: Anything to be gained from a 'Postgres Filesystem'?
Previous Message Andrew Sullivan 2004-11-04 14:02:17 Re: preloading indexes