quick question: index optimisations on small tables

From: "Andrew Snow" <andrew(at)modulus(dot)org>
To: <pgsql-general(at)postgresql(dot)org>
Subject: quick question: index optimisations on small tables
Date: 2001-08-30 14:59:24
Message-ID: 000801c13164$5b674630$fa01b5ca@avon
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


If I have:

CREATE TABLE small (
key integer PRIMARY KEY,
value text
);

and assuming there are only enough rows to fit in one page, doesn't it
make sense to use the index instead of a seq. scan for queries of type

SELECT value FROM small WHERE key = 12345;

Since it can get the answer straight out of the index, and if there are
potentially numerous rows, looking up a b-tree is faster than a linear
search?

- Andrew

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lee Crampton 2001-08-30 15:01:59 urgently wanted - plpgsql.so for pg 6.4.2
Previous Message Shaun Thomas 2001-08-30 14:57:38 Re: MySQL treads belong else where.