Re: How to avoid "Seq Scans"?

From: Richard Huxton <dev(at)archonet(dot)com>
To: Vincenzo Romano <vincenzo(dot)romano(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to avoid "Seq Scans"?
Date: 2007-08-29 09:20:53
Message-ID: 46D53A75.8090708@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2007-08-29 09:29:21 Re: How to avoid "Seq Scans"?
Previous Message Albe Laurenz 2007-08-29 09:16:23 documentation patch for LDAP service lookup