sql server - To use or not to use computed columns for performance and maintainability -


i have table storing startingdate in datetime column.

once have startingdate value, supposed calculate

  • number_of_days,
  • number_of_weeks
  • number_of_months ,
  • number_of_years

all startingdate current date.

if going use these values in 2 or more places in application , care applications response time, rather make calculations in view or create computed columns each can query table directly?

computed columns easy maintain , provide ideal solution problem – have used such solution recently. however, aware values calculated when requested (when selected), not when row inserted table – performance might still issue. might acceptable if can off-load work application server database server. views don’t exist until requested (unless materialised) so, again, there overhead @ runtime, but, again it’s on database server, not application server.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -