From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mario Ivankovits <mario@ops.co.at>
Cc: pgsql-performance@postgresql.org
Subject: Re: index not used if using IN or OR
Date: Thu, 04 Nov 2004 09:52:03 -0500
Message-ID: <25181.1099579923@sss.pgh.pa.us> (raw)
In-Reply-To: <4189E086.5060400@ops.co.at>
References: <4189E086.5060400@ops.co.at>
Mario Ivankovits <mario@ops.co.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
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-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, mario@ops.co.at
Subject: Re: index not used if using IN or OR
In-Reply-To: <25181.1099579923@sss.pgh.pa.us>
* 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