sql server - SQL Group By Year, Month, Week, Day, Hour SQL vs Procedural Performance -


I need to write a query that will periodically add a large number of records from year to hour.

My initial approach is to decide in procedural manner, to run again through each and to run data for that period, SQL is run, I am making dataset. I have come to know later that I can group records by using year (), month (), day (), and datapart. I am (Week, date) and datepart (hh, date).

  Selected amount (some value) Table 1 year by the group (delivery date), month (delivery date), day (delivery date)  

My concern It is possible that from running from time to time, running a query several times due to not being able to use the index from a group using a data cutter, can be poor performance;

Thanks

with regard to display any ideas as related to anything Remedy

Checking a query plan for a second approach will tell you an obvious problem (when you know there is no need to complete a full scan) but to measure No option for SQL Measurement Measurement Testing Testing Want to be done with the proper size of data Hey

Since this is a complex matter, so you are not comparing two different methods to do only one query, but compare a single query approach to a running, aspects of your environment Can play a major role in real performance.

Specifically

  1. The 'distance' between your application and the latency of the database
  2. Whether you are using a ready statement or not ( Due to the extra parsing efforts for every query on the database engine)
  3. Whether each call will be wasted in comparison to a larger query approach
  4. The question of building the mountain is expensive (Influenced by heavy 2)

Comments