Re: How to avoid "Seq Scans"? - Mailing list pgsql-general

From Richard Huxton
Subject Re: How to avoid "Seq Scans"?
Date
Msg-id 46D53A75.8090708@archonet.com
Whole thread Raw
In response to How to avoid "Seq Scans"?  (Vincenzo Romano <vincenzo.romano@gmail.com>)
Responses Re: How to avoid "Seq Scans"?  (Vincenzo Romano <vincenzo.romano@gmail.com>)
List pgsql-general
Vincenzo Romano wrote:
> Hi all.
>
> In PG 8.2.4 I have a 4+M rows table like this:

> I'd need to write a stored function that should do the
> following:
>
> for rec in select * from t order by f2,f2 loop
> ...
> end loop;

>    ->  Seq Scan on t  (cost=0.00..85501.38 rows=4779338 width=28)
>
> I'd like to know a hint about a technicque to avoid the sequential
> scan!

But you're fetching all the rows - what other way would be faster?

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: Vincenzo Romano
Date:
Subject: How to avoid "Seq Scans"?
Next
From: "A. Kretschmer"
Date:
Subject: Re: How to avoid "Seq Scans"?