Codementor Events

Solved SQL Server high query time issue

Published Feb 04, 2023
Solved SQL Server high query time issue

Today, I got notification asking for help in SQL Server.
Mentee was facing high processing time in executing query on SQL Server.

I have solve many query issue earlier so I quickly expressed my interest to solve this. Mentee accepted it.

I asked below details before giving any suggestions:

  1. Explain me table structure, columns, primary key, column types etc.
  2. List scenario how table will be going to use by application. This was to identify what columns are frequently used in where clause.
  3. How much data available in table? (row count)

There was 45 millions records in table. All query gives latency around few minutes. It does have primary key but as per requirement, there were few columns frequently used as where clause.

I suggested him to create index on few columns and try.
He was quickly to get my suggestion and implemented index.

Then he tried executing query and Voila. He got result in seconds.
That was a success session for both of us.

Index is very important to get best performance from queries.

Discover and read more posts from Chetan Sankhala
get started
post commentsBe the first to share your opinion
Show more replies