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 1iO3T9-00034o-NZ for pgsql-general@arkaria.postgresql.org; Fri, 25 Oct 2019 17:33:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iO3T8-0007J2-Df for pgsql-general@arkaria.postgresql.org; Fri, 25 Oct 2019 17:33:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iO3T8-0007Ip-0F for pgsql-general@lists.postgresql.org; Fri, 25 Oct 2019 17:33:46 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iO3T5-0005cl-P3 for pgsql-general@postgresql.org; Fri, 25 Oct 2019 17:33:44 +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 x9PHXcmq028143; Fri, 25 Oct 2019 13:33:38 -0400 From: Tom Lane To: rihad cc: pgsql-general General Subject: Re: Quere keep using temporary files In-reply-to: <9a4aa120-0e0c-d546-e939-a99dc47b2a79@mail.ru> References: <2c38ebb8-977e-926b-4842-5cf31c4059b2@mail.ru> <16916.1572011385@sss.pgh.pa.us> <9a4aa120-0e0c-d546-e939-a99dc47b2a79@mail.ru> Comments: In-reply-to rihad message dated "Fri, 25 Oct 2019 19:56:26 +0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <28141.1572024818.1@sss.pgh.pa.us> Date: Fri, 25 Oct 2019 13:33:38 -0400 Message-ID: <28142.1572024818@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk rihad writes: > On 10/25/2019 05:49 PM, Tom Lane wrote: >> 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. > I just checked and saw that the function "foo_xml_v2" above returns > table. Is this enough to trigger temporary file usage regardless of > work_mem? No --- that would result in creation of a tuplestore to hold the function result, but it shouldn't spill to disk until it exceeds work_mem ... or at least so I'd expect. Can you extract a self-contained case that creates a small temp file? regards, tom lane