Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1agz5Q-0002mj-PX for pgsql-committers@arkaria.postgresql.org; Fri, 18 Mar 2016 18:25:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1agz5Q-0003s1-3t for pgsql-committers@arkaria.postgresql.org; Fri, 18 Mar 2016 18:25:24 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1agz5D-0003ar-6T for pgsql-committers@postgresql.org; Fri, 18 Mar 2016 18:25:11 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1agz59-0007pZ-Vb for pgsql-committers@postgresql.org; Fri, 18 Mar 2016 18:25:09 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 43B5E20D0F for ; Fri, 18 Mar 2016 14:25:07 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Fri, 18 Mar 2016 14:25:07 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=Si4sPjuEPq5e6sb 5meD8XFJ/TEs=; b=Zqov+tbNHyXHJYSxlKvkY87LOSknPvT9dqDSlyc9zIqwCD2 yEJBbZypPYbOFXbADOp9B4T1s8YciYZ+BaT3Vp46Cbj4ihTH+qHwNf20wf0uQxUb 6aroiqxBw+QjeFlm2bSCwYYVRtJ8vMcJoYv0PCq3DMv31wzW9Zu2eGg0sjKk= X-Sasl-enc: CVMwxgpW4uN2Qk1KzHKjvYOcuonWZBT14cutTCSez1ch 1458325506 Received: from intern.anarazel.de (unknown [184.23.178.130]) by mail.messagingengine.com (Postfix) with ESMTPA id E1CC56801CD; Fri, 18 Mar 2016 14:25:06 -0400 (EDT) Date: Fri, 18 Mar 2016 11:25:05 -0700 From: Andres Freund To: Robert Haas Cc: pgsql-committers@postgresql.org Subject: Re: pgsql: Improve memory management for external sorts. Message-ID: <20160318182505.tfmduy5istafshhp@alap3.anarazel.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org On 2016-03-17 20:11:00 +0000, Robert Haas wrote: > Improve memory management for external sorts. > > Introduce a new memory context which stores tuple data, and reset it > at the end of each merge pass; this helps avoid memory fragmentation > and, consequently, overallocation. Also, for the final merge patch, > eliminate memory context chunk header overhead entirely by allocating > all of the memory used for buffering tuples during the merge in a > single chunk. Since this modestly increases the number of tuples we > can store, grow the memtuples array a bit so that we're less likely to > run short of slots there. > > Peter Geoghegan. Review and testing of patches in this series by > Jeff Janes, Greg Stark, Mithun Cy, and me. Cross compiling for windows results in: /home/andres/src/postgresql/src/backend/utils/sort/tuplesort.c: In function ‘beginmerge’: /home/andres/src/postgresql/src/backend/utils/sort/tuplesort.c:2695:34: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘int64 {aka long long int}’ [-Wformat=] elog(LOG, "tape %d initially used %ld KB of %ld KB batch " ^ /home/andres/src/postgresql/src/backend/utils/sort/tuplesort.c:2695:34: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘int64 {aka long long int}’ [-Wformat=] config.status: creating src/interfaces/ecpg/include/ecpg_config.h /home/andres/src/postgresql/src/backend/utils/sort/tuplesort.c: In function ‘beginmerge’: /home/andres/src/postgresql/src/backend/utils/sort/tuplesort.c:2695:34: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘int64 {aka long long int}’ [-Wformat=] elog(LOG, "tape %d initially used %ld KB of %ld KB batch " Which seems like a valid complain on a LLP64 platform (i.e. where long is 32bit) like windows. Andres -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers