Re: Sequential scan from simple query - Mailing list pgsql-general

From Tom Lane
Subject Re: Sequential scan from simple query
Date
Msg-id 20578.1179931465@sss.pgh.pa.us
Whole thread Raw
In response to Sequential scan from simple query  ("Leif B. Kristensen" <leif@solumslekt.org>)
List pgsql-general
"Leif B. Kristensen" <leif@solumslekt.org> writes:
> Can anybody tell me why the following query requires a full table scan?
> pgslekt=> explain select person_id, last_edit from persons
>                order by last_edit desc, person_id desc limit 50;

> 'persons' is a regular table where person_id is the primary
> key. 'last_edit' is a regular date field. I've also tried:
> pgslekt=> create index last_edit_key on persons(last_edit);
> But that doesn't make any difference.

Neither of those indexes can provide the requested two-column ordering.

            regards, tom lane

pgsql-general by date:

Previous
From: André Volpato
Date:
Subject: Re: Faster data type for one-length values
Next
From: "Leif B. Kristensen"
Date:
Subject: Re: Sequential scan from simple query