Slow distinct query in SQL Server over large dataset

前端 未结 10 2593
情深已故
情深已故 2021-02-14 00:27

We\'re using SQL Server 2005 to track a fair amount of constantly incoming data (5-15 updates per second). We noticed after it has been in production for a couple months that on

10条回答
  •  盖世英雄少女心
    2021-02-14 01:08

    I could be missing something but would it be more efficient if an overhead on load to create a view with distinct values and query that instead?

    This would give almost instant responses to the select if the result set is significantly smaller with the overhead over populating it on each write though given the nature of the view that might be trivial in itself.

    It does ask the question how many writes compared to how often you want the distinct and the importance of the speed when you do.

提交回复
热议问题