Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 22C3E632F9F for ; Tue, 23 Mar 2010 13:27:47 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 08288-01-8 for ; Tue, 23 Mar 2010 16:27:31 +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 84C4F63379A for ; Tue, 23 Mar 2010 13:26:48 -0300 (ADT) 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 o2NGQkSp000772; Tue, 23 Mar 2010 12:26:47 -0400 (EDT) To: "Dai, Tino" cc: "pgsql-admin@postgresql.org" Subject: Re: Disparity between 8.1.18 and 8.2.14 performance wise In-reply-to: <1CA7FF980DA3824F9A5C31532B7A40DCC4F6C43B@LCXCLMB01.LCDS.LOC.GOV> References: <1CA7FF980DA3824F9A5C31532B7A40DCC4B87E10@LCXCLMB01.LCDS.LOC.GOV> <16222.1269299255@sss.pgh.pa.us> <1CA7FF980DA3824F9A5C31532B7A40DCC4F6C43B@LCXCLMB01.LCDS.LOC.GOV> Comments: In-reply-to "Dai, Tino" message dated "Tue, 23 Mar 2010 11:22:13 -0400" Date: Tue, 23 Mar 2010 12:26:46 -0400 Message-ID: <771.1269361606@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.462 tagged_above=-10 required=5 tests=AWL=0.137, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201003/172 X-Sequence-Number: 33971 "Dai, Tino" writes: >>> But having said that, I think 8.1 might generate a reasonable plan if it >>> weren't getting misled by these useless constraints: >>> -> Seq Scan on role_setting (cost=0.00..964.50 rows=1 width=70) (actual time=0.036..121.443 rows=43833 loops=1) >>> Filter: (((section)::text = (section)::text) AND (ref_id = ref_id)) >> Can you get rid of those? > Unfortunately, I can't. The third-party product is protected by some kind of > obfuscation program. :( But is there any kind of external query rewrite tool > that can be put in front of postgres? Can't think of anything that would be useful for that. But you could possibly modify eqsel() so that it checks for the two inputs being equal() and returns a more reasonable selectivity for that case. We don't do that by default because it'd usually be a waste of cycles; but if you're dealing with an application that likes to generate such clauses, it'd be worth your time. regards, tom lane