Make \d tablename fast again, regression introduced by 85b7efa1cdd

Поиск
Список
Период
Сортировка
От Jelte Fennema-Nio
Тема Make \d tablename fast again, regression introduced by 85b7efa1cdd
Дата
Msg-id DHBQIZX8SZVI.ZX614ZMFL645@jeltef.nl
обсуждение исходный текст
Ответ на Re: Test timings are increasing too fast for cfbot  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
(forked from: Test timings are increasing too fast for cfbot)

On Wed, 25 Mar 2026 at 04:15, Andres Freund <andres@anarazel.de> wrote:
> It seems decidedly not optimal that "\d tablename", without any patterns, ends
> up doing a seqscan.  That's bad enough in the regression database, but there
> are many PG instances with many many entries in pg_class.
>
> I don't think this was always the case?
>
> If I remove the COLLATE pg_catalog.default, a sane plan is chosen. That's
> obviously not the right fix, but seemed interesting enough to mention.

Due to a very similar problem I faced in the past[1], I thought I had a
good sense of where roughly the problem was. And I indeed quickly found
it.

Attached is a patch that addresses this issue and starts using index
scans again for \d tablename.

This should be backpatched to PG18 where the regression was introduced
by 85b7efa1cdd

[1]: https://www.postgresql.org/message-id/flat/CAGECzQRqysy0eJMKR5he3gwtLrT87f9u5CQQua6B_XNwMnUtFA%40mail.gmail.com

Вложения

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