Re: Sequencial scan over primary keys - Mailing list pgsql-general

From Igor Roboul
Subject Re: Sequencial scan over primary keys
Date
Msg-id 20001110154306.A22808@linux.rainbow
Whole thread Raw
In response to Sequencial scan over primary keys  ("Vilson farias" <vilson.farias@digitro.com.br>)
List 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

pgsql-general by date:

Previous
From: "Vilson farias"
Date:
Subject: Sequencial scan over primary keys 2
Next
From: "Oliver Elphick"
Date:
Subject: Re: strange behvaviour in join? BUG in 7.02?