pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Prepared statements generating a lot of temp files.
8+ messages / 3 participants
[nested] [flat]

* Prepared statements generating a lot of temp files.
@ 2023-03-23 09:10 Karthik Krishnakumar <karthikk@zohocorp.com>
  2023-03-23 09:13 ` Re: Prepared statements generating a lot of temp files. Michaeldba@sqlexec.com <Michaeldba@sqlexec.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Karthik Krishnakumar @ 2023-03-23 09:10 UTC (permalink / raw)
  To: pgsql-admin <pgsql-admin@lists.postgresql.org>

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

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Prepared statements generating a lot of temp files.
  2023-03-23 09:10 Prepared statements generating a lot of temp files. Karthik Krishnakumar <karthikk@zohocorp.com>
@ 2023-03-23 09:13 ` Michaeldba@sqlexec.com <Michaeldba@sqlexec.com>
  2023-03-23 09:59   ` Re: Prepared statements generating a lot of temp files. Karthik Krishnakumar <karthikk@zohocorp.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Michaeldba@sqlexec.com @ 2023-03-23 09:13 UTC (permalink / raw)
  To: Karthik Krishnakumar <karthikk@zohocorp.com>; +Cc: pgsql-admin <pgsql-admin@lists.postgresql.org>

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
> 

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Prepared statements generating a lot of temp files.
  2023-03-23 09:10 Prepared statements generating a lot of temp files. Karthik Krishnakumar <karthikk@zohocorp.com>
  2023-03-23 09:13 ` Re: Prepared statements generating a lot of temp files. Michaeldba@sqlexec.com <Michaeldba@sqlexec.com>
@ 2023-03-23 09:59   ` Karthik Krishnakumar <karthikk@zohocorp.com>
  2023-03-23 10:03     ` Re: Prepared statements generating a lot of temp files. MichaelDBA <MichaelDBA@sqlexec.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Karthik Krishnakumar @ 2023-03-23 09:59 UTC (permalink / raw)
  To: Michaeldba <Michaeldba@sqlexec.com>; +Cc: pgsql-admin <pgsql-admin@lists.postgresql.org>

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 <mailto: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

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Prepared statements generating a lot of temp files.
  2023-03-23 09:10 Prepared statements generating a lot of temp files. Karthik Krishnakumar <karthikk@zohocorp.com>
  2023-03-23 09:13 ` Re: Prepared statements generating a lot of temp files. Michaeldba@sqlexec.com <Michaeldba@sqlexec.com>
  2023-03-23 09:59   ` Re: Prepared statements generating a lot of temp files. Karthik Krishnakumar <karthikk@zohocorp.com>
@ 2023-03-23 10:03     ` MichaelDBA <MichaelDBA@sqlexec.com>
  2023-03-23 10:21       ` Re: Prepared statements generating a lot of temp files. Karthik Krishnakumar <karthikk@zohocorp.com>
  0 siblings, 1 reply; 8+ messages in thread

From: MichaelDBA @ 2023-03-23 10:03 UTC (permalink / raw)
  To: Karthik Krishnakumar <karthikk@zohocorp.com>; +Cc: pgsql-admin <pgsql-admin@lists.postgresql.org>

Perhaps take the other approach: increase work_mem to make the bulk 
inserts fit into memory.  You can easily undo work_mem changes.  It only 
requires a sighup: reload, not restart.
What memory do you have now and what is work_mem currently set to? Also, 
have many concurrent, active connections do you average at a time?

Regards,
Michael Vitale



Karthik Krishnakumar wrote on 3/23/2023 5:59 AM:
> 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 <mailto: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
>
>
>


Regards,

Michael Vitale

Michaeldba@sqlexec.com <mailto:michaelvitale@sqlexec.com>

703-600-9343

