Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 3AFE7B5DC00 for ; Mon, 12 Sep 2011 14:58:06 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 93379-09 for ; Mon, 12 Sep 2011 17:57:59 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp2.peak6.com (smtp2.peak6.com [38.98.137.9]) by mail.postgresql.org (Postfix) with ESMTP id 78581B5D91F for ; Mon, 12 Sep 2011 14:57:59 -0300 (ADT) X-AuditID: 0a02cb1e-b7cbdae000007cad-84-4e6e48274673 Message-ID: <4E6E4826.8050002@peak6.com> Date: Mon, 12 Sep 2011 12:57:58 -0500 From: Shaun Thomas Reply-To: Organization: Peak6 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: Andy Colson CC: Robert Schnabel , pgsql-performance Subject: Re: Allow sorts to use more available memory References: <4E6E426D.7060405@missouri.edu> <4E6E45CA.20606@squeakycode.net> In-Reply-To: <4E6E45CA.20606@squeakycode.net> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed content-transfer-encoding: 7bit X-Originating-IP: [10.10.220.61] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNIsWRmVeSWpSXmKPExsXCxcQrpqvukedn8PGItcWsdnmL6zPPMVuc /P+eyYHZo2dmsMeFfdPYPRY//cYcwBzVwGiTmJeXX5JYkqqQklqcbKsU4OrobaYQXJKYl5JY lKLgklmcnJOYmZtapKSQmWKrZKSkUJCTmJyam5pXYquUWFCQmpeiZMelgAFsgMoy8xRS85Lz UzLz0m2VPIP9dS0sTC11DZXs4hEgoZslY8u0qWwF6zkqHn1uZm9gPMzWxcjJISFgInF343tG CFtM4sK99WBxXgENif2HVrJ0MXJwsAioStz56AcSZhNQk1i4+yZYuZCArMT+VedYQWx+AWGJ fR+amEFsUYEAiQWT3jJCjBGUODnzCQuILQLU++l3EzuIzSyQInHx0gywVcIC9hIrXs1jhpjp I/F+000mEJtTQFdi6tkjjBD1thIX5lxngbDlJba/nQNVLydxp+E5G8iZEgIKEteX+09gFJqF ZPMsJN2zkHQvYGRexSheXJaYnJFpVlCcW1JgqFeQmphtppeXWrKJERzFp+V2MK64oHiIUYCD UYmHd4JVnp8Qa2JZcWXuIUYJDmYlEd5QV6AQb0piZVVqUX58UWlOavEhRm1giE1kluJOzgcm mLySeGMDAyVx3qQ/mX5CAunAJJCdmlqQWgRTzcTBKdXAuErl4IfTJ3pLQy2yl149qPKd2bfl wnPtVxf1jp522Dh56tSZyz84CT5b+vT4zWWrFa6vPbj32h2eyar9Av2i/guKSguT2Ph21PhM L5xZZ5zPYPl0741tTaVMTOwxK89cqVti7ig6dXtY9D6h5bxNd29dE/uso8aUMJ+7rsPs+2x1 gx/ebM1LYpRYijMSDbWYi4oTAYdJrt3uAgAA X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.404 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201109/151 X-Sequence-Number: 44927 On 09/12/2011 12:47 PM, Andy Colson wrote: > 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. Exactly. Find a big query somewhere in your system. Use EXPLAIN to examine it. Chances are, that one query has one or more sorts. Each one of those gets its own work_mem. Each sort. The query have four sorts? It may use 4*work_mem. On a whim a while back, I doubled our 8MB setting to 16MB on a test system. During a load test, the machine ran out of memory, swapped out, and finally crashed after the OOM killer went nuts. Set this value *at your own risk* and only after *significant* testing. Having it too high can have rather unexpected consequences. Setting it to 1 or 2GB, unless you have VERY few threads, or a TON of memory, is a very, very bad idea. -- Shaun Thomas OptionsHouse | 141 W. Jackson Blvd. | Suite 800 | Chicago IL, 60604 312-676-8870 sthomas@peak6.com ______________________________________________ See http://www.peak6.com/email-disclaimer/ for terms and conditions related to this email