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 384F08B9CE7 for ; Sun, 6 Feb 2005 16:12:52 +0000 (GMT) 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 30020-08 for ; Sun, 6 Feb 2005 16:12:39 +0000 (GMT) Received: from mailout09.sul.t-online.com (mailout09.sul.t-online.com [194.25.134.84]) by svr1.postgresql.org (Postfix) with ESMTP id 3B01F8B9E60 for ; Sun, 6 Feb 2005 16:12:35 +0000 (GMT) Received: from fwd01.aul.t-online.de by mailout09.sul.t-online.com with smtp id 1Cxp1P-0006Sv-04; Sun, 06 Feb 2005 17:12:27 +0100 Received: from [192.168.0.70] (Z2qdcTZXre5mKVsmgGrjxL+D7SLWB0s7Eu7Xfo8Gt8umMQLsdaHskY@[217.86.175.49]) by fwd01.sul.t-online.com with esmtp id 1Cxp1H-0Spvzk0; Sun, 6 Feb 2005 17:12:19 +0100 Message-ID: <420641E3.10505@aeccom.com> Date: Sun, 06 Feb 2005 17:12:19 +0100 From: Dirk.Lutzebaeck@t-online.de (Dirk Lutzebaeck) Reply-To: lutzeb@aeccom.com User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Greg Stark Cc: pgsql-performance@postgresql.org, tgl@sss.pgh.pa.us, john@arbash-meinel.com Subject: Re: query produces 1 GB temp file References: <20050205182117.0125074@mail2.aeccom.com> <87y8e2kb8j.fsf@stark.xeocode.com> <42061B35.6000306@aeccom.com> <876515k7er.fsf@stark.xeocode.com> In-Reply-To: <876515k7er.fsf@stark.xeocode.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-ID: Z2qdcTZXre5mKVsmgGrjxL+D7SLWB0s7Eu7Xfo8Gt8umMQLsdaHskY X-TOI-MSGID: e7942f6b-4d83-4cca-9626-b06bc431a275 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/130 X-Sequence-Number: 10459 Greg Stark wrote: >I gave a bunch of "explain analyze select" commands to test estimates for >individual columns. What results do they come up with? If those are inaccurate >then raising the statistics target is a good route. If those are accurate >individually but the combination is inaccurate then you have a more difficult >problem. > > > After setting the new statistics target to 200 they did slightly better but not accurate. The results were attached to my last post. Here is a copy: explain analyze select * from bi where rc=130170467; QUERY PLAN ------------------------------------------------------------------------------------------------------------------- Seq Scan on bi (cost=0.00..41078.76 rows=190960 width=53) (actual time=0.157..3066.028 rows=513724 loops=1) Filter: (rc = 130170467::oid) Total runtime: 4208.663 ms (3 rows) explain analyze select * from bi where co=117305223; QUERY PLAN ------------------------------------------------------------------------------------------------------------------- Seq Scan on bi (cost=0.00..41078.76 rows=603988 width=53) (actual time=0.021..3692.238 rows=945487 loops=1) Filter: (co = 117305223::oid) Total runtime: 5786.268 ms (3 rows) Here is the distribution of the data in bi: select count(*) from bi; 1841966 select count(*) from bi where rc=130170467::oid; 513732 select count(*) from bi where co=117305223::oid; 945503