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 6487F528B7 for ; Fri, 22 Jul 2005 10:17:03 -0300 (ADT) 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 81156-04 for ; Fri, 22 Jul 2005 13:16:56 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 8548A5284E for ; Fri, 22 Jul 2005 10:16:54 -0300 (ADT) Received: (qmail 2673 invoked from network); 22 Jul 2005 15:16:58 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 22 Jul 2005 15:16:58 +0200 To: "Dawid Kuroczko" , "Postgresql Performance" Subject: Re: Planner doesn't look at LIMIT? References: <758d5e7f0507220210bfa4978@mail.gmail.com> Message-ID: Date: Fri, 22 Jul 2005 15:16:57 +0200 From: PFC 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 In-Reply-To: <758d5e7f0507220210bfa4978@mail.gmail.com> User-Agent: Opera M2/8.0 (Linux, build 1095) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/346 X-Sequence-Number: 13587 Which row do you want ? Do you want 'a row' at random ? I presume you want the N latest rows ? In that case you should use an ORDER BY on an indexed field, the serial primary key will do nicely (ORDER BY id DESC) ; it's indexed so it will use the index and it will fly. > Any ideas how to make it work (other than rewriting the query to use > subselects, use explicit id-rows, disabling hashjoin completely)? > Or is this a bug? > > Regards, > Dawid > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match >