Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hxnvu-0001wc-F6 for pgsql-general@arkaria.postgresql.org; Wed, 14 Aug 2019 07:42:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hxnvt-0002Lb-0h for pgsql-general@arkaria.postgresql.org; Wed, 14 Aug 2019 07:42:57 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1hxnvs-0002LU-Mj for pgsql-general@lists.postgresql.org; Wed, 14 Aug 2019 07:42:56 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hxnvq-0006r7-C2 for pgsql-general@postgresql.org; Wed, 14 Aug 2019 07:42:56 +0000 Received: by mail-wm1-x333.google.com with SMTP id g67so3560884wme.1 for ; Wed, 14 Aug 2019 00:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=D6PpU8Aiemvn45kzDB68Re1FrVad23XgJG8cwSDsmww=; b=EbOez5TU5aGrrAgmM8/U+UR7oL8BWr8YQXFJUv3JmYi2MV8WJFNzw+fzwQcv9Evf9g E5gQYZ1OJaMlsjtgV+Ibo9FMKei2fGtFoSYCPtQSbDNkO+Y/OtDirK0jDKEbrd8dtDCg k98I3knjwK4f9NzUVJ+eirg/ti0Eq8ENmgQptxaq98kQrDj82riGgN3vxVSYCaf5+hsb Nk8j2qNGoYxEIbVXsVdZtH6FfAHvPVLUMwpWVeoEwRlcCSXtoAU325GqQ8vr9MZLfplm fetHDhEqxio/M0vi7rzVMhvsEH6YbqI1iLOwzf90ymmNMamkX6Lxt7D4HvWbGfYSFLtN uLkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=D6PpU8Aiemvn45kzDB68Re1FrVad23XgJG8cwSDsmww=; b=nOQzfYtOe+O5YCmRCynAi4VWwwpp3HISrLYfsWUwjkJYiL3XuHDuxnYDmasf+N5D+C iSGzqJNURi2YTk5RPkiMAhmE7wCkHzNv0GrbTQIhsFmcqIHJzb3SMWUb0taAKiwnjAsA y0cPUzwhCDSVvd4VWeFLM4wR0vjLzzCinSZ54v1H8lUkmRgZEEku7idIDqQ1NkQOB3NU o9fuaKTdhY8EuIjCqHTnVrkmqFBQrsc4eRQr4KeTpzsHvJU0TaPE0IiALxWwb7WoRRqQ ajqhbUAOCoKr5hmnX08kuN/NIt93NXnFsguEueP5HiPK5L2VEoUIj/HBo9ZB/jWc6cJf BYyQ== X-Gm-Message-State: APjAAAWXhFebz8S1UAHyU/oVrtpxWamCKlo6yKFfLkEtpmgVwrzINTUs sZ5BaJTyRenNFsC8Wy3tdsGdvg== X-Google-Smtp-Source: APXvYqyhsbdSoIZqMPwLQJMsle9gkHDhxYNdx8q6VlQzY/PXFgWpFLVXYhVf8xevB52bCS2LieiY2g== X-Received: by 2002:a1c:544e:: with SMTP id p14mr6624166wmi.4.1565768570296; Wed, 14 Aug 2019 00:42:50 -0700 (PDT) Received: from localhost.localdomain (217-149-169-215.nat.highway.telekom.at. [217.149.169.215]) by smtp.gmail.com with ESMTPSA id f23sm2801688wmj.37.2019.08.14.00.42.49 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 00:42:49 -0700 (PDT) Message-ID: <46a5322e766fddb15cae66b4ec852289379ef75e.camel@cybertec.at> Subject: Re: Changing work_mem From: Laurenz Albe To: rihad , Luca Ferrari Cc: Peter Eisentraut , pgsql-general General Date: Wed, 14 Aug 2019 09:42:48 +0200 In-Reply-To: References: <2cbec921-a0c2-016f-1831-82dd45106af3@mail.ru> <6d170b3b-17b7-8e02-bbf6-2a6885b317eb@mail.ru> <50c20aea-6f63-2cf7-1760-bb28679ff3e7@mail.ru> <9c6b069a-c99b-4b65-92fa-59404012e576@mail.ru> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk rihad wrote: > > Sorry, I just decreased work_mem back to 256MB, reloaded, and > > instantly started seeing 82mb temp file creation, not 165mb as was > > usual with work_mem=512MB. > > > > So it indeed was applied immediately. > > Really weird figures ) > > Increased work_mem to 768MB and start seeing temp file creation log > entries 331MB in size. > > Bizzare ) It looks like the bigger it gets, the bigger temp files > are > created. > > Why not decrease it to 64mb then... Temporary files are created whenever the data is estimated to not fit into "work_mem". So it is unsurprising that you see bigger temporary files being created if you increase "work_mem". Big temporary files will also be created when "work_mem" is small, but maybe they got lost in the noise of the smaller files. You should have noticed that fewer files are created when you increase "work_mem". Another thing to notice is that the temporary files use another, more compact format than the data in memory, so you need to increase "work_mem" to more than X if you want to avoid temporary files of size X. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com