Re: Weird behavior of INSERT QUERY

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Weird behavior of INSERT QUERY
Дата
Msg-id 3726928.1685885204@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Weird behavior of INSERT QUERY  (Satalabaha Postgres <satalabaha.postgres@gmail.com>)
Ответы Re: Weird behavior of INSERT QUERY  (Satalabaha Postgres <satalabaha.postgres@gmail.com>)
Список pgsql-performance
Satalabaha Postgres <satalabaha.postgres@gmail.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



В списке pgsql-performance по дате отправления:

Предыдущее
От: Julien Rouhaud
Дата:
Сообщение: Re: Weird behavior of INSERT QUERY
Следующее
От: Ranier Vilela
Дата:
Сообщение: Re: Weird behavior of INSERT QUERY