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-27 23:14:13
Message-ID: 20020628091413.A15124@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jun 27, 2002 at 09:44:13AM -0400, Jorge Sarmiento wrote:
> > 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.
>
> Mi database has 3 000 000 registries, my queries are usually of 50 - 100
> rows... so index is faster right?

Well, you'll need to send the EXPLAIN ANALYZE output because my ESP module
doesn't appear to be working. There is no easy explanation for why a query
doesn't use an index scan.

> > You can use enable_seq_scan=off to force it. Let us know if the index scan
> > is actually significantly faster.
>
> I have inserted that line in postgresql.conf, and received an error.
> where should it be put?

In psql: set enable_seq_scan=off

or something like that.

--
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

Browse pgsql-general by date

  From Date Subject
Next Message s 2002-06-27 23:22:46 transfer data from oracle to postgres
Previous Message Stephan Graf 2002-06-27 21:38:45 sort of special characters