An expression index is a database index that is built on a generic expression, rather than on a list of 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, a unique index can be created on the upper- or lower-case representation of the user name:
CREATE UNIQUE INDEX site_user__user_name_lower ON site_user( lower( user_name ) );
That will create a unique index on "lower(user_name)". Any queries that search on "lower(user_name)" could then make use of that index:
SELECT user_id FROM site_user WHERE lower(user_name) = lower('Decibel');
Famous quotes containing the words expression and/or index:
“Fashion is the most intense expression of the phenomenon of neomania, which has grown ever since the birth of capitalism. Neomania assumes that purchasing the new is the same as acquiring value.... If the purchase of a new garment coincides with the wearing out of an old one, then obviously there is no fashion. If a garment is worn beyond the moment of its natural replacement, there is pauperization. Fashion flourishes on surplus, when someone buys more than he or she needs.”
—Stephen Bayley (b. 1951)
“Exile as a mode of genius no longer exists; in place of Joyce we have the fragments of work appearing in Index on Censorship.”
—Nadine Gordimer (b. 1923)