"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