Attachments:

  [image/jpeg] pgadvanced3.jpg (20.6K, ../../5fc7d12e-44cc-2f1d-a6a3-bd8c8ab045d6@sqlexec.com/3-pgadvanced3.jpg)
  download | view image

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Prepared statements generating a lot of temp files.
  2023-03-23 09:10 Prepared statements generating a lot of temp files. Karthik Krishnakumar <karthikk@zohocorp.com>
  2023-03-23 09:13 ` Re: Prepared statements generating a lot of temp files. Michaeldba@sqlexec.com <Michaeldba@sqlexec.com>
  2023-03-23 09:59   ` Re: Prepared statements generating a lot of temp files. Karthik Krishnakumar <karthikk@zohocorp.com>
  2023-03-23 10:03     ` Re: Prepared statements generating a lot of temp files. MichaelDBA <MichaelDBA@sqlexec.com>
@ 2023-03-23 10:21       ` Karthik Krishnakumar <karthikk@zohocorp.com>
  2023-03-23 10:26         ` Re: Prepared statements generating a lot of temp files. MichaelDBA <MichaelDBA@sqlexec.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Karthik Krishnakumar @ 2023-03-23 10:21 UTC (permalink / raw)
  To: MichaelDBA <MichaelDBA@sqlexec.com>; +Cc: pgsql-admin <pgsql-admin@lists.postgresql.org>

RAM - 256GB

shared_buffers - 64GB

maintenance_work_mem - 1GB

work_mem - 24MB

there are ~50 active connections at any given time. 



from pg_badger - average temp file size for bulk insert/update is about 200MB, max size is multiple GB's depending on the table. 



it is a write heavy workload - with inserts/updates happening around the clock.



thanks

karthik





---- On Thu, 23 Mar 2023 15:33:11 +0530 MichaelDBA <mailto:MichaelDBA@sqlexec.com> wrote ---



Perhaps take the other approach: increase 
work_mem to make the bulk inserts fit into memory.  You can easily undo 
work_mem changes.  It only requires a sighup: reload, not restart.

What memory do you have now and what is work_mem currently set to?  
Also, have many concurrent, active connections do you average at a time?



Regards,

Michael Vitale







Karthik Krishnakumar wrote on 3/23/2023 5:59 AM:










Regards,

Michael Vitale

mailto:michaelvitale@sqlexec.com

703-600-9343

  











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  mailto: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 <mailto: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

Attachments:

  [image/jpeg] 1.jpg (20.6K, ../../1870df88210.d2d0b80f51669.8368902571691259324@zohocorp.com/3-1.jpg)
  download | view image

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Prepared statements generating a lot of temp files.
  2023-03-23 09:10 Prepared statements generating a lot of temp files. Karthik Krishnakumar <karthikk@zohocorp.com>
  2023-03-23 09:13 ` Re: Prepared statements generating a lot of temp files. Michaeldba@sqlexec.com <Michaeldba@sqlexec.com>
  2023-03-23 09:59   ` Re: Prepared statements generating a lot of temp files. Karthik Krishnakumar <karthikk@zohocorp.com>
  2023-03-23 10:03     ` Re: Prepared statements generating a lot of temp files. MichaelDBA <MichaelDBA@sqlexec.com>
  2023-03-23 10:21       ` Re: Prepared statements generating a lot of temp files. Karthik Krishnakumar <karthikk@zohocorp.com>
@ 2023-03-23 10:26         ` MichaelDBA <MichaelDBA@sqlexec.com>
  2023-03-23 10:50           ` Re: Prepared statements generating a lot of temp files. Karthik Krishnakumar <karthikk@zohocorp.com>
  0 siblings, 1 reply; 8+ messages in thread

From: MichaelDBA @ 2023-03-23 10:26 UTC (permalink / raw)
  To: Karthik Krishnakumar <karthikk@zohocorp.com>; +Cc: pgsql-admin <pgsql-admin@lists.postgresql.org>

Looks like you can handle 256MB work_mem. Give it a shot and monitor 
temp_files.  You do have log_temp_files = 0, right?  Also, keep an eye 
out for "out of memory" log file errors.  What PG version are you using?

Karthik Krishnakumar wrote on 3/23/2023 6:21 AM:
> RAM - 256GB
> shared_buffers - 64GB
> maintenance_work_mem - 1GB
> work_mem - 24MB
> there are ~50 active connections at any given time.
>
> from pg_badger - average temp file size for bulk insert/update is 
> about 200MB, max size is multiple GB's depending on the table.
>
> it is a write heavy workload - with inserts/updates happening around 
> the clock.
>
> thanks
> karthik
>
>
> ---- On Thu, 23 Mar 2023 15:33:11 +0530 *MichaelDBA 
> <MichaelDBA@sqlexec.com <mailto:MichaelDBA@sqlexec.com>>* wrote ---
>
>     Perhaps take the other approach: increase work_mem to make the
>     bulk inserts fit into memory.  You can easily undo work_mem
>     changes.  It only requires a sighup: reload, not restart.
>     What memory do you have now and what is work_mem currently set to?
>     Also, have many concurrent, active connections do you average at a
>     time?
>
>     Regards,
>     Michael Vitale
>
>
>
>     Karthik Krishnakumar wrote on 3/23/2023 5:59 AM:
>
>
>
>
>     Regards,
>
>     Michael Vitale
>
>     Michaeldba@sqlexec.com <mailto:michaelvitale@sqlexec.com>
>
>     703-600-9343
>
>
>
>
>
>
>         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> <mailto: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 <mailto: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
>
>
>
>
>
>


Regards,

Michael Vitale

Michaeldba@sqlexec.com <mailto:michaelvitale@sqlexec.com>

703-600-9343

Attachments:

  [image/jpeg] image.jpg (28.6K, ../../149abb3b-09fb-fd3b-9ff0-bf9990b74b31@sqlexec.com/3-image.jpg)
  download | view image

  [image/jpeg] pgadvanced3.jpg (20.6K, ../../149abb3b-09fb-fd3b-9ff0-bf9990b74b31@sqlexec.com/4-pgadvanced3.jpg)
  download | view image

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Prepared statements generating a lot of temp files.
  2023-03-23 09:10 Prepared statements generating a lot of temp files. Karthik Krishnakumar <karthikk@zohocorp.com>
  2023-03-23 09:13 ` Re: Prepared statements generating a lot of temp files. Michaeldba@sqlexec.com <Michaeldba@sqlexec.com>
  2023-03-23 09:59   ` Re: Prepared statements generating a lot of temp files. Karthik Krishnakumar <karthikk@zohocorp.com>
  2023-03-23 10:03     ` Re: Prepared statements generating a lot of temp files. MichaelDBA <MichaelDBA@sqlexec.com>
  2023-03-23 10:21       ` Re: Prepared statements generating a lot of temp files. Karthik Krishnakumar <karthikk@zohocorp.com>
  2023-03-23 10:26         ` Re: Prepared statements generating a lot of temp files. MichaelDBA <MichaelDBA@sqlexec.com>
