当前位置: 代码迷 >> 综合 >> count(*),count(1),count(id),count(rowid)的效率
  详细解决方案

count(*),count(1),count(id),count(rowid)的效率

热度:61   发布时间:2023-10-26 18:17:38.0
SQL> select count(*) from ysgl_compile_reqsub;


  COUNT(*)
----------
   5288265


已用时间:  00: 00: 07.51
SQL> select count(1) from ysgl_compile_reqsub;


  COUNT(1)
----------
   5288265


已用时间:  00: 00: 00.68
SQL> select count(id) from ysgl_compile_reqsub;


 COUNT(ID)
----------
   5288265


已用时间:  00: 00: 00.68
SQL> select count(rowid) from ysgl_compile_reqsub;


COUNT(ROWID)
------------
     5288265


已用时间:  00: 00: 01.01
SQL> select count(rowid) from ysgl_vdata_his;


COUNT(ROWID)
------------
     5299458


已用时间:  00: 00: 09.98
SQL> select count(*) from ysgl_vdata_his;


  COUNT(*)
----------
   5299458


已用时间:  00: 00: 00.93
SQL> select count(1) from ysgl_vdata_his;


  COUNT(1)
----------
   5299458


已用时间:  00: 00: 00.71
SQL> select count(1) from ysgl_excelbasic;


  COUNT(1)
----------
   3755052


已用时间:  00: 00: 04.60
SQL> select count(*) from ysgl_excelbasic;


  COUNT(*)
----------
   3755052


已用时间:  00: 00: 00.50
SQL>
  相关解决方案