Re: SQL Query never ending...

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SQL Query never ending...
Дата
Msg-id 2311.1529615287@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: SQL Query never ending...  (DiasCosta <diascosta@diascosta.org>)
Ответы Re: SQL Query never ending...
Список pgsql-general
DiasCosta <diascosta@diascosta.org> writes:
> This is the query plan for only 19684 rows.

I think you're getting a bad query plan, mostly as a result of two
factors:

* Poor row estimates.  It looks like the bottom-most misestimations
are on temp tables, which makes me wonder whether you've ANALYZEd
those tables.  Your application has to do that explicitly after
populating the tables; auto-analyze can't help on temp tables.

* Too many tables --- I count 33 table scans in this query.  You
might get better planning results by raising join_collapse_limit
and/or from_collapse_limit, but it will come at a cost in planning
time, and in any case a query with this many tables is never likely
to be cheap.  You might want to think about restructuring your schema
to not need so many tables, or maybe just do some hand optimization
of the query to eliminate unnecessary joins.  (It looks to me like
at least some of the joins to tt_eotb1 might be unnecessary?)

            regards, tom lane


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

Предыдущее
От: DiasCosta
Дата:
Сообщение: Re: SQL Query never ending...
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: pgp_sym_decrypt() - error 39000: wrong key or corrupt data