表分析初體驗
----建立表
SQL> create table test as (select * from all_objects);
Table created.
SQL> insert into test (select * from all_objects);
38167 rows created.
SQL> commit;
Commit complete.
----建立索引
SQL> create index ind_test on test (object_name);
Index created.
-------表還沒有統計資訊
SQL> select table_name,last_analyzed from user_tables where table_name='TEST';
TABLE_NAME LAST_ANALYZED
------------------------------------------------------------ --------------
TEST
-------索引的統計資訊是新建立的時候的:2010年5月30日18:59:46
SQL> select index_name,to_char(last_analyzed,'yyyymmddHH24MISS') from user_indexes where index_name='IND_TEST';
INDEX_NAME TO_CHAR(LAST_ANALYZED,'YYYYM
--------------- ----------------------------
IND_TEST 20100530185946
SQL> select to_char(sysdate,'yyyymmddHH24MISS') from dual;
TO_CHAR(SYSDATE,'YYYYMMDDHH2
----------------------------
20100530190139
--------執行表分析
SQL> exec dbms_stats.gather_table_stats(ownname => 'charis',tabname => 'test');
PL/SQL procedure successfully completed.
--------更新了表的統計資訊
SQL> select table_name,to_char(last_analyzed,'yyyymmddHH24MISS') from user_tables where table_name='TEST';
TABLE_NAME TO_CHAR(LAST_ANALYZED,'YYYYM
-------------------- ----------------------------
TEST 20100530190256
--------更新了索引的統計資訊
SQL> select index_name,to_char(last_analyzed,'yyyymmddHH24MISS') from user_indexes where index_name='IND_TEST';
INDEX_NAME TO_CHAR(LAST_ANALYZED,'YYYYM
--------------- ----------------------------
IND_TEST 20100530190256
SQL> select count(1) from test;
COUNT(1)
----------
76334
SQL>
[@more@]來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23850820/viewspace-1034366/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 程式碼分析引擎 CodeQL 初體驗
- Angular 初體驗Angular
- http初體驗HTTP
- AQS初體驗AQS
- golang 初體驗Golang
- OpenCV 初體驗OpenCV
- Nuxt 初體驗UX
- indexedDB 初體驗Index
- laravel初體驗Laravel
- Flutter初體驗Flutter
- jQuery初體驗jQuery
- ollama 初體驗
- Electron初體驗
- go modules 初體驗Go
- ReactNative初體驗React
- react hooks初體驗ReactHook
- Laravel Octane 初體驗Laravel
- gRPC初體驗RPC
- Mybatis初體驗(二)MyBatis
- Vue 初體驗(上)Vue
- Canvas 動畫初體驗Canvas動畫
- html初體驗#2HTML
- Docker容器初體驗Docker
- Docker for Mac 初體驗DockerMac
- Docker 容器初體驗Docker
- .Net Aspire初體驗
- SpringMVC初體驗SpringMVC
- web assembly 初體驗Web
- Argo CD初體驗Go
- 微服務新體驗之Aspire初體驗微服務
- Highcharts.js -純javasctipt圖表庫初體驗JSJava
- PyQt5 初體驗QT
- golang 與 docker 初體驗GolangDocker
- Python初體驗——列表Python
- Vue.js初體驗Vue.js
- React Native 初體驗React Native
- Go初體驗|基礎Go
- Github codespaces 初體驗Github