3 ms·
I mean, technically any database with triggers can have generated columns, but PostgreSQL has had generated columns since version 13. Current version is 17. ht
by brightball 2y ago
I mean, technically any database with triggers can have generated columns, but PostgreSQL has had generated columns since version 13. Current version is 17.
https://www.postgresql.org/docs/current/ddl-generated-columns.html https://www.postgresql.org/docs/current/ddl-generated-column...
I can’t think of any advantage of a virtual generated column over a generated column for something like a search index where calculating on read would be very slow.
Postgres has been able to create indexes based on the output of functions forever though, which does the job here too.
- sgarland 2y agoThe advantage is when you want to store something for ease of use, but don’t want the disk (and memory, since pages read are loaded into the buffer pool) hit. So here, you could precompute the vector and index it, while not taking the double hit on size.
- deleted 2y ago[deleted]
- brightball 2y agoThat’s the same benefit in Postgres as creating an index with the result of function.