Enhancing performance with index on Computed Columns
Before trying to understand what "an index on a Computed Column" is, it is good to have a basic understanding of what a Computed Column is.
As per MSDN, a Computed Column is computed from an expression that can use other columns in the same table. The expression can be a non-computed column name, constant, function, or any combination of these, connected by one or more operators. The expression cannot be a subquery.
By default, a Computed Column is a virtual column and it is recalculated every time we call it, until we specify it as PERSISTED
in the CREATE TABLE
or ALTER TABLE
commands.
If a Computed Column is defined as being PERSISTED
, it stores the calculated value and those stored values are updated each time you change the value of the original column. Moreover, you can't use Computed Column names in INSERT
and UPDATE
statements.
As it is already proved that an index plays an important role in performance, in the previous chapter, Chapter...