SQL Server Performance

Improving Query Performance using Top

Discussion in 'ALL SQL SERVER QUESTIONS' started by Kunal K, Apr 19, 2013.

  1. Kunal K New Member

    I have a query which retrieves 2 million records in SQL Server 2008, but I am not interested in these 2 million records, I am interested in only top 2000 records, hence I used Top 2000 in my query, but it still taken around 2 minutes to give me 2000 records, which is not good. How can I improve performance in this case?
  2. Shehap MVP, MCTS, MCITP SQL Server

    First , welcome to Forums..

    It seems your query has nothing to do with the amount of output records but it is impacted potentially by either “where conditions” ,” tables Joins “or perhaps might be impacted by the usage of “Order by” which slows down the process of data filtration itself so it does n’t matter how much small is the selected data because at the end it will consume the same time for data filtration so it would be good if you can share your T-SQL query and query execution plan or IO statistics at least using set statistics io on
  3. AJITH123 Member

    If the plan is good, then might be due to the volume of data pass through the network..
  4. Charandeep Nayyar New Member

    Avoid using * to retrieve the records because it uses all the engines of sql by default.

Share This Page