[英]How to improve my oracle query?
我在Oracle中有一個查詢,單個查詢需要3秒鍾或更長時間,但就我而言,我多次執行該查詢來處理多個記錄,因此總體上需要更多時間。
為了提高查詢性能,我執行了以下操作。
我已經執行了SQL調優咨詢並創建了建議索引,但是建議索引在執行計划中不起作用,它顯示了與先前相同的主鍵索引,我將為此做些什么。
我的查詢是:
Select NVL(Min(MACIDREFNO),0)
from TACID_MST
Where MacIdStatus = 2
And Status = 0
And UsedAs = 1
And IsCodeSigned = 0
And SiteRefNo = 0;
執行計划是:
執行計划
SQL調整咨詢的結果是:
GENERAL INFORMATION SECTION `Result of Tuning Advisory`
-------------------------------------------------------------------------------
Tuning Task Name : staName75534
Tuning Task Owner : TESTUSER
Tuning Task ID : 385915
Scope : COMPREHENSIVE
Time Limit(seconds) : 1800
Completion Status : COMPLETED
Started at : 01/24/2018 15:46:15
Completed at : 01/24/2018 15:46:17
Number of Index Findings : 1
-------------------------------------------------------------------------------
FINDINGS SECTION (1 finding)
-------------------------------------------------------------------------------
1- Index Finding (`see explain plans section below`)
--------------------------------------------------
The execution plan of this statement can be improved by creating one or more
indices.
Recommendation (estimated benefit: 100%)
----------------------------------------
- Consider running the Access Advisor to improve the physical schema design
or creating the recommended index.
create index TESTUSER.IDX$$_5E37B0001 on
TESTUSER.TACID_MST('STATUS','USEDAS','MACIDSTATUS','SITEREFNO','ISCODESIGNED');
Rationale
---------
Creating the recommended indices significantly improves the execution plan
of this statement. However, it might be preferable to run "Access Advisor"
using a representative SQL workload as opposed to a single statement. This
will allow to get comprehensive index recommendations which takes into
account index maintenance overhead and additional space consumption.
最簡單的方法:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.