pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Darcy Buskermolen <darcy@wavefire.com>
To: weigelt@metux.de
Cc: postgresql performance list <pgsql-performance@postgresql.org>
Subject: Re: index not used
Date: Thu, 21 Apr 2005 12:23:52 -0700
Message-ID: <200504211223.52612.darcy@wavefire.com> (raw)
In-Reply-To: <20050421190543.GA16548@nibiru.borg.metux.de>
References: <20050421190543.GA16548@nibiru.borg.metux.de>

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.

http://www.wavefire.com
ph: 250.717.0200
fx: 250.763.1759



view thread (9+ messages)  latest in thread

Message-ID: <200504211223.52612.darcy@wavefire.com>
Permalink:  ../200504211223.52612.darcy@wavefire.com/
Also on:    postgresql.org/message-id/200504211223.52612.darcy@wavefire.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: darcy@wavefire.com, weigelt@metux.de
  Subject: Re: index not used
  In-Reply-To: <200504211223.52612.darcy@wavefire.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox