Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id C8DF664FC53 for ; Sat, 15 Nov 2008 13:07:39 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 56915-06 for ; Sat, 15 Nov 2008 13:07:37 -0400 (AST) 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 E810064FC46 for ; Sat, 15 Nov 2008 13:07:35 -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 mAFH7VX4007427; Sat, 15 Nov 2008 12:07:31 -0500 (EST) To: "=?ISO-8859-5?B?svbi0Nv22SDC2Nzn2OjY3Q==?=" cc: "Richard Huxton" , pgsql-performance@postgresql.org Subject: Re: PostgreSQL OR performance In-reply-to: <331e40660811150557s50e54c54m974645e31e30a612@mail.gmail.com> References: <331e40660811050312u552cab53ifa88e493e1c4f7ac@mail.gmail.com> <1225902700.1432.53.camel@jdavis> <331e40660811060246m51df553egd4e2ba91f08d1434@mail.gmail.com> <29e3942f0811060426k5fe34b1av401a2dba62e4ae3c@mail.gmail.com> <331e40660811060833l49bf837em41ca88d4b2061ea1@mail.gmail.com> <49131ED5.80307@archonet.com> <331e40660811060937q460e6f9fvf336455200d31f56@mail.gmail.com> <331e40660811070114rd70cf0dy194020a9f9ea8802@mail.gmail.com> <49141C5E.2010404@archonet.com> <331e40660811150557s50e54c54m974645e31e30a612@mail.gmail.com> Comments: In-reply-to "=?ISO-8859-5?B?svbi0Nv22SDC2Nzn2OjY3Q==?=" message dated "Sat, 15 Nov 2008 15:57:03 +0200" Date: Sat, 15 Nov 2008 12:07:31 -0500 Message-ID: <7426.1226768851@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200811/139 X-Sequence-Number: 31870 "=?ISO-8859-5?B?svbi0Nv22SDC2Nzn2OjY3Q==?=" writes: > I am not. I can't see how materialize can multiply number of rows it gets > from sort by 100. Is it the right-hand input of a merge join? If so you're looking at mark/restore rescans, ie, repeated fetches of the same tuples. There must be a huge number of duplicate join keys in that relation to make for such an increase though. Normally the planner avoids putting a table with lots of duplicates as the RHS of a merge, but if it doesn't have good statistics for the join key then it might not realize the problem. regards, tom lane