@ 2023-03-23 10:50           ` Karthik Krishnakumar <karthikk@zohocorp.com>
  2023-03-23 10:54             ` Re: Prepared statements generating a lot of temp files. MichaelDBA <MichaelDBA@sqlexec.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Karthik Krishnakumar @ 2023-03-23 10:50 UTC (permalink / raw)
  To: MichaelDBA <MichaelDBA@sqlexec.com>; +Cc: pgsql-admin <pgsql-admin@lists.postgresql.org>

thanks will check this. 

is there some formula you are using to arrive at this number for work_mem? 

we have queries that frequently have more than a dozen joins/aggregates. so have been conservative in changing work_mem... 

btw, using pg version 10, (i know its old and am trying to convince folks to upgrade :) 



thanks

karthik





---- On Thu, 23 Mar 2023 15:56:36 +0530 MichaelDBA <mailto:MichaelDBA@sqlexec.com> wrote ---



Looks like you can handle 256MB work_mem.  
Give it a shot and monitor temp_files.  You do have log_temp_files = 0, 
right?  Also, keep an eye out for "out of memory" log file errors.  What
 PG version are you using?
 
 Karthik Krishnakumar wrote on 3/23/2023 6:21 AM:
 




Regards,

Michael Vitale

mailto:michaelvitale@sqlexec.com

