Simple analysis of the difference and performance of Count (1) count (*) count (COL)
url:http://blog.csdn.net/dba_waterbin/article/details/8569257
count (1) and COUNT (*) have no distinction (execution plan and statistics), and are all statisticsLine
Count (col) Statistics col columns are not empty records, if there is an index, regardless of whether the col is empty, can go index, without index can not go
Test
[SQL] View plain copy print? Hr@orcl> select count (1) from t; execution plan ---------------------------------------------------------- plan hash value: 2966233522 ---------------------------------------------- --------------------- | Id | Operation | Name | Rows | Cost (%CPU) | time | ------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 159 (2) | 00:00:02 | | 1 | sort aggregate | | 1 | | | | 2 | table access full| T | 50356 | 159 (2) | 00:00:02 | ------------------------------------------------------------------- hr@orcl> select count (*) from t; execution plan ---------------------------------------------------------- Plan hash value: 2966233522 -------------------------- ----------------------------------------- | Id | Operation | name | rows | cost (%CPU) | time | --------------------------------------------------------- ---------- | 0 | SELECT STATEMENT | | 1 | 159 (2 ) | 00:00:02 | | 1 | SORT AGGREGATE | | 1 | | | | 2 | TABLE ACCESS FULL| t | 50356 | 159 (2) | 00:00:02 |