Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sVvFQ-00CKc3-Kg for pgsql-admin@arkaria.postgresql.org; Mon, 22 Jul 2024 15:46:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sVvFO-003chB-Gn for pgsql-admin@arkaria.postgresql.org; Mon, 22 Jul 2024 15:46:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sVvFN-003ch2-VN for pgsql-admin@lists.postgresql.org; Mon, 22 Jul 2024 15:46:46 +0000 Received: from mailout.easymail.ca ([64.68.200.34]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sVvFL-000syT-K8 for pgsql-admin@lists.postgresql.org; Mon, 22 Jul 2024 15:46:45 +0000 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 11549E1529; Mon, 22 Jul 2024 15:46:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=elevated-dev.com; s=easymail; t=1721663201; bh=74MhDApr17s4K2PDJuZSavUbU1+hb1TTNn5C0K3tn48=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=QdwV4Ddny2Hmzo/80Ofall1n3eSCd2B5KqXj/7WBzXxd+rFm1dH4kMlTW+I23fHze umwPJpf9BkaoVNF/CqqZQZFrVV7eKXBhAe5eaPOKx+7qfeMqfcizdYENOxZXxXYJ9X LjF0YQLIT+Sep9qmRhIWNZkqoSCsT2h9LK/oXbCl4H6aVVDSoapBgdE5gSzj38RiLe yjcyKJSdGR0vHD3eubKm93U3FsvuAoq66FwzMrgKWhr97TuAfLfd1xlor+lvfYa+RC BwrM9ir7djhuL8forGsBMjHzjXfHShBQpEw7l6iLpRh2lxIxQL9fSuQmrfO//bh6Vf YaHTwirxNbq0w== X-Virus-Scanned: Debian amavisd-new at emo08-pco.easydns.vpn Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo08-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WVGodyYnv-a0; Mon, 22 Jul 2024 15:46:40 +0000 (UTC) Received: from smtpclient.apple (unknown [165.140.184.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id 667BBE151B; Mon, 22 Jul 2024 15:46:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=elevated-dev.com; s=easymail; t=1721663200; bh=74MhDApr17s4K2PDJuZSavUbU1+hb1TTNn5C0K3tn48=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=mQkX0oodjYn5BaCLU0MTvYUn/B35MbWvfbk0wX+R8yyr9yZCVdb9BcjX9uPd+B9LE 5BMMHJk06ZrfzEtKHjPp8sAcThjEleZ0HTmDrxcXZF4GAeUcON2tH+Ilz8IHbYiSvX uKx8wifWa2egV1oVCjEflwTUjYP3WVIoFF0exWd1lYs0msIrINdqUOsrNKbyP7WV+J LVcsJTELPML8Uy7WfoZlRiuPJDpJUDNp7DMc6Llj0D9JHZ83Nfjw0s8YC3qc9zcxtW odxfthZI5VyC4XWVmn9Bn5qg7yC78LhHRv2Eqp+N9t6WphwBm+hbWQAj93u8owLQVm ZnCC0K/NLqrDw== Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) Subject: Re: small temp files From: Scott Ribe In-Reply-To: <870800.1721660046@sss.pgh.pa.us> Date: Mon, 22 Jul 2024 09:46:29 -0600 Cc: Paul Smith* , "David G. Johnston" , pgsql-admin@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <16C7116A-2CB2-4909-8830-2FA16470EE27@elevated-dev.com> References: <7A0C9A69-5632-4CFC-B156-53FAAAB33E26@elevated-dev.com> <8E03B792-C389-456D-913D-4F2B0EBB903E@elevated-dev.com> <6C269096-47A8-4F23-87AC-512656D4A084@elevated-dev.com> <870800.1721660046@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.3774.600.62) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Jul 22, 2024, at 8:54=E2=80=AFAM, Tom Lane = wrote: >=20 > You would get more specific answers if you provided an example of the > queries that cause this, with EXPLAIN ANALYZE output. But I think a > likely bet is that it's doing a hash join that overruns work_mem. > What will happen is that the join gets divided into batches based on > hash codes, and each batch gets dumped into its own temp files (one > per batch for each side of the join). It would not be too surprising > if some of the batches are small, thanks to the vagaries of hash > values. Certainly they could be less than work_mem, since the only > thing we can say for sure is that the sum of the temp file sizes for > the inner side of the join should exceed work_mem. OK, that makes total sense, and fits our usage patterns. (Lots of = complex queries, lots of hash joins.) thanks