Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p6w2R-0001RE-Ph for pgsql-performance@arkaria.postgresql.org; Sun, 18 Dec 2022 15:57:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p6w2O-0005LO-W9 for pgsql-performance@arkaria.postgresql.org; Sun, 18 Dec 2022 15:57:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p6w2O-0005IQ-Ir for pgsql-performance@lists.postgresql.org; Sun, 18 Dec 2022 15:57:16 +0000 Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p6w2L-0004Ii-1x for pgsql-performance@lists.postgresql.org; Sun, 18 Dec 2022 15:57:14 +0000 Received: by mail-io1-xd33.google.com with SMTP id v2so3594936ioe.4 for ; Sun, 18 Dec 2022 07:57:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=dTvSa0zVLRf1aYsotJCnNWKTlpsTc5bq87fT9WOSFoM=; b=YZ6men7D9Cet74D28D2xSDWd0cnH8jd+byggX4l3Trz6WemiBVaW8AGvo6AHYuzOxI KgS7C+wAM0UHIdomNKYf4RGYXgaDRNcjgysAdW/clSS8q+evrk9v4EW7HAOfkt3Hyr1D Fe/sThTIJx5SRfNHn9HFfeKnoOcngBXZy5Gq0zWpWHorHdNKGTALCYTTlzIhyrAoytA8 FuGPtj2I2OkqXPt93Qz8UTbhWW8t4JLIoKCnLxTKwuwEWxfmrznIRBwzuZ4ykRt+rNY+ ZdSs5QeezIYEWxqXwdLPSws7sAZD3U2uCGWZyjeKSdPYByUYJeuLlr2naZ0zJNPmoCzx YrHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dTvSa0zVLRf1aYsotJCnNWKTlpsTc5bq87fT9WOSFoM=; b=UURxNh39Uk53UmbdSNbS3eFiPipdpuXmGMhAV+770pttLQ9pNzb0/yA3dfMYqpjE6x 0NLoPyYLJDMlHDSR5BppuXvqoEwqjmrYbFGEDn4sm/1R09Av1Cln/YiZSuO7Pdp+NSWr /Hu19mKuKYnwumBBeGQ2LrZO3i17SPmJhide0FTSPtcVWryCR3ZMK8CYGfVzRnEd3avT X/ADNSdaT2t0WZoIwVeujbyUgCJvtRk6pIpRYGsrp2yBdIR9w8yxIQAxa5zECmjYAhB0 Z5gKNl6ke03uOGTka1z3Icg6NCZB0OUWG9F6LY/fCR11ki7PksHuSmdp8oS7W1++UEms BiAA== X-Gm-Message-State: ANoB5pn98km3rkhyQ/+k6TbplRu8sacyPZoiOs0gJ6w00hXx0AMeDdwO 7djgrcpVQ0cnRp+KVn1fhzmoNQ== X-Google-Smtp-Source: AA0mqf5m2rcOF31YePssFVyfnEihDIUpuCGe3A0KXAzNh3sNMFT/FYUUCo7hHehjuEw+XXlLWQnTkw== X-Received: by 2002:a05:6602:2083:b0:6bc:d712:c30f with SMTP id a3-20020a056602208300b006bcd712c30fmr20879479ioa.6.1671379031958; Sun, 18 Dec 2022 07:57:11 -0800 (PST) Received: from pryzbyj.telsasoft ([50.244.222.1]) by smtp.gmail.com with ESMTPSA id n28-20020a056638111c00b00385f2a30781sm2543975jal.72.2022.12.18.07.57.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Dec 2022 07:57:11 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 9F717800A36; Sun, 18 Dec 2022 09:57:05 -0600 (CST) Date: Sun, 18 Dec 2022 09:57:05 -0600 From: Justin Pryzby To: Frits Jalvingh Cc: pgsql-performance@lists.postgresql.org Subject: Re: temp_file_limit? Message-ID: <20221218155705.GT1153@telsasoft.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Dec 18, 2022 at 12:48:03PM +0100, Frits Jalvingh wrote: > Hi list, > > I have a misbehaving query which uses all available disk space and then > terminates with a "cannot write block" error. To prevent other processes > from running into trouble I've set the following: > > temp_file_limit = 100GB > The comment in the file states that this is a per-session parameter, so > what is going wrong here? Do you mean the comment in postgresql.conf ? commit d1f822e58 changed to say that temp_file_limit is actually per-process and not per-session. Could you send the query plan, preferably "explain analyze" (if the query finishes sometimes) ? log_temp_files may be helpful here. > The query does parallelize and uses one parallel worker while executing, > but it does not abort when the temp file limit is reached: > > 345G pgsql_tmp > > It does abort way later, after using around 300+ GB: > [53400] ERROR: temporary file size exceeds temp_file_limit (104857600kB) > Where: parallel worker Are you sure the 345G are from only one instance of the query ? Or is it running multiple times, or along with other queries writing 100GB of tempfiles. It seems possible that it sometimes runs with more than one parallel worker. Also, are there old/stray tempfiles there which need to be cleaned up? -- Justin