Re: Never Ending query in PostgreSQL

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: Never Ending query in PostgreSQL
Дата
Msg-id CAMkU=1wy1ipWWLYKCDgZBU-+956Av8v_St=Nomk5sK59W=159g@mail.gmail.com
обсуждение исходный текст
Ответ на Never Ending query in PostgreSQL  ("Kumar, Mukesh" <MKumar@peabodyenergy.com>)
Ответы Re: Never Ending query in PostgreSQL  (Mladen Gogala <gogala.mladen@gmail.com>)
Re: Never Ending query in PostgreSQL  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
Список pgsql-performance

On Sun, Feb 27, 2022 at 7:09 AM Kumar, Mukesh <MKumar@peabodyenergy.com> wrote:
Hi Team, 

Can you please help in tunning the attached query as , i am trying to run this query and it runs for several hours and it did not give any output.

Several hours is not all that long.  Without an EXPLAIN ANALYZE, we could easily spend several hours scratching our heads and still get nowhere.  So unless having this running cripples the rest of your system, please queue up another one and let it go longer.  But first, do an ANALYZE (and preferably a VACUUM ANALYZE) on all the tables.  If you have a test db which is a recent clone of production, you could do it there so as not to slow down production.  The problem is that the row estimates must be way off (otherwise, it shouldn't take long) and if that is the case, we can't use the plan to decide much of anything, since we don't trust it.

In parallel you could start evicting table joins from the query to simplify it until it gets to the point where it will run, so you can then see the actual row counts.  To do that it does help if you know what the intent of the query is (or for that matter, the text of the query--you attached the plan twice).

Cheers,

Jeff

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

Предыдущее
От: Julien Rouhaud
Дата:
Сообщение: Re: Never Ending query in PostgreSQL
Следующее
От: Jeff Janes
Дата:
Сообщение: Re: slow query to improve performace