703-600-9343

  

 
 

RAM - 
256GB

shared_buffers - 64GB

maintenance_work_mem
 - 1GB

work_mem - 24MB

there are ~50 active 
connections at any given time. 



from 
pg_badger - average temp file size for bulk insert/update is about 
200MB, max size is multiple GB's depending on the table. 



it
 is a write heavy workload - with inserts/updates happening around the 
clock.



thanks

karthik





---- 
On Thu, 23 Mar 2023 15:33:11 +0530 MichaelDBA <mailto:MichaelDBA@sqlexec.com> wrote ---



Perhaps 
take the other approach: increase 
work_mem to make the bulk inserts fit into memory.  You can easily undo 
work_mem changes.  It only requires a sighup: reload, not restart.

What
 memory do you have now and what is work_mem currently set to?  
Also, have many concurrent, active connections do you average at a time?



Regards,

Michael
 Vitale







Karthik
 Krishnakumar wrote on 3/23/2023 5:59 AM:










Regards,

Michael Vitale

mailto:michaelvitale@sqlexec.com

703-600-9343

  











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  mailto: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 <mailto: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

Attachments:

  [image/jpeg] 1.jpg (20.6K, ../../1870e133a02.b7332a6352205.2292083279467439134@zohocorp.com/3-1.jpg)
  download | view image

  [image/jpeg] 2.jpg (28.6K, ../../1870e133a02.b7332a6352205.2292083279467439134@zohocorp.com/4-2.jpg)
  download | view image

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Prepared statements generating a lot of temp files.
  2023-03-23 09:10 Prepared statements generating a lot of temp files. Karthik Krishnakumar <karthikk@zohocorp.com>
  2023-03-23 09:13 ` Re: Prepared statements generating a lot of temp files. Michaeldba@sqlexec.com <Michaeldba@sqlexec.com>
  2023-03-23 09:59   ` Re: Prepared statements generating a lot of temp files. Karthik Krishnakumar <karthikk@zohocorp.com>
  2023-03-23 10:03     ` Re: Prepared statements generating a lot of temp files. MichaelDBA <MichaelDBA@sqlexec.com>
  2023-03-23 10:21       ` Re: Prepared statements generating a lot of temp files. Karthik Krishnakumar <karthikk@zohocorp.com>
  2023-03-23 10:26         ` Re: Prepared statements generating a lot of temp files. MichaelDBA <MichaelDBA@sqlexec.com>
  2023-03-23 10:50           ` Re: Prepared statements generating a lot of temp files. Karthik Krishnakumar <karthikk@zohocorp.com>
