Function-based indexes allow indexing on expressions.
An index on a function or expression applied to a column, such as LOWER(email) or amount * rate. Enables index use for queries that apply the same expression, avoiding full scans. Useful for case-insensitive lookups without changing the column values.
| Database System | Support Status | Since Version | Notes |
|---|---|---|---|
| MySQL | ✓ Supported | 8.0.13 | If you run MySQL < 8.0.13: use a generated column (VIRTUAL or STORED) and index that column. |
| PostgreSQL | ✓ Supported | 9.3 | |
| SQL Server | ✓ Supported | 2008 | SQL Server supports indexes on computed columns (use PERSISTED for storage). Filtered indexes also available for conditional expressions. |
| Oracle | ✓ Supported | 12c | |
| SQLite | ✓ Supported | 3.9.0 | Expression indexes supported starting in SQLite 3.9.0. |
Function-based indexes can significantly improve query performance for specific types of searches.
If you run MySQL < 8.0.13: use a generated column (VIRTUAL or STORED) and index that column.
SQL Server supports indexes on computed columns (use PERSISTED for storage). Filtered indexes also available for conditional expressions.
Expression indexes supported starting in SQLite 3.9.0.