Re: Functional index performance question

Поиск
Список
Период
Сортировка
От Arguile
Тема Re: Functional index performance question
Дата
Msg-id 1064927204.26645.19.camel@broadswd
обсуждение исходный текст
Ответ на Functional index performance question  (Mike Mascari <mascarm@mascari.com>)
Ответы Re: Functional index performance question  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Functional index performance question  (Mike Mascari <mascarm@mascari.com>)
Re: Functional index performance question  (Greg Stark <gsstark@mit.edu>)
Список pgsql-general
On Tue, 2003-09-30 at 07:06, Mike Mascari wrote:
[snip]
> CREATE INDEX i_employees ON employees(lower(name));
>
> Let's also assume that the lower() function is computationally
> expensive. Now if I have a query like:
>
> SELECT lower(name)
> FROM employees
> WHERE lower(name) = 'mike'
>
> will PostgreSQL re-evaluate lower(name)? Is it necessary?

No, it won't re-evaluate. Which is why functional indexes work and why
you can only declare a functional index on a referentially transparent
function (see IMMUTABLE flag in CREATE FUNCTION).


See also:
    http://developer.postgresql.org/docs/postgres/indexes-expressional.html
    http://developer.postgresql.org/docs/postgres/sql-createfunction.html



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

Предыдущее
От:
Дата:
Сообщение: Re: Where are user-defined types stored/viewed
Следующее
От: Mike Leahy
Дата:
Сообщение: Divide by zero...