Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Indexes on expressions
7. When to create indexes on expressions
Partial indexes
Clustered indexes
Summary

Instruction

Good job! Now you can create indexes on expressions. Keep in mind, however, that such indexes are quite expensive. The expression must be computed for every new row inserted or updated, and it can take a long time in more complex cases.

You should only use indexed expressions when you're not able to rewrite the query to use indexes. Even then, you should only use indexes on expressions when the retrieval speed is more important than the speed of insertions and updates.

On a side note, if you want to index an expression with a function call, you can only use functions where the output is always completely determined by input parameters. For instance, a function which returns the current time can't be used; its output depends on something other than its input parameters (in this case, the system's clock).

Exercise

Run the template and see what happens.