Hi, I am querying a SQL server database with over 500 000 records every 2 to 5 minutes and the query i plan to execute is
I am using the IN statement in the query to avoid a join and Res is either (5,6,11) or (1,2,3,4,7,8,9,10). How expensive is this to the server? Should i break it down and use a complex and statement OR for matching Product_ids?
How expensive is the overhead for getting max(actual_date) ? I need to get the date and time of the last unit tracked in the section for the product lines A (5,6,11) and B (1,2,3,4,7,8,9,10) and I want to avoid overhead on the server - which i am only a user and can't benchmark.
Code:
"SELECT MAX(actual_date) AS Max_unit_id FROM dbo.trackingTable Where (tracking_area_Id=12) and ( product_id in " & Res & ")"
I am using the IN statement in the query to avoid a join and Res is either (5,6,11) or (1,2,3,4,7,8,9,10). How expensive is this to the server? Should i break it down and use a complex and statement OR for matching Product_ids?
How expensive is the overhead for getting max(actual_date) ? I need to get the date and time of the last unit tracked in the section for the product lines A (5,6,11) and B (1,2,3,4,7,8,9,10) and I want to avoid overhead on the server - which i am only a user and can't benchmark.