X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 79C5A5E4828 for ; Tue, 7 Sep 2004 15:30:27 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18906-05 for ; Tue, 7 Sep 2004 14:30:25 +0000 (GMT) Received: from boutiquenumerique.com (gailleton-2-82-67-9-10.fbx.proxad.net [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 0911F5E472E for ; Tue, 7 Sep 2004 15:30:18 +0100 (BST) Received: (qmail 6073 invoked from network); 7 Sep 2004 16:30:28 +0200 Received: from unknown (HELO musicbox) (192.168.0.2) by gailleton-2-82-67-9-10.fbx.proxad.net with SMTP; 7 Sep 2004 16:30:28 +0200 To: pgsql-performance@postgresql.org Subject: Re: The usual sequential scan, but with LIMIT ! References: <4134BF36.3000504@syscor.com> <413BA104.1040508@geizhals.at> <14846.1094488841@sss.pgh.pa.us> <29692.1094564867@sss.pgh.pa.us> Message-ID: From: =?iso-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Tue, 07 Sep 2004 16:30:54 +0200 In-Reply-To: <29692.1094564867@sss.pgh.pa.us> User-Agent: Opera M2/7.53 (Linux, build 737) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/46 X-Sequence-Number: 8174 Yes, you're right as usual. I had not thought about playing with ORDER BY on a field which has only one value in the result set. > If you write it as > SELECT WHERE topic_id=2 ORDER BY topic_id DESC,id DESC. > then an index on (topic_id, id) will work fine. The mixed ASC/DESC > ordering is not compatible with the index.