Expression index
{{refimprove|date=June 2016}}
Within computing and computer science, an expression index, also known as a function based index, is a database index that is built on a generic expression, rather than one or more columns. This allows indexes to be defined for common query conditions that depend on data in a table, but are not actually stored in that table.
A common use for an expression index is to support case-insensitive searching or constraints. For example, if a web site wants to make user names case-insensitive, but still preserve the case as originally entered by the user, an index can be created on the lower-case representation of the user name:
:CREATE INDEX users__last_name_lower ON users( lower( last_name ) );
That will create a unique index on "lower(last_name)". Any queries that search on "lower(last_name)" could then make use of that index:
:SELECT user_id FROM users WHERE lower( last_name ) = lower( 'Smith' );
Database support
{{See also|Comparison of relational database management systems#Indices}}
Major databases which support expression indexes include: IBM Db2 (since version 10.5{{cite web |url=http://www.ibm.com/developerworks/data/library/techarticle/dm-1304whatsnewdb2105/ |accessdate=2015-08-26 |title=What's new in DB2 10.5 for Linux, UNIX, and Windows}}), Oracle Database (since release 8i.{{cite web |url=https://oracle-base.com/articles/8i/function-based-indexes |accessdate=2015-08-26 |title=Oracle Function Based Indexes}}) and PostgreSQL (since at least version 7{{cite web |url=http://www.postgresql.org/docs/7.0/static/indices.htm |accessdate=2015-08-26 |title=PostgreSQL - User's Guide - Chapter 7. Indices and Keys}}).
References
{{Reflist}}