Mysql 所需的工作量与行数成正比)。你可以检查执行计划,看看它是否在使用索引。我是数据库新手,不知道这意味着什么-你可以检查执行计划,看看它是否在使用索引。你能告诉我在哪里读到的吗? select count(rowid) from MySchema.TableI
Mysql 所需的工作量与行数成正比)。你可以检查执行计划,看看它是否在使用索引。我是数据库新手,不知道这意味着什么-你可以检查执行计划,看看它是否在使用索引。你能告诉我在哪里读到的吗? select count(rowid) from MySchema.TableI,mysql,database,sql-server-2008,oracle11g,Mysql,Database,Sql Server 2008,Oracle11g,所需的工作量与行数成正比)。你可以检查执行计划,看看它是否在使用索引。我是数据库新手,不知道这意味着什么-你可以检查执行计划,看看它是否在使用索引。你能告诉我在哪里读到的吗? select count(rowid) from MySchema.TableInMySchema; create table foo (id integer not null, c1 varchar(2000), c2 varchar(2000)); insert into foo (id, c1, c2) selec
所需的工作量与行数成正比)。你可以检查执行计划,看看它是否在使用索引。我是数据库新手,不知道这意味着什么-你可以检查执行计划,看看它是否在使用索引。你能告诉我在哪里读到的吗?
select count(rowid) from MySchema.TableInMySchema;
create table foo (id integer not null, c1 varchar(2000), c2 varchar(2000));
insert into foo (id, c1, c2)
select lvl, c1, c1 from
(
select level as lvl, dbms_random.string('A', 2000) as c1
from dual
connect by level < 10000
);
SQL> set autotrace traceonly explain statistics;
SQL> select count(*) from foo;
Execution Plan
----------------------------------------------------------
Plan hash value: 1342139204
-------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
-------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 2740 (1)| 00:00:33 |
| 1 | SORT AGGREGATE | | 1 | | |
| 2 | TABLE ACCESS FULL| FOO | 9999 | 2740 (1)| 00:00:33 |
-------------------------------------------------------------------
Statistics
----------------------------------------------------------
181 recursive calls
0 db block gets
10130 consistent gets
0 physical reads
0 redo size
430 bytes sent via SQL*Net to client
420 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
5 sorts (memory)
0 sorts (disk)
1 rows processed
SQL>
SQL> create index i1 on foo (id);
Index created.
SQL> select count(*) from foo;
Execution Plan
----------------------------------------------------------
Plan hash value: 129980005
----------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
----------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 7 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | | |
| 2 | INDEX FAST FULL SCAN| I1 | 9999 | 7 (0)| 00:00:01 |
----------------------------------------------------------------------
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
27 consistent gets
21 physical reads
0 redo size
430 bytes sent via SQL*Net to client
420 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
SQL>