Home > database >  The count for optimization
The count for optimization

Time:11-22

Select count (0) from TB where time between '2015-1-1' and '2020-1-1 s' data is now about 500 w execution time about 15 seconds

How to optimize? Change the statement or indexed?

CodePudding user response:

MSSQL database

CodePudding user response:

Time to add try clustered index

CodePudding user response:

refer to the second floor sxq129601 response:
time plus the clustered index try


Gather the gathered all tried.. The effect is not obvious

CodePudding user response:

Plus with (nolock) give it a try

CodePudding user response:

reference 4 floor sxq129601 response:
add with (nolock) try


No effect, not lock problem, no other access to

CodePudding user response:

This statement is not optimized

CodePudding user response:

reference Music527 reply: 3/f
Quote: refer to the second floor sxq129601 response:

Time and clustered index try


Gather the gathered all tried.. The effect is not obvious

You see if there are any pieces of index reorganize or try to regenerate?

CodePudding user response:

You change the name of the table, also change the sensitive field, put all data export to CSV file, on baidu cloud disk sharing, free to help you see,
  • Related