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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jelte Fennema-Nio" <postgres(at)jeltef(dot)nl>
Cc: "Andres Freund" <andres(at)anarazel(dot)de>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>, "Dilip Kumar" <dilipbalaut(at)gmail(dot)com>, "Thomas Munro" <thomas(dot)munro(at)gmail(dot)com>, "Noah Misch" <noah(at)leadboat(dot)com>, "Peter Eisentraut" <peter(at)eisentraut(dot)org>
Subject: Re: Make \d tablename fast again, regression introduced by 85b7efa1cdd
Date: 2026-07-04 20:27:05
Message-ID: 614120.1783196825@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Jelte Fennema-Nio" <postgres(at)jeltef(dot)nl> writes:
> (forked from: Test timings are increasing too fast for cfbot)
> On Wed, 25 Mar 2026 at 04:15, Andres Freund <andres(at)anarazel(dot)de> wrote:
>> It seems decidedly not optimal that "\d tablename", without any patterns, ends
>> up doing a seqscan.
>> ...
>> I don't think this was always the case?

> 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.

I looked this over, and I think it's basically right, but don't
we need to check that *both* of the collations are deterministic?

Also the commit message had a lot of details wrong. AFAICS this
only affects the exact-match case not prefix-match, and it applies
to regexes as well as LIKE.

See attached v2.

regards, tom lane

Attachment Content-Type Size
v2-0001-Fix-LIKE-regex-optimization-for-indexscan-with-ex.patch text/x-diff 6.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2026-07-04 21:02:40 Re: SQL/JSON json_table plan clause
Previous Message Heikki Linnakangas 2026-07-04 19:11:54 Re: Don't use the deprecated and insecure PQcancel in our frontend tools anymore