Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZldJM-0000Vy-L7 for pgsql-bugs@arkaria.postgresql.org; Mon, 12 Oct 2015 13:38:45 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZldJM-0003Fv-6u for pgsql-bugs@arkaria.postgresql.org; Mon, 12 Oct 2015 13:38:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZldJL-0003FV-2c for pgsql-bugs@postgresql.org; Mon, 12 Oct 2015 13:38:43 +0000 Received: from nm18-vm4.bullet.mail.ne1.yahoo.com ([98.138.91.178]) by magus.postgresql.org with esmtps (TLS1.0:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZldJH-0000qx-8n for pgsql-bugs@postgresql.org; Mon, 12 Oct 2015 13:38:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ymail.com; s=s2048; t=1444657115; bh=cPJJHH9NSRLBg3NCj5Ob+OMSJHLDFjUu0eFaanFDyu8=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=YdoB0jWzXHsN90/ae3ruSp+mOyetLqflw+wagcgFNBkQWje+yExT30L736uEpY1lJoGu/S0kS1qj8E7SRu84joWomBFt4eo4kcMl9vVr6U04BaDwwIaJnbChsPX1gM8Ouq0C58l4JpCXif71fMdp1dH+yKO3Uu9Jpip3w7XpJlj4ymuy8mJaMpJBjOIqrnMBWGeFqnMmPlZ10h3HlsEKis/b8mBnNARTN+Z4q/A9V6WrolHeh0aTgZO1MtpJssmSBuEztziQ0Hx9XxqCw4TwWj6e7rrS2rHtNaSr9Y/5V74OsZWOXIZYqsjvwzMTvvF3HYyYsoxmk2Z5I1N3CxWsJg== Received: from [98.138.100.112] by nm18.bullet.mail.ne1.yahoo.com with NNFMP; 12 Oct 2015 13:38:35 -0000 Received: from [98.138.226.162] by tm103.bullet.mail.ne1.yahoo.com with NNFMP; 12 Oct 2015 13:38:35 -0000 Received: from [127.0.0.1] by omp1063.mail.ne1.yahoo.com with NNFMP; 12 Oct 2015 13:38:35 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 889983.6589.bm@omp1063.mail.ne1.yahoo.com X-YMail-OSG: Ym5Z3E4VM1mwk1r4yXbpEuQM1Kes5oiAKVdak1t_4vjXtOJEavddIM5MiVSLj6. xzyxDXZj29QwWgvFJoK3LF3PgT91czNYyJBZSJpzd8tjNtlLqjJcQyfuLA2fvtvqcOEK.mOMe_2V 09rwv700hvHULcRHKmrKyvxjCOjMCmw58yyy_isarmyqglhV0PRr928zsEBV4aR3HLnVlEl_rmBF qaGWVUj8TBOEWdifAePYABYD4jpmD_BtE631bSG9cM_759Ow.hmHM9NibuAFW3l7RnaF7ORhlaIS qfACy1QPuAFJc1jFqdn_zIMGh3u1ryAT_nziAAWouVu3dvbNXqbAGRg7f8gXuN6d6QUr5mQaoZn4 DIFCCbvbJOMul6bMYDcxRgs0.AOpDKTmhAMuxhVtwePvdXEgkwmHYfxv_1s6BEObySIx3iAcjPMK 3hDLMnmJNj9oj.o6JpZJ7xrtJfGVU7tBlp.EEb2mecUJ_6rqwoMuKi5Mio.iNLXEyB92T95DmFWo UmcMbnAPvb1nSgDg_DLjTF3q2 Received: by 98.138.101.166; Mon, 12 Oct 2015 13:38:35 +0000 Date: Mon, 12 Oct 2015 13:37:16 +0000 (UTC) From: Kevin Grittner Reply-To: Kevin Grittner To: "jkoceniak@mediamath.com" , "pgsql-bugs@postgresql.org" Message-ID: <1111603541.2485705.1444657036683.JavaMail.yahoo@mail.yahoo.com> In-Reply-To: <20151009234654.328.91105@wrigleys.postgresql.org> References: <20151009234654.328.91105@wrigleys.postgresql.org> Subject: Re: BUG #13672: What is the purpose of the temp_buffers setting? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Length: 2232 X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On Friday, October 9, 2015 11:34 PM, "jkoceniak@mediamath.com" wrote: > I set temp_buffers to a high value (8GB). My understanding was > that temporary tables stay in memory if they do not go over > temp_buffers limit. Since temp_buffers is a limit on how much process-local memory each connection can reserve for temporary table buffers, 8GB seems like an insanely high value. Keep in mind that once a connection allocates memory for this purpose, it doesn't release it until the connection is closed, so with this setting, if you had 100 connections open which had all used temporary tables, you might have 800GB set aside for this purpose even if all of the connections were idle and had dropped all of their temporary tables. > However, I noticed that any temporary tables that I create are > written to disk. (i.e. I see t181_869525834 filenames in the data > directory) Are you sure that those temporary files are related to temporary tables? temp_buffers is only for pages in temporary tables, not for the temporary work files created by sorts, hash joins, CTEs, etc. Those spill to disk if work_mem is not adequate to hold them. > Also, I don't see any query performance improvements when > querying temporary tables using a higher temp_buffers value. Keep in mind that even if a temporary table doesn't fit into temp_buffers, the OS cache will tend to cache it for some period of time, so you are likely only dealing with difference between accessing the pages in process-local memory versus bringing them in from the OS RAM cache. That might be hard to measure. > What is the purpose of this setting and what performance > improvements would you expect to see by adjusting the > temp_buffers value? Personally, I would tend to think that the cases in which increasing this setting would show any improvement would be few and far between. I think that the default setting is probably too high, especially for anyone who increases max_connections from the default of 100. The setting you have, combined with max_connections of 1000 could tie up 8TB in this type of cache, for very dubious benefit. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs