Re: psql: Greatly speed up "\d tablename" when not using regexes - Mailing list pgsql-hackers

From Kirill Reshke
Subject Re: psql: Greatly speed up "\d tablename" when not using regexes
Date
Msg-id CALdSSPjTUo=L+qGYW5_zy+DNT+fGCxWQWEcbM6NDOauApn=TMg@mail.gmail.com
Whole thread Raw
In response to [MASSMAIL]psql: Greatly speed up "\d tablename" when not using regexes  (Jelte Fennema-Nio <postgres@jeltef.nl>)
Responses Re: psql: Greatly speed up "\d tablename" when not using regexes
List pgsql-hackers
Hi


> Regex matching is obviously unnecessary when we're looking for an exact
> match. This checks for this (common) case and starts using plain
> equality in that case.

+1

> + appendPQExpBuffer(buf, "(%s OPERATOR(pg_catalog.=) ", namevar);
> + appendStringLiteralConn(buf, &namebuf.data[2], conn);
> + appendPQExpBuffer(buf, "\n        OR %s OPERATOR(pg_catalog.=) ",
> +  altnamevar);
> + appendStringLiteralConn(buf, &namebuf.data[2], conn);
> + appendPQExpBufferStr(buf, ")\n");

Do we need to force Collaction here like in other branches?
if (PQserverVersion(conn) >= 120000)
   appendPQExpBufferStr(buf, " COLLATE pg_catalog.default");



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Issue with the PRNG used by Postgres
Next
From: Ranier Vilela
Date:
Subject: Re: Fix resource leak (src/backend/libpq/be-secure-common.c)