Re: Strange behaviour of SELECT ... IN

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: <jsarmiento(at)camaralima(dot)org(dot)pe>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Strange behaviour of SELECT ... IN
Date: 2002-06-26 17:40:53
Message-ID: 20020626103955.P93117-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 26 Jun 2002, Jorge Sarmiento wrote:

> when I do a:
>
> explain select * from table1 where name in ('JORGE');
>
> NOTICE: QUERY PLAN:
>
> Index Scan using idx_table1 on table (cost=0.00..10901.87 rows=3184 width=48)
>
> but if do a:
>
> explain select * from table1 where name in ('JORGE', 'JUAN', 'JOSE');
>
> NOTICE: QUERY PLAN:
>
> Seq Scan on table1 (cost=0.00..16689.73 rows=9506 width=48)
>
>
> why??? is there any way to make postgresql use index in the second type of
> query?

Well, the number of rows in the second is about 3 times greater. Have
you done a vacuum analyze of the table in question? How many rows does
the table actually have?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2002-06-26 17:49:38 Re: How to run multi-processor question
Previous Message Arnaud Le Taillanter 2002-06-26 17:34:14 Re: unlimited undo/journaling