Is GETDATE() expensive as DateTime.Now is?

performance, sql, sql-server, sql-server-2008, t-sql

Solution

It's not expensive: it comes straight from the OS.

I'd cache it anyway. It will most likely be different for separate calls if you have multiple statements. Say you have multiple inserts, surely you'd want the value to correlate acrosss tables?

If it's use in a SELECT, say, for output then it's only evaluated once usually.

Problem

I have heard that `DateTime.Now` is very expensive call (from here) Is `GETDATE()` in SQL 2005/2008 expensive? Have I to cache it into a variable if my stored procedure uses it a number of times?

Original source

Related problems