Home  >  Article  >  Database  >  sql数据库走索引怎么始终有物理读?_MySQL

sql数据库走索引怎么始终有物理读?_MySQL

WBOY
WBOYOriginal
2016-06-01 13:51:15980browse

bitsCN.com

   问题是这样的:
  1 sql> r

  2   1  select count(*)

  3   2  from t_edu_member_info

  4   3* where status='1' and xs_zy='1'

  01 执行计划

  02 -------------------------------------------------------------------------------------------

  03    0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=1 Card=1 Bytes=10)

  04    1    0   SORT (AGGREGATE)

  05    2    1     FILTER

  06    3    2       INDEX (RANGE SCAN) OF 'IND_T_PREBM4' (NON-UNIQUE) (Cost=1 Card=5 Bytes=50)

  07

  08 统计信息

  09 ----------------------------------------------------------

  10          25  recursive calls

  11          14  db block gets

  12           3  consistent gets

  13           1  physical reads

  14         972  redo size

  15         375  bytes sent via SQL*Net to client

  16         372  bytes received via SQL*Net from client

  17           2  SQL*Net roundtrips to/from client

  18           1  sorts (memory)

  19           0  sorts (disk)

  20           1  rows processed

  这个结果已经跑了几次,但是 recursive calls 依然存在,后来从10046事件产生的trace文件中到了线索。用tkprof格式化trace文件后,可以看到:

  1 select count(*)

  2 from t_edu_member_info

  3 where status='1'

  4 and xs_zy='1'

  01 call     count       cpu    elapsed       disk      query    current        rows

  02 ------- ------  -------- ---------- ---------- ---------- ----------  ----------

  03 Parse        1      0.01       0.00          0          0          0           0

  04 Execute      1      0.78       0.90   

 

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn