Re: Created Index is not used

From: Markus Schaber <schabi(at)logix-tt(dot)com>
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 12:46:02
Message-ID: 43FDAE8A.60805@logix-tt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi, Kjeld,

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;

Known issue which is fixed in 8.X servers, postgreSQL sees your 600000
as int4 literal and does not grasp that the int8 index works for it.

SELECT * FROM table WHERE id = 600000::int8;

should do it.

> SELECT version();
> "PostgreSQL 7.4.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.3
> (SuSE Linux)"

Btw, you should update to 7.4.12, there are importand bug fixes and it
is upgradable "in place", without dumping and reloading the database.

HTH,
Markus

--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org

In response to

Responses

Browse pgsql-performance by date

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