From: | Arguile <arguile(at)lucentstudios(dot)com> |
---|---|
To: | Mike Mascari <mascarm(at)mascari(dot)com> |
Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Functional index performance question |
Date: | 2003-09-30 13:06:43 |
Message-ID: | 1064927204.26645.19.camel@broadswd |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Ian Harding | 2003-09-30 13:07:37 | Query FKey Constraint Table and Column Names |
Previous Message | Andreas Pflug | 2003-09-30 13:03:19 | Re: ADD FOREIGN KEY (was Re: [GENERAL] 7.4Beta) |