Re: Prepared statements generating a lot of temp files. - Mailing list pgsql-admin

From Karthik Krishnakumar
Subject Re: Prepared statements generating a lot of temp files.
Date
Msg-id 1870de3f764.b57db35951182.3515927566054675220@zohocorp.com
Whole thread Raw
In response to Re: Prepared statements generating a lot of temp files.  ("Michaeldba@sqlexec.com" <Michaeldba@sqlexec.com>)
Responses Re: Prepared statements generating a lot of temp files.  (MichaelDBA <MichaelDBA@sqlexec.com>)
List pgsql-admin
thanks - checked with the devs and it does look like the application is doing some sort of a bulk insert, and at the moment it cannot be changed to use "COPY FROM".
will limiting bulk inserts to match the work_mem(assuming this is the guc that is used in this case) reduce this disk activity?

thanks,
karthik




---- On Thu, 23 Mar 2023 14:43:19 +0530 <Michaeldba@sqlexec.com> wrote ---

Look at the size of the bind variables and also whether you are doing bulk inserts

Sent from my iPad

On Mar 23, 2023, at 5:10 AM, Karthik Krishnakumar <karthikk@zohocorp.com> wrote:


Hi admins,

I am analyzing temp files being generated using pg_badger.
Under "queries generating the most temporary files", I am finding insert/update queries (via prepared statements) writing a lot of data to temp files.
I am trying to figure why inserts are generating such temp files.
Why are inserts/updates generating temp files?
what can be done to avoid this ?

thanks,
karthik



pgsql-admin by date:

Previous
From: "Michaeldba@sqlexec.com"
Date:
Subject: Re: Prepared statements generating a lot of temp files.
Next
From: MichaelDBA
Date:
Subject: Re: Prepared statements generating a lot of temp files.