From: | Satalabaha Postgres <satalabaha(dot)postgres(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-performance(at)lists(dot)postgresql(dot)org |
Subject: | Re: Weird behavior of INSERT QUERY |
Date: | 2023-06-04 14:58:18 |
Message-ID: | CAJ_W8nZNq+bWEAe10VjDRm0n6AM3hQsFZu1D4AULzg9_RND1cA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Regards,
Satalabha
On Sun, 4 Jun 2023 at 18:56, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Satalabaha Postgres <satalabaha(dot)postgres(at)gmail(dot)com> writes:
> > The select query in the insert returns about 499 rows. However, this
> insert
> > statement when executed from application user i.e. schema1_u takes close
> to
> > 8 minutes. When the same insert statement gets executed as postgres
> user
> > it takes less than 280 ms. Both the executions use the same execution
> plan
> > with only difference that when schema1_u executes the SQL, we observe
> > "Trigger for constraint fk_con_tablea: time=426499.314 calls=499" taking
> > more time.
>
> So you need to find out what's happening in the trigger. Perhaps
> auto_explain with auto_explain.log_nested_statements enabled
> would give some insight.
>
> I suspect there might be a permissions problem causing schema1_u
> to not be allowed to "see" the statistics for table_b, resulting
> in a bad plan choice for the FK enforcement query; but that's
> just a guess.
>
> regards, tom lane
>
Hi Tom,
We did enable auto_explain and auto_explain.log_nested_statements and apart
from the insert statement we couldn't find any other SQL's causing that was
taking more time.
Regards, Satalabaha.
From | Date | Subject | |
---|---|---|---|
Next Message | Ranier Vilela | 2023-06-04 23:05:44 | Re: Weird behavior of INSERT QUERY |
Previous Message | Satalabaha Postgres | 2023-06-04 14:49:37 | Re: Weird behavior of INSERT QUERY |