Re: Query taking seq scan on a table

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Query taking seq scan on a table
Дата
Msg-id 1176451.1600783646@sss.pgh.pa.us
обсуждение исходный текст
Ответ на 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
Shrikant Bhende <shrikantpostgresql@gmail.com> writes:
> *create index concurrently lname_test_btree_txt_pat_ops on wldbowner.member
> (lname text_pattern_ops) where fname like LOWER(unaccent_string(lname) ||
> '%')*
> Is this the correct way to create a b-tree index with text_pattern_ops for
> my requirement ?

No.  What you're trying to optimize is

                            Filter: ((lower(unaccent_string((lname)::text))
~~ 'info%'::text) AND (lower(unaccent_string((fname)::text)) ~~
'travel%'::text))

so you need one or both of

create index on member (lower(unaccent_string(lname)) text_pattern_ops);
create index on member (lower(unaccent_string(fname)) text_pattern_ops);

If one of those two conditions is reliably more selective than the
other, perhaps just one index would do.

            regards, tom lane



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

Предыдущее
От: Geoff Winkless
Дата:
Сообщение: Re: The default database account can be accessed without a password
Следующее
От: MUKESH PRASAD
Дата:
Сообщение: Re: The default database account can be accessed without a password