Re: Indexes with condition using immutable functions applied to column not used
Вложения
В списке pgsql-performance по дате отправления:
| От | Sylvain Rabot |
|---|---|
| Тема | Re: Indexes with condition using immutable functions applied to column not used |
| Дата | |
| Msg-id | 1297186225.2497.4.camel@kheops обсуждение исходный текст |
| Ответ на | Re: Indexes with condition using immutable functions applied to column not used (Jesper Krogh <jesper@krogh.cc>) |
| Список | pgsql-performance |
On Tue, 2011-02-08 at 06:15 +0100, Jesper Krogh wrote: > On 2011-02-08 01:14, Sylvain Rabot wrote: > > CREATE INDEX directory_id_user_mod_cons_hash_0_btree_idx ON mike.directory USING btree (id_user) WHERE __mod_cons_hash(id_user,4) = 0; > > CREATE INDEX directory_id_user_mod_cons_hash_1_btree_idx ON mike.directory USING btree (id_user) WHERE __mod_cons_hash(id_user,4) = 1; > > CREATE INDEX directory_id_user_mod_cons_hash_2_btree_idx ON mike.directory USING btree (id_user) WHERE __mod_cons_hash(id_user,4) = 2; > > CREATE INDEX directory_id_user_mod_cons_hash_3_btree_idx ON mike.directory USING btree (id_user) WHERE __mod_cons_hash(id_user,4) = 3; > > > > > mike=# EXPLAIN ANALYZE SELECT * FROM directory WHERE id_user = 4; > > Should be written as: > select * from directory where __mod_cons_hash(id_user,4) = 4%4; > > Then it should just work. > > -- > Jesper > The where clause you wrote selects all the directory records that have a id_user % 4 equivalent to 0 like 0, 4, 8, 16 ... etc. It does use the indexes but it is not was I want to select. -- Sylvain Rabot <sylvain@abstraction.fr>
В списке pgsql-performance по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера