Re: Index not used when using a function

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Index not used when using a function
Дата
Msg-id 11201.1263428498@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Index not used when using a function  (Nick <nboutelier@gmail.com>)
Список pgsql-general
Nick <nboutelier@gmail.com> writes:
> SELECT * FROM locations WHERE id = 12345 LIMIT 1
> uses the primary key (id) index, but...

> SELECT * FROM locations WHERE id = get_location_id_from_ip(641923892)
> LIMIT 1

> does not and is verrry slow. Any ideas why?

You didn't mark the function stable or immutable.
http://www.postgresql.org/docs/8.4/static/xfunc-volatility.html

            regards, tom lane

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

Предыдущее
От: akuster
Дата:
Сообщение: Re: How to subscribe to your security list?
Следующее
От: Nick
Дата:
Сообщение: Re: Index not used when using a function