[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 943
  • Last Modified:

Calculate query execution time

I would like rebuild few fragmented indexes. So, I will be executing the REBUILD query one after other. But I would like to make a note of the time taken for rebuild operation to complete for each index. Is there any easy way to do that???

Otherwise I include a 'select CURRENT_TIMESTAMP' before and after my rebuild query.

Please reply with any tips, scripts. Thanks!
0
w3brang3r
Asked:
w3brang3r
  • 2
  • 2
1 Solution
 
Scott PletcherSenior DBACommented:
It's probably best to capture time before and after the rebuild command.

You can set SET STATISTICS TIME ON, to have SQL echo the time, but in cases that itself has been shown to degrade performance, so, as above, I suggest just capturing the time yourself before and after.
0
 
Anthony PerkinsCommented:
But I would like to make a note of the time taken for rebuild operation to complete for each
index. Is there any easy way to do that???

If you use the script here, it will not only reindex/reorganize the indexes that need it, but also give you the time that it started and ended.
0
 
w3brang3rAuthor Commented:
@acperkins

I want to rebuild selected indexes. I have the list.
0
 
Anthony PerkinsCommented:
Then it sounds like you are on the right track.
0
 
w3brang3rAuthor Commented:
My idealogy and the approach mentioned in the Question is absolutely correct and also accepted by one of the Expert.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now