Re: Sequencial scan over primary keys

From: Igor Roboul <igor(at)raduga(dot)dyndns(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Sequencial scan over primary keys
Date: 2000-11-10 12:43:06
Message-ID: 20001110154306.A22808@linux.rainbow
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Nov 10, 2000 at 10:16:47AM -0200, Vilson farias wrote:
> result of execution is a sequencial scan, but this is a PRIMARY KEY, it does
> has an index. How can it be explained?
If you wish use index, then you need include ORDER BY clause. AFAIK
two SELECTs on same data without ORDER BY _CAN_ return records in
different order. This is part of relation theory AFAIK. So index is
not used. But, for example, sequencial scan can be faster than indexed
when you do not use WHERE.
So for example, 'SELECT * FROM t1' will be faster then 'SELECT * FROM
t1 ORDER BY primary_key_field'. I think.

--
Igor Roboul, Unix System Administrator & Programmer @ sanatorium "Raduga",
Sochi, Russia
http://www.brainbench.com/transcript.jsp?pid=304744

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vilson farias 2000-11-10 12:43:13 Sequencial scan over primary keys 2
Previous Message Mathieu Arnold 2000-11-10 12:23:32 locales and indexes.