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

Re: BUG #1408: don't see index

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: andrzej <wppl16(at)wp(dot)pl>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1408: don't see index
Date: 2005-01-20 20:28:45
Message-ID: 20050120202845.GA30746@wolff.to (view raw or flat)
Thread:
Lists: pgsql-bugs
On Tue, Jan 18, 2005 at 09:01:29 +0000,
  andrzej <wppl16(at)wp(dot)pl> wrote:
> 
> The following bug has been logged online:
> 
> Bug reference:      1408
> Logged by:          andrzej
> Email address:      wppl16(at)wp(dot)pl
> PostgreSQL version: 8.0.0-rc5
> Operating system:   windows XP
> Description:        don't see index
> Details: 
> 
> Create table t1
> (
>  v varchar(5) not null,
>  m varchar(20),
>  d date,
>  l varchar(10),
>  primary key(v) 
> );
> 
> explain select * from t1 where v='abc'
> result:
> Seq Scan on t1 (....
> Filter:((v)::text='abc'::text)
> DON'T SEE INDEX PKEY ???????!!!!
> 
> but Postgres 7.4.2 Linux
> explain select * from t1 where v='abc'
> result:
> Index Scan using t1_pkey on t1(...
> Index Cond((v)::text='abc'::text)
> SEE INDEX PKEY OK !!!!!

This probably isn't a bug. In some circumstances a sequential scan is faster
than an index scan.

How many rows are in this table?
Have you run an ANALYZE on the table?

In response to

pgsql-bugs by date

Next:From: Magnus HaganderDate: 2005-01-20 20:42:42
Subject: Re: BUG #1421: Will not install in TS
Previous:From: Stephan SzaboDate: 2005-01-20 19:54:11
Subject: Re: BUG #1409: A good and a bad news: Crazy SQL JOIN?

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