Re: Query taking seq scan on a table

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: Query taking seq scan on a table
Дата
Msg-id CAMkU=1zeEd2Q1yLKBDaKC1DW1UVxtYJiAX+ifp6mwodTOGqCnw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Query taking seq scan on a table  (Shrikant Bhende <shrikantpostgresql@gmail.com>)
Ответы Re: Query taking seq scan on a table  (Shrikant Bhende <shrikantpostgresql@gmail.com>)
Список pgsql-admin
On Mon, Sep 21, 2020 at 12:51 AM Shrikant Bhende <shrikantpostgresql@gmail.com> wrote:
Also I have tried to add a GIN index for better text search as below, 

CREATE INDEX idx_fnmae_lname_gin_composite ON wldbowner.member USING gin
(lower((((fname)::text || ' '::text) || (lname)::text)) rdsadmin.gin_trgm_ops);


You index does not match your query:

((lower(unaccent_string((lname)::text)) ~~ 'info%'::text) AND (lower(unaccent_string((fname)::text)) ~~ 'travel%'::text))
 
Your index is not passing the columns through unaccent_string, and it is concatenating the columns while the query is treating them separately.  You need to make the index (or indexes, as you might want one for each column) match the query.

If the wildcard is always at the end of the search-pattern strings, you could instead use btree indexes with text_pattern_ops.

Cheers,

Jeff

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

Предыдущее
От: zaid khan
Дата:
Сообщение: Issue in streaming replication after increasing swap.
Следующее
От: Tom Aizenberg
Дата:
Сообщение: How do I configure pgAdmin to use a fixed port?