| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | "Leif B(dot) Kristensen" <leif(at)solumslekt(dot)org> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Sequential scan from simple query |
| Date: | 2007-05-23 14:44:25 |
| Message-ID: | 20578.1179931465@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
"Leif B. Kristensen" <leif(at)solumslekt(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Leif B. Kristensen | 2007-05-23 14:52:19 | Re: Sequential scan from simple query |
| Previous Message | André Volpato | 2007-05-23 14:39:11 | Re: Faster data type for one-length values |