有的时候,想看看语句执行时间有多长,但是有不想看的刷屏的输出,各个数据库可以用下面的方法:
(1)Oracle: set autotrace trace,恢复的话,用set autottrace off
(2)postgresql: EXPLAIN ANALYZE
(3)MySQL: pager cat > /dev/null,恢复的话,直接打pager
MySQL的举例说明一下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
mysql> pager Default pager wasn't set, using stdout. mysql> mysql> select count(*) from orasup1; +----------+ | count(*) | +----------+ | 960896 | +----------+ 1 row in set (0.60 sec) mysql> pager cat > /dev/null PAGER set to 'cat > /dev/null' mysql> mysql> select count(*) from orasup1; 1 row in set (0.65 sec) mysql> pager Default pager wasn't set, using stdout. mysql> mysql> select count(*) from orasup1; +----------+ | count(*) | +----------+ | 960896 | +----------+ 1 row in set (0.63 sec) mysql> |