Select Query Performace Issue

San 161 Reputation points
2022-02-21T10:06:48.287+00:00

Dear Experts,

I have a table which is very slow . How can I improve the performance of the query.

Select * from Fact.Mgn_History (Total # of records in the table 2254281). It take around 15 mins when I just run a Select Statement without giving any condition.

There are few indexed in the table

1) IX_MGN - Clustered Index
2) Act_date - Non Clustered Index
3) ID - Non Clustered Index
4)Mgn_sk - Non Clustered Index

It will really help if something share tips to improve performance.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,685 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,625 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Olaf Helper 44,311 Reputation points
    2022-02-21T10:09:47.867+00:00

    when I just run a Select Statement without giving any condition.

    Then SQL Server always perform a full table scan and depending on data size it takes some time. Not to forget the network workload and client takes time to represent the amount of data. So which improvement do you expect here?

    1 person found this answer helpful.

  2. Erland Sommarskog 110.4K Reputation points MVP
    2022-02-21T23:07:23.053+00:00

    How are you receiving the result?

    What constrains the execution time in this case is not really SQL Server, but rather the client that receives the result.

    And why are you bothering that about this? That is, what is your actual business need? Why do you want get all rows in the table?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.