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 1iO1x8-0007mU-UB for pgsql-general@arkaria.postgresql.org; Fri, 25 Oct 2019 15:56:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iO1x7-0008Ag-KG for pgsql-general@arkaria.postgresql.org; Fri, 25 Oct 2019 15:56:37 +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 1iO1x7-0008AZ-1u for pgsql-general@lists.postgresql.org; Fri, 25 Oct 2019 15:56:37 +0000 Received: from smtp59.i.mail.ru ([217.69.128.39]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iO1x3-0004py-A7 for pgsql-general@postgresql.org; Fri, 25 Oct 2019 15:56:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject; bh=KyILTWruOT4eNZayArrYbxBO6iws/eke7B3cRKzFifw=; b=t/BYP+d9DUHm9TSm1sj1qsqwGhkrUpPO/esEAunjzn4QmlW//URVj96fXmCaCiCy2GI8zfenMzVwD1tqnGUR7rIQvhmDRaaAbx04bX8Rlojk2+n3VW6rDu31dliWdpiR20h1aKoHqu+d/5G3F6uUb1212k2iiYbhqOg/SkMwRt0=; Received: by smtp59.i.mail.ru with esmtpa (envelope-from ) id 1iO1wz-0001r7-AQ; Fri, 25 Oct 2019 18:56:29 +0300 Subject: Re: Quere keep using temporary files To: Tom Lane Cc: pgsql-general General References: <2c38ebb8-977e-926b-4842-5cf31c4059b2@mail.ru> <16916.1572011385@sss.pgh.pa.us> From: rihad Message-ID: <9a4aa120-0e0c-d546-e939-a99dc47b2a79@mail.ru> Date: Fri, 25 Oct 2019 19:56:26 +0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <16916.1572011385@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Authentication-Results: smtp59.i.mail.ru; auth=pass smtp.auth=rihad@mail.ru smtp.mailfrom=rihad@mail.ru X-77F55803: 3FFC80838138E3AB5A78504BD2AC29412C1082D206BF4C2F329C9E3851EC3EB6D4A0599953EF99FED2D92A8B33759D42 X-7FA49CB5: 0D63561A33F958A5AABE882AF04AD4A36CCC84D4D44746272628AAC2158644B58941B15DA834481FA18204E546F3947CB861051D4BA689FCF6B57BC7E64490618DEB871D839B7333395957E7521B51C2545D4CF71C94A83E9FA2833FD35BB23D27C277FBC8AE2E8B3A703B70628EAD7BA471835C12D1D977C4224003CC8364767815B9869FA544D8D32BA5DBAC0009BE9E8FC8737B5C2249B7057B79CCFA8C9476E601842F6C81A12EF20D2F80756B5F5C318D1F9ECD513A76E601842F6C81A127C277FBC8AE2E8B01FEF4FB8CE539283AA81AA40904B5D99449624AB7ADAF37F910319684D6E05D725E5C173C3A84C361DD96311B40C2D43B5059311101228235872C767BF85DA2F004C906525384306FED454B719173D6462275124DF8B9C99B0B8D173C204012BD9CCCA9EDD067B1EDA766A37F9254B7 X-Mailru-Sender: B19AB4DAF1EA2FB56244BF8B8428E8F36789AEAF6651D0F0CD0B1F99F1023F403607383EE86143FC108F17C94788D7333DDE9B364B0DF2891F953FB4A677E77772D6B4FCE48DF648AE208404248635DF X-Mras: OK List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 10/25/2019 05:49 PM, Tom Lane wrote: > 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:  temporary file: path "base/pgsql_tmp/pgsql_tmp92452.1079", size 166518 >> STATEMENT:  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 > . > 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?