码迷,mamicode.com
首页 > 数据库 > 详细

常用SQL性能统计代码

时间:2015-03-13 16:29:07      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:


1
BEGIN 2 DBMS_STATS.GATHER_TABLE_STATS(OWNNAME=> TELEDB, TABNAME=> WFGTEST, PARTNAME=> NULL); 3 END; 4 ALTER TABLE WFGTEST DEALLOCATE UNUSED ; 5 COMMIT; 6 7 SELECT TABLE_NAME,NUM_ROWS,BLOCKS,EMPTY_BLOCKS 8 FROM USER_TABLES 9 WHERE TABLE_NAME=WFGTEST; 10 11 SELECT COUNT(1) FROM WFGTEST; 12 13 DELETE FROM WFGTEST; 14 COMMIT; 15 16 TRUNCATE TABLE WFGTEST; 17 COMMIT; 18 19 SELECT *FROM WFGTEST; 20 21 DECLARE 22 NUM NUMBER(20); 23 DT1 DATE; 24 BEGIN 25 NUM :=1; 26 DT1 := SYSDATE(); 27 FOR NUM IN 1 .. 1000000 28 LOOP 29 INSERT INTO WFGTEST VALUES(TO_CHAR(NUM),TO_CHAR(NUM),NUM); 30 END LOOP; 31 COMMIT; 32 33 DBMS_OUTPUT.PUT_LINE(FLOOR(TO_NUMBER(SYSDATE-DT1)*24*60*60)); 34 35 END ;

 

常用SQL性能统计代码

标签:

原文地址:http://www.cnblogs.com/xhu218/p/4335257.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!