X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D4EFAD1D45A for ; Sat, 31 Jan 2004 05:02:56 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 14415-01 for ; Sat, 31 Jan 2004 01:02:53 -0400 (AST) Received: from gizmo02bw.bigpond.com (gizmo02bw.bigpond.com [144.140.70.12]) by svr1.postgresql.org (Postfix) with SMTP id 56050D1D451 for ; Sat, 31 Jan 2004 01:02:51 -0400 (AST) Received: (qmail 6610 invoked from network); 31 Jan 2004 05:02:38 -0000 Received: from unknown (HELO bwmam03.bigpond.com) (144.135.24.75) by gizmo02bw.bigpond.com with SMTP; 31 Jan 2004 05:02:38 -0000 Received: from cpe-203-45-149-167.qld.bigpond.net.au ([203.45.149.167]) by bwmam03.bigpond.com(MAM REL_3_4_2 26/16266487) with SMTP id 16266487; Sat, 31 Jan 2004 15:02:50 +1000 Received: from [192.168.1.203] (helo=orion.mackay.local) by centauri.darrenmackay.com with esmtp (Exim 4.24) id 1AmnHR-0003hv-2u for pgsql-sql@postgresql.org; Sat, 31 Jan 2004 15:02:53 +1000 Received: from orion.mackay.local (unverified) by orion.mackay.local (Content Technologies SMTPRS 4.2.5) with ESMTP id for ; Sat, 31 Jan 2004 15:09:15 +1000 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: query not using index for descending records? X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Date: Sat, 31 Jan 2004 15:09:15 +1000 Content-class: urn:content-classes:message Message-ID: <035C9F7CE28601428BBB5B051C9F77F207678A@orion> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [SQL] query not using index for descending records? Thread-Index: AcPmc1sszydhKyG6T0+afJTI584v6ABROc9A From: "email lists" To: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/288 X-Sequence-Number: 16681 Hi, | You probably don't want to do that. The DESC only applies to the=20 | one expression it follows. What you want is probably:=20 | explain select datetime,id from trafficlogs order by=20 | datetime desc,id desc limit 20; This is exactly what I was after - worked a treat! Thanks. Darren