@ 2023-03-23 10:54             ` MichaelDBA <MichaelDBA@sqlexec.com>
  0 siblings, 0 replies; 8+ messages in thread

From: MichaelDBA @ 2023-03-23 10:54 UTC (permalink / raw)
  To: Karthik Krishnakumar <karthikk@zohocorp.com>; +Cc: pgsql-admin <pgsql-admin@lists.postgresql.org>

What percentage of the active, concurrent connections are doing the 
complex queries vs the inserts?  If it's only a few (2-3) then I still 
think you are OK with 256MB work_mem.  You could at least increase it to 
128MB to see if that has any significant impact.

Regards,
Michael Vitale



Karthik Krishnakumar wrote on 3/23/2023 6:50 AM:
> thanks will check this.
> is there some formula you are using to arrive at this number for 
> work_mem?
> we have queries that frequently have more than a dozen 
> joins/aggregates. so have been conservative in changing work_mem...
> btw, using pg version 10, (i know its old and am trying to convince 
> folks to upgrade :)
>
> thanks
> karthik
>
>
> ---- On Thu, 23 Mar 2023 15:56:36 +0530 *MichaelDBA 
> <MichaelDBA@sqlexec.com <mailto:MichaelDBA@sqlexec.com>>* wrote ---
>
>     Looks like you can handle 256MB work_mem. Give it a shot and
>     monitor temp_files.  You do have log_temp_files = 0, right?  Also,
>     keep an eye out for "out of memory" log file errors.  What PG
>     version are you using?
>
>     Karthik Krishnakumar wrote on 3/23/2023 6:21 AM:
>
>
>
>     Regards,
>
>     Michael Vitale
>
>     Michaeldba@sqlexec.com <mailto:michaelvitale@sqlexec.com>
>
>     703-600-9343
>
>
>
>
>         RAM - 256GB
>         shared_buffers - 64GB
>         maintenance_work_mem - 1GB
>         work_mem - 24MB
>         there are ~50 active connections at any given time.
>
>         from pg_badger - average temp file size for bulk insert/update
>         is about 200MB, max size is multiple GB's depending on the table.
>
>         it is a write heavy workload - with inserts/updates happening
>         around the clock.
>
>         thanks
>         karthik
>
>
>         ---- On Thu, 23 Mar 2023 15:33:11 +0530 *MichaelDBA
>         <MichaelDBA@sqlexec.com <mailto:MichaelDBA@sqlexec.com>>*
>         wrote ---
>
>             Perhaps take the other approach: increase work_mem to make
>             the bulk inserts fit into memory.  You can easily undo
>             work_mem changes.  It only requires a sighup: reload, not
>             restart.
>             What memory do you have now and what is work_mem currently
>             set to? Also, have many concurrent, active connections do
>             you average at a time?
>
>             Regards,
>             Michael Vitale
>
>
>
>             Karthik Krishnakumar wrote on 3/23/2023 5:59 AM:
>
>
>
>
>             Regards,
>
>             Michael Vitale
>
>             Michaeldba@sqlexec.com <mailto:michaelvitale@sqlexec.com>
>
>             703-600-9343
>
>
>
>
>
>
>                 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>
>                 <mailto: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
>                         <mailto: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
>
>
>
>
>
>
>
>
>
>


Regards,

Michael Vitale

Michaeldba@sqlexec.com <mailto:michaelvitale@sqlexec.com>

703-600-9343

Attachments:

  [image/jpeg] image.jpg (28.6K, ../../b5284ce8-d37c-da55-d8d3-cd0188ac76e4@sqlexec.com/3-image.jpg)
  download | view image

  [image/jpeg] image.jpg (28.7K, ../../b5284ce8-d37c-da55-d8d3-cd0188ac76e4@sqlexec.com/4-image.jpg)
  download | view image

  [image/jpeg] pgadvanced3.jpg (20.6K, ../../b5284ce8-d37c-da55-d8d3-cd0188ac76e4@sqlexec.com/5-pgadvanced3.jpg)
  download | view image

^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2023-03-23 10:54 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23 09:10 Prepared statements generating a lot of temp files. Karthik Krishnakumar <karthikk@zohocorp.com>
2023-03-23 09:13 ` Michaeldba@sqlexec.com <Michaeldba@sqlexec.com>
2023-03-23 09:59   ` Karthik Krishnakumar <karthikk@zohocorp.com>
2023-03-23 10:03     ` MichaelDBA <MichaelDBA@sqlexec.com>
2023-03-23 10:21       ` Karthik Krishnakumar <karthikk@zohocorp.com>
2023-03-23 10:26         ` MichaelDBA <MichaelDBA@sqlexec.com>
2023-03-23 10:50           ` Karthik Krishnakumar <karthikk@zohocorp.com>
2023-03-23 10:54             ` MichaelDBA <MichaelDBA@sqlexec.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox