Re: Created Index is not used

From: Ragnar <gnari(at)hive(dot)is>
To: Kjeld Peters <kjeld(dot)peters(at)profiling-company(dot)de>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Created Index is not used
Date: 2006-02-23 13:03:26
Message-ID: 1140699807.5728.42.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On fim, 2006-02-23 at 13:35 +0100, Kjeld Peters wrote:
> Select and update statements are quite slow on a large table with more
> than 600,000 rows. The table consists of 11 columns (nothing special).
> The column "id" (int8) is primary key and has a btree index on it.
>
> The following select statement takes nearly 500ms:
>
> SELECT * FROM table WHERE id = 600000;
>
> A prepending "EXPLAIN" to the statement reveals a seq scan:
>
> EXPLAIN SELECT * FROM table WHERE id = 600000;
>
> "Seq Scan on table (cost=0.00..15946.48 rows=2 width=74)"
> " Filter: (id = 600000)"

> I tried a full vacuum and a reindex, but had no effect. Why is
> PostgreSQL not using the created index?

try one of:

SELECT * FROM table WHERE id = '600000';
SELECT * FROM table WHERE id = 600000::int8;
PostgreSQL 8+

gnari

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Kjeld Peters 2006-02-23 14:09:10 Re: Created Index is not used
Previous Message Ibrahim Tekin 2006-02-23 12:52:35 Re: LIKE query on indexes