Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 400F6633D13 for ; Wed, 13 Jan 2010 11:23:48 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 99833-05 for ; Wed, 13 Jan 2010 15:23:28 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f218.google.com (mail-fx0-f218.google.com [209.85.220.218]) by mail.postgresql.org (Postfix) with ESMTP id 31A53633CE6 for ; Wed, 13 Jan 2010 11:23:36 -0400 (AST) Received: by fxm10 with SMTP id 10so10081355fxm.34 for ; Wed, 13 Jan 2010 07:23:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=JNzHvbaRgYcpxpx+yq/ct5v74O47RUOhAc4DLiWBPCs=; b=LN4nJp5QfKzcS+yuLE/MBolsXdyc5hSoX8pO6lmPfflJvbLWTfOgSZeEdOgG8kmre+ Tg7X5t46dY3i5S/RSITvzGlvpZMboE/vTTknn1yhHEFJ0dfFPvo71QlFw6dODqUCJJtb 1KpsAE6i1ig7C5uS6Bvy3yqJtYMve98sCBjgM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=FYcFxk88rsbf+fMlinPjT5nftH/sFPqs3eJ2nQKjrNjBlW49WJAjxNOutyTemYvq69 cnUNfhA6s/YT/ZQNrSgCn4ToFapVwFbn+AZPlALxS/PyuKr6qg3wp5Xm/77pSEoC78Xg IpIVIf80r/kzjziLcc9yovokitrtRvIQHgzJ0= MIME-Version: 1.0 Received: by 10.239.177.211 with SMTP id w19mr2525785hbf.162.1263396214198; Wed, 13 Jan 2010 07:23:34 -0800 (PST) In-Reply-To: <3073cc9b1001122231m1a15d187lae2a8096a813361b@mail.gmail.com> References: <3073cc9b0908191745o3dc63d95q6b9308ef5bd199f2@mail.gmail.com> <25315.1252881420@sss.pgh.pa.us> <3073cc9b1001111015t3888cbbex7171d61b952218da@mail.gmail.com> <603c8f071001111107v75276375g4d626dfc0efd8dc4@mail.gmail.com> <3073cc9b1001111114j7ddacd56p8966f9d61997a8b@mail.gmail.com> <3073cc9b1001111116x53427c9bm1e448128a3b4f6c6@mail.gmail.com> <18803.1263241120@sss.pgh.pa.us> <3073cc9b1001122231m1a15d187lae2a8096a813361b@mail.gmail.com> Date: Wed, 13 Jan 2010 10:23:32 -0500 Message-ID: <603c8f071001130723v634cb3c3u1604ea69efb04e91@mail.gmail.com> Subject: Re: [PERFORMANCE] work_mem vs temp files issue From: Robert Haas To: Jaime Casanova Cc: Tom Lane , decibel , psql performance list Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 201001/249 X-Sequence-Number: 37129 On Wed, Jan 13, 2010 at 1:31 AM, Jaime Casanova wrote: > On Mon, Jan 11, 2010 at 3:18 PM, Tom Lane wrote: >> >> Hmm. =A0Not clear where the temp files are coming from, but it's *not* t= he >> sort --- the "internal sort ended" line shows that that sort never went >> to disk. =A0What kind of plan is feeding the sort node? >> > > some time ago, you said: > """ > It might be useful to turn on trace_sort to see if the small files > are coming from sorts. =A0If they're from hashes I'm afraid there's > no handy instrumentation ... > """ > > and is clearly what was bother me... because most of all temp files > are coming from hash... > > why we don't show some of that info in explain? for example: we can > show memory used, no? or if the hash goes to disk... if i remove > #ifdef HJDEBUG seems like we even know how many batchs the hash > used... I had an idea at one point of making explain show the planned and actual # of batches for each hash join. I believe that "actual # of batches > 1" is isomorphic to "hash join went to disk". The code is actually pretty easy; the hard part is figuring out what to do about the UI. The choices seem to be: 1. Create a new EXPLAIN option just for this - what would we call it? 2. Think of some more, similar things and come up with a new EXPLAIN option covering all of them - what else would go along with? 3. Sandwhich it into an existing EXPLAIN option, most likely VERBOSE. 4. Display it by default. ...Robert