Skip site navigation (1) Skip section navigation (2)

Re: Strange behaviour of SELECT ... IN

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: jsarmiento(at)camaralima(dot)org(dot)pe
Cc: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>,pgsql-general(at)postgresql(dot)org
Subject: Re: Strange behaviour of SELECT ... IN
Date: 2002-06-26 23:28:47
Message-ID: 20020627092847.B11046@svana.org (view raw or flat)
Thread:
Lists: pgsql-general
On Wed, Jun 26, 2002 at 04:00:08PM -0400, Jorge Sarmiento wrote:
> uh...
> 
> the first one is an INDEX SCAN, the second one a SEQUENTIAL SCAN.
> 
> number of rows in table has nothing to do...

Wrong. The number of rows has everything to do with it. If the number of
rows exceeds 50% of the table, a sequential scan is faster than an index
scan.

You can use enable_seq_scan=off to force it. Let us know if the index scan
is actually significantly faster.

Oh, you did use VACUUM ANALYZE right?

-- 
Martijn van Oosterhout   <kleptog(at)svana(dot)org>   http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.



In response to

Responses

pgsql-general by date

Next:From: ljbDate: 2002-06-27 01:01:38
Subject: Re: ordering error in query?
Previous:From: d aDate: 2002-06-26 23:26:22
Subject: Deadlock error when inserting single row

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group