Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 41E5763272D for ; Fri, 8 Jan 2010 14:27:20 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 62782-03 for ; Fri, 8 Jan 2010 18:27:09 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 7E42E633BB3 for ; Fri, 8 Jan 2010 14:27:09 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o08IR32v009970; Fri, 8 Jan 2010 13:27:03 -0500 (EST) To: Kaloyan Iliev Iliev cc: pgsql-performance@postgresql.org Subject: Re: Change query join order In-reply-to: <4B47722A.4010502@digsys.bg> References: <4B47722A.4010502@digsys.bg> Comments: In-reply-to Kaloyan Iliev Iliev message dated "Fri, 08 Jan 2010 19:58:02 +0200" Date: Fri, 08 Jan 2010 13:27:03 -0500 Message-ID: <9969.1262975223@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.589 tagged_above=-10 required=5 tests=BAYES_00=-2.599, FH_DATE_PAST_20XX=3.188 X-Spam-Level: X-Archive-Number: 201001/152 X-Sequence-Number: 37032 Kaloyan Iliev Iliev writes: > My question is why the planner didn't do the index scan first on ms_data > to reduce the rows to ~ 11000 and the use the PK index on > ms_commands_history. 11000 index probes aren't exactly free. If they take more than about 1msec apiece, the planner picked the right plan. regards, tom lane