I was working on a project at work and came to understand that I should call a function in several WHERE clause requests. The performance is not terrible, but I would like to improve it. So I looked at the docs for the indices , which said that:
An index field may be an expression calculated from the values of one or more columns of a table row.
Tall. So I tried to create an index:
CREATE INDEX idx_foo ON foo_table (stable_function(foo_column));
And the error is received:
ERROR: functions in index expression must be marked IMMUTABLE
So, I read about the Volatility Category of Functions , which talked about sustainable volatility:
In particular, it is safe to use an expression containing such a function in the index scan state.
" ", , . ? ? , ?
Postgres v9.0.1.