Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 51D8FB5DC00 for ; Mon, 12 Sep 2011 14:47:56 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 85236-03 for ; Mon, 12 Sep 2011 17:47:49 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from marajade.localdomain (97-64-237-59.client.mchsi.com [97.64.237.59]) by mail.postgresql.org (Postfix) with ESMTP id A3631B5DC02 for ; Mon, 12 Sep 2011 14:47:49 -0300 (ADT) Received: from [192.168.10.84] (unknown [192.168.10.84]) (Authenticated sender: andy) by marajade.localdomain (Postfix) with ESMTPA id 8C05046999; Mon, 12 Sep 2011 12:47:48 -0500 (CDT) Message-ID: <4E6E45CA.20606@squeakycode.net> Date: Mon, 12 Sep 2011 12:47:54 -0500 From: Andy Colson User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2 MIME-Version: 1.0 To: Robert Schnabel CC: pgsql-performance Subject: Re: Allow sorts to use more available memory References: <4E6E426D.7060405@missouri.edu> In-Reply-To: <4E6E426D.7060405@missouri.edu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.918 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RDNS_DYNAMIC=0.982 X-Spam-Level: X-Archive-Number: 201109/150 X-Sequence-Number: 44926 On 9/12/2011 12:33 PM, Robert Schnabel wrote: > The recent "data warehouse" thread made me think about how I use > work_mem for some of my big queries. So I tried SET work_mem = '4GB' for > a session and got > > ERROR: 4194304 is outside the valid range for parameter "work_mem" (64 > .. 2097151) > > A bit of searching turned up the "Allow sorts to use more available > memory" section of the to-do list. Am I correct in reading that the > max_val is 2GB and regardless of how much RAM I have in the box I'm > stuck with only using 2GB? Am I missing something? > > I'm using: PostgreSQL 9.0.4, compiled by Visual C++ build 1500, 64-bit > Windows 2008 Server Enterprise > > Thanks, > Bob > > work_mem is not the total a query can use. I believe each step can use that much, and each backend can use it for multiple bits. So if you had two backends, each doing 2 sorts, you'd use 2*2 = 4 * 2GB = 8GB. -Andy