7 ms·
> I imagine the computed column could be indexed or materialized if needed. The article mentions that "you cannot create indexes on VIRTUAL generated columns".
by tczMUFlmoNk 1y ago
> I imagine the computed column could be indexed or materialized if needed.
The article mentions that "you cannot create indexes on VIRTUAL generated columns".
- gdulli 1y agoOh thanks I missed the distinction between a virtual and regular generated column.
- jimktrains2 1y agoSince you can index expressions I wonder if that's because you essentially emhave to store the value in the index anyway and that wouldn't be expected for a virtual column?
- evanelias 1y agoI don't really understand why this restriction would be necessary. Wouldn't the computed value just get stored in the index btree keys, exactly the same as an indexed expression? For comparison, MySQL permits indexing of virtual columns, and indexes on expressions share the same underlying implementation to support this. In other words, in MySQL an index on an expression is literally just an index on an internally-hidden virtual column.