Hacker News new | ask | show | jobs
by matt-p 263 days ago
I think it /can/ also be to 'multiply a number by 12'. For example lets say I'm a supermarket, who gets their order data out of a 20 year old IT system and as a result I've got a orders table which has a id, user_id and data column with an array of 'sku, price and qty'. If I regularly want to query/sort/filter based on total order value the easiest and most performant solution absolutely is to use a computed column.
1 comments

If you need to retrieve the values, the fastest would probably be a stored generated column, not a virtual computed on the fly.

In case you only want to filter without returning values, you could also index directly on the expression without needing to add a stored generated column with an index on it