Subject: Re: Insert query performance

From: Muhammad Ikram <[email-masked]>
Date: Mon, 19 Aug 2024 12:55:32 +0500

Hi Sud,

Please make following change in your postgresql.conf file

log_statement = 'all'

Regards,
Ikram

On Mon, Aug 19, 2024 at 12:48 PM sud <[email-masked]> wrote:

> Hello All,
>
> In a version 15.4 postgres database, Is it possible that , if we have two
> big range partition tables with foreign key relationships between them,
> insert into the child table can cause slowness if we don't have foreign key
> index present in the child table? Basically it need to make sure the new
> row already added to parent partition table or not.
>
>
> And if there is any possible way(example query tracing etc) to get the
> underlying system queries which gets triggered as part of the main insert
> query? For example in above scenario, postgres must be executing some query
> to check if the incoming  row to the child table already exists in the
> parent table or not?
>
>
> Regards
>
> Sud
>

-- 
Muhammad Ikram

---

From: sud <[email-masked]>
Date: Tue, 20 Aug 2024 12:49:12 +0530

> Please make following change in your postgresql.conf file
Will this put all the internal sql query or the recursive query entries in
the pg_stats_statement view which we can analyze then? And also to debug
issues in the production will it be a good idea to set it for a few times
and then turn it off or it can have significant performance overhead.

---

From: Muhammad Ikram <[email-masked]>
Date: Tue, 20 Aug 2024 15:59:13 +0500

It will record all statements in logs. If you are concerned about query
times then you may use pg_stat_statements.

Muhammad Ikram