|
|
|
|
|
by dangoodmanUT
263 days ago
|
|
I always find it hard to think of a good reason for a (computed) virtual column Why would you ever force your db to multiply a value by 12 to another column, or parse a json path, if it’s not for filtering? Move that effort to your clients so you’re not needlessly consuming db resources. |
|
Having computed (stored or virtual) columns would've been awesome.
The use case isn't really "multiply a value by 12", but more like "we have a single boolean is_active column, and want to migrate to a more extensive status model" or "migrate from an is_active column to a (begin, end) timestamp tuple" or so.
With a virtual column, you can present a read-only, compatible column to the legacy application, while the other applications can use the more detailed, new columns, without having to keep the legacy column in sync.