Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7563185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:36:03+00:00 2026-05-30T13:36:03+00:00

Well, I have a table which is 40,000,000+ records but when I try to

  • 0

Well, I have a table which is 40,000,000+ records but when I try to execute a simple query, it takes ~3 min to finish execution. Since I am using the same query in my c# solution, which it needs to execute over 100+ times, the overall performance of the solution is deeply hit.

This is the query that I am using in a proc

 DECLARE @Id bigint    
 SELECT @Id = MAX(ExecutionID) from ExecutionLog where TestID=50881    
 select @Id  

Any help to improve the performance would be great. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:36:05+00:00Added an answer on May 30, 2026 at 1:36 pm

    What indexes do you have on the table? It sounds like you don’t have anything even close to useful for this particular query, so I’d suggest trying to do:

    CREATE INDEX IX_ExecutionLog_TestID ON ExecutionLog (TestID, ExecutionID)
    

    …at the very least. Your query is filtering by TestID, so this needs to be the primary column in the composite index: if you have no indexes on TestID, then SQL Server will resort to scanning the entire table in order to find rows where TestID = 50881.

    It may help to think of indexes on SQL tables in the same way as those you’d find in the back of a big book that are hierarchial and multi-level. If you were looking for something, then you’d manually look under ‘T’ for TestID then there’d be a sub-heading under TestID for ExecutionID. Without an index entry for TestID, you’d have to read through the entire book looking for TestID, then see if there’s a mention of ExecutionID with it. This is effectively what SQL Server has to do.

    If you don’t have any indexes, then you’ll find it useful to review all the queries that hit the table, and ensure that one of those indexes is a clustered index (rather than non-clustered).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table with roughly 7,000,000 records. It's very flat and for sake
well i have this messages table with sample values like these: msg_id recipient_id read
I have a MySQL table with a column of well-formed URLs. I'd like to
Say if I have a large dataset, the table has well over a million
I have a table which has no primary key and I can't add one
I have one problem with Android SQLite database. I have one table which contains
I have a html table which consists of columns for days, and rows for
I have a recursive query which executes very fast if the WHERE clause contains
I have a table from which I need to get the count grouped on
I have a table which contains one row with a string (for example: 'me',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.