using system wide variable i.o. current_timestamp

  • Using system wide variable current_time instead of current_timestamp function

    At the moment all my views includes where clauses with fields smaller and greater than current_timestamp.My application only fills the date part of these fields and time part set to default 00:00:00

    I would like to know if it would improve the performance if I defined a system wide variable or value called todays_date (only date part) that would be initialized in the beginning of the day and used that value in the where clauses of my views instead of T-sql current_timestamp function.

  • This was removed by the editor as SPAM

  • Since your application is defaulting to mid night for time portion of the date , try using a date value without the time part (yyyy-mm-dd) in your views. This will make SQL server to default to mid night.

  • For the type of date math you're performing I don't think you will

    see much of a performance gain. But it make sense to use a varialbe

    instead of calling a function everytime

    MW


    MW

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply