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 1iNzyW-0002w3-6I for pgsql-general@arkaria.postgresql.org; Fri, 25 Oct 2019 13:49:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iNzyT-0008Ah-TC for pgsql-general@arkaria.postgresql.org; Fri, 25 Oct 2019 13:49:53 +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 1iNzyT-0008AZ-J2 for pgsql-general@lists.postgresql.org; Fri, 25 Oct 2019 13:49:53 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iNzyR-0005uw-F3 for pgsql-general@postgresql.org; Fri, 25 Oct 2019 13:49:53 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x9PDnjT1016917; Fri, 25 Oct 2019 09:49:45 -0400 From: Tom Lane To: rihad cc: pgsql-general General Subject: Re: Quere keep using temporary files In-reply-to: <2c38ebb8-977e-926b-4842-5cf31c4059b2@mail.ru> References: <2c38ebb8-977e-926b-4842-5cf31c4059b2@mail.ru> Comments: In-reply-to rihad message dated "Fri, 25 Oct 2019 12:22:58 +0400" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <16915.1572011385.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 25 Oct 2019 09:49:45 -0400 Message-ID: <16916.1572011385@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk rihad writes: > Hi, we frequently run many query involving XML that use a smallish = > temporary file, despite having increased local work_mem in that = > transaction to 16GB. FreeBSD's top shows that the memory isn't actually = > being used - it remains free. Basically many such queries are run within= = > a single transaction: > LOG:=C2=A0 temporary file: path "base/pgsql_tmp/pgsql_tmp92452.1079", si= ze 166518 > STATEMENT:=C2=A0 DELETE FROM "foo" WHERE ((col1, col2, col3) in (select = col1, = > col2, col3 from foo_xml_v2(''))) AND = > "foo"."col_id" IN ($1, $2, $3, $4, $5, $6, $7, $8, $9) > It looks like increasing work_mem doesn't help. Surely 16GB is enough to= = > cover all these small temp files? You'd need to provide a lot more detail about what that query is doing for anyone to be able to guess where the temp file usage is coming from. regards, tom lane