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

Re: index not used

From: Darcy Buskermolen <darcy(at)wavefire(dot)com>
To: weigelt(at)metux(dot)de
Cc: postgresql performance list <pgsql-performance(at)postgresql(dot)org>
Subject: Re: index not used
Date: 2005-04-21 19:23:52
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
On Thursday 21 April 2005 12:05, Enrico Weigelt wrote:
> Hi folks,
> I'm doing a simple lookup in a small table by an unique id, and I'm
> wondering, why explains tells me seqscan is used instead the key.
> The table looks like:
>     id	bigint		primary key,
>     a	varchar,
>     b	varchar,
>     c 	varchar
> and I'm quering: select * from foo where id = 2;
> I've got only 15 records in this table, but I wanna have it as
> fast as possible since its used (as a map between IDs and names)
> for larger queries.

The over head to load the index, fetch the record in there, then check the 
table for visibility and return the value, is far greater than just doing 15 
compares in the original table.

> thx

Darcy Buskermolen
Wavefire Technologies Corp.
ph: 250.717.0200
fx: 250.763.1759

In response to

pgsql-performance by date

Next:From: Enrico WeigeltDate: 2005-04-21 19:23:58
Subject: Re: immutable functions vs. join for lookups ?
Previous:From: Enrico WeigeltDate: 2005-04-21 19:22:26
Subject: Re: immutable functions vs. join for lookups ?

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