Re: BUG #17330: EXPLAIN hangs and very long query plans

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #17330: EXPLAIN hangs and very long query plans
Дата
Msg-id 70745.1639154362@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #17330: EXPLAIN hangs and very long query plans  (Strahinja Kustudić <strahinjak@nordeus.com>)
Ответы Re: BUG #17330: EXPLAIN hangs and very long query plans  (Strahinja Kustudić <strahinjak@nordeus.com>)
Список pgsql-bugs
=?UTF-8?Q?Strahinja_Kustudi=C4=87?= <strahinjak@nordeus.com> writes:
> On Fri, Dec 10, 2021 at 10:53 AM Pavel Stehule <pavel.stehule@gmail.com>
> wrote:
>> pá 10. 12. 2021 v 10:25 odesílatel Strahinja Kustudić <
>> strahinjak@nordeus.com> napsal:
>>> I allowed EXPLAIN in Docker to finish and it took almost 500 seconds and
>>> it was reading data all the time. After I reindexed the biggest table,
>>> EXPLAIN finished instantly. Can the index corruption cause this?

>> The index can be bloated.

> Is bloat just enough to make it slower, or the index needs to be corrupted?

bloat != corruption.  The problem you're dealing with here is a whole lot
of dead index entries at the very end of the index range (could be either
the lowest or highest entries).  The planner is wasting time scanning
through those to find the extremal non-dead value for a range estimate.
REINDEX got rid of the dead entries; a VACUUM would have done as well.

As noted upthread, more recent PG versions are a bit smarter about
such cases.

            regards, tom lane



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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: BUG #17330: EXPLAIN hangs and very long query plans
Следующее
От: PG Bug reporting form
Дата:
Сообщение: BUG #17333: pgdg postgresql-common pg_upgradecluster duplicate data_directory in configuration file