Re: Sequential scan from simple query

From: "Leif B(dot) Kristensen" <leif(at)solumslekt(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Sequential scan from simple query
Date: 2007-05-23 14:52:19
Message-ID: 200705231652.19671.leif@solumslekt.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday 23. May 2007 16:31, Leif B. Kristensen wrote:
>I've also tried:
>
>pgslekt=> create index last_edit_key on persons(last_edit);
>
>But that doesn't make any difference.

But this one did:

pgslekt=> create index last_edited_persons_key on
persons(last_edit,person_id);
CREATE INDEX
pgslekt=> explain select person_id, last_edit from persons
order by last_edit desc, person_id desc limit 50;
QUERY PLAN
-------------------------------------------------------------------
Limit (cost=0.00..3.81 rows=50 width=8)
-> Index Scan Backward using last_edited_persons_key on persons
(cost=0.00..1230.10 rows=16123 width=8)
(2 rows)

Doh ...
--
Leif Biberg Kristensen | Registered Linux User #338009
http://solumslekt.org/ | Cruising with Gentoo/KDE
My Jazz Jukebox: http://www.last.fm/user/leifbk/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Purusothaman A 2007-05-23 14:56:21 Re: [GENERAL] OIDs - file objects, are damaged by PostgreSQL.
Previous Message Tom Lane 2007-05-23 14:44:25 Re: Sequential scan from simple query