Which of the following statements does SELECTCOUNT (1) and SELECTCOUNT (*) have good performance? Today, I met someone in an article I wrote and asked if the statistical information could not be updated. Isn't that the address of this article wrong when the statistical data is obtained: previously, I thought SELECTCOUNT (*) was based on statistics, but I thought about it later. This is definitely not true.
Select count (1) and select count (*) which has good performance? Today, I met someone in an article I wrote and asked if the statistical information could not be updated. Isn't that the address of this article wrong when the statistical data is obtained: previously, I thought that select count (*) was based on statistics, but I thought about it later.
Select count (1) and select count (*) which has good performance?
Today I met someone who asked me in a previous article
If the statistics have not been updated, isn't it wrong?
Address of this article:
Previously, I thought that select count (*) was based on statistics, but I thought about it later. This is definitely not
How does sqlserver count select count ??
In fact, SQLSERVER is also a scan method.
You can also take a look at allocation scan and range scan in SQLSERVER.
However, we will not discuss whether it is allocation scan or range scan. We all know that SQLSERVER is using the SCAN method.
Clustered index table
The SQL script is as follows:
Ct1 (c1 INT, c2 VARCHAR (2000); t1c1 ON ct1 (c1);) ct1, 2000) ct1