Re: index on lower(column) is very slow

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: index on lower(column) is very slow
Дата
Msg-id 87y93rl15p.fsf@stark.dyndns.tv
обсуждение исходный текст
Ответ на Re: index on lower(column) is very slow  (valerian <valerian2@hotpop.com>)
Ответы Re: index on lower(column) is very slow  (valerian <valerian2@hotpop.com>)
Список pgsql-general
valerian <valerian2@hotpop.com> writes:

> I just realized that I was behind by one release, so I upgraded to pgsql
> 7.3.2, then added some more random data (18000 rows in the table now)
> and ran 'VACUUM FULL ANALYZE' again.  Here's the subsequent results:
>
> test=> EXPLAIN SELECT id, password FROM test WHERE LOWER(email) = 'pwcm6@pgaxd6hhuteforp966cz';
>                                     QUERY PLAN
> ----------------------------------------------------------------------------------
>  Index Scan using test_email_lc_idx on test  (cost=0.00..292.25 rows=91 width=16)
>    Index Cond: (lower((email)::text) = 'pwcm6@pgaxd6hhuteforp966cz'::text)
> (2 rows)

Try "explain analyze" which will actually run the query and print timing
information.

Also, note that the number of records returned is probably a big factor here.
The case-sensitive version is only returning 1 record whereas postgres expects
the case=insensitive version to return 91 records. Try the case-sensitive
version on a value that has a comparable number of records to for a better
test.

--
greg

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

Предыдущее
От: Jean-Christian Imbeault
Дата:
Сообщение: postgres process and ps stats
Следующее
От: "Greg Sabino Mullane"
Дата:
Сообщение: Website advertisements