Re: psql: Greatly speed up "\d tablename" when not using regexes

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: psql: Greatly speed up "\d tablename" when not using regexes
Дата
Msg-id 4091190.1712772398@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [MASSMAIL]psql: Greatly speed up "\d tablename" when not using regexes  (Jelte Fennema-Nio <postgres@jeltef.nl>)
Ответы Re: psql: Greatly speed up "\d tablename" when not using regexes
Список pgsql-hackers
Jelte Fennema-Nio <postgres@jeltef.nl> writes:
> Running "\d tablename" from psql could take multiple seconds when
> running on a system with 100k+ tables. The reason for this was that
> a sequence scan on pg_class takes place, due to regex matching being
> used.

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

Really?  ISTM this argument is ignoring an optimization the backend
has understood for a long time.

regression=# explain select * from pg_class where relname ~ '^foo$';
                                         QUERY PLAN

--------------------------------------------------------------------------------
-------------
 Index Scan using pg_class_relname_nsp_index on pg_class  (cost=0.28..8.30 rows=
1 width=739)
   Index Cond: (relname = 'foo'::text)
   Filter: (relname ~ '^foo$'::text)
(3 rows)

            regards, tom lane



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Issue with the PRNG used by Postgres
Следующее
От: Ranier Vilela
Дата:
Сообщение: [MASSMAIL] Fix possible dereference null pointer (src/backend/replication/logical/reorderbuffer.c)