oracle performance tunning(3)
三、最佳化排序操作
1、概念
伺服器首先在sort_area_size指定大小的記憶體區域裡排序,如果所需的空間超過 sort_area_size,排序會在臨時表空間裡進行。在專用伺服器模式下,排序空間在PGA中,在共享伺服器模式下,排序空間在UGA中。如果沒有 建立large pool,UGA處於shared pool中,如果建立了large pool,UGA就處於large pool中,而PGA不在sga中,它是與每個程式對應單獨存在的。
PGA:program global area,為單個程式(伺服器程式或後臺程式)儲存資料和控制資訊的記憶體區域。PGA與程式一一對應,且只能被起對應的程式讀寫,PGA在使用者登入資料庫建立會話的時候建立。
有關排序空間自動管理的兩個引數:
Pga_aggregate_target: 10M-4000G,等於分配給oracle instance的所有記憶體減去SGA後的大小。
Workarea_size_policy: auto/manual,只有Pga_aggregate_target已定義時才能設定為auto。
這兩個引數會取代所有的*_area_size引數。
措施:
儘可能避免排序;儘可能在記憶體中排序;分配合適的臨時空間以減少空間分配呼叫。
2、需要進行排序的操作:
A、建立索引;
B、涉及到索引維護的並行插入
C、order by或者group by(儘可能對索引欄位排序)
D、Distinct
E、union/intersect/minus
F、sort-merge join
G、analyze命令(僅可能使用estamate而不是compute)
3、診斷和措施
Select * from v$sysstat where name like ‘%sort%’;
Sort(disk):要求Io去臨時表空間的排序數目
Sort(memory):完全在memory中完成的排序數目
Sort(rows):被排序的行數合計
Sort(disk)/ Sort(memory)<5%,如果超過5%,增加sort_area_size的值。
SELECT disk.Value disk,mem.Value mem,(disk.Value/mem.Value)*100 ratio FROM v$sysstat disk,v$sysstat mem WHERE mem.NAME='sorts (memory)' AND disk.NAME='sorts (disk)';
4、監控臨時表空間的使用情況及其配置
Select tablespace_name,current_users,total_extents,used_extents,extent_hits,max_used_blocks,max_sort_blocks FROM v$sort_segment ;
Column Description
CURRENT_USERS Number of active users
TOTAL_EXTENTS Total number of extents
USED_EXTENTS Extents currently allocated to sorts
EXTENT_HITS Number of times an unused extent was found in the pool
MAX_USED_BLOCKS Maximum number of used blocks
MAX_SORT_BLOCKS Maximum number of blocks used by an individual sort
臨時表空間的配置:
A、initial/next設定為sort_area_size的整數倍,允許額外的一個block作為segment的header
B、pctincrease=0
C、基於不同的排序需要建立多個臨時表空間
D、將臨時表空間檔案分散到多個磁碟上[@more@]
1、概念
伺服器首先在sort_area_size指定大小的記憶體區域裡排序,如果所需的空間超過 sort_area_size,排序會在臨時表空間裡進行。在專用伺服器模式下,排序空間在PGA中,在共享伺服器模式下,排序空間在UGA中。如果沒有 建立large pool,UGA處於shared pool中,如果建立了large pool,UGA就處於large pool中,而PGA不在sga中,它是與每個程式對應單獨存在的。
PGA:program global area,為單個程式(伺服器程式或後臺程式)儲存資料和控制資訊的記憶體區域。PGA與程式一一對應,且只能被起對應的程式讀寫,PGA在使用者登入資料庫建立會話的時候建立。
有關排序空間自動管理的兩個引數:
Pga_aggregate_target: 10M-4000G,等於分配給oracle instance的所有記憶體減去SGA後的大小。
Workarea_size_policy: auto/manual,只有Pga_aggregate_target已定義時才能設定為auto。
這兩個引數會取代所有的*_area_size引數。
措施:
儘可能避免排序;儘可能在記憶體中排序;分配合適的臨時空間以減少空間分配呼叫。
2、需要進行排序的操作:
A、建立索引;
B、涉及到索引維護的並行插入
C、order by或者group by(儘可能對索引欄位排序)
D、Distinct
E、union/intersect/minus
F、sort-merge join
G、analyze命令(僅可能使用estamate而不是compute)
3、診斷和措施
Select * from v$sysstat where name like ‘%sort%’;
Sort(disk):要求Io去臨時表空間的排序數目
Sort(memory):完全在memory中完成的排序數目
Sort(rows):被排序的行數合計
Sort(disk)/ Sort(memory)<5%,如果超過5%,增加sort_area_size的值。
SELECT disk.Value disk,mem.Value mem,(disk.Value/mem.Value)*100 ratio FROM v$sysstat disk,v$sysstat mem WHERE mem.NAME='sorts (memory)' AND disk.NAME='sorts (disk)';
4、監控臨時表空間的使用情況及其配置
Select tablespace_name,current_users,total_extents,used_extents,extent_hits,max_used_blocks,max_sort_blocks FROM v$sort_segment ;
Column Description
CURRENT_USERS Number of active users
TOTAL_EXTENTS Total number of extents
USED_EXTENTS Extents currently allocated to sorts
EXTENT_HITS Number of times an unused extent was found in the pool
MAX_USED_BLOCKS Maximum number of used blocks
MAX_SORT_BLOCKS Maximum number of blocks used by an individual sort
臨時表空間的配置:
A、initial/next設定為sort_area_size的整數倍,允許額外的一個block作為segment的header
B、pctincrease=0
C、基於不同的排序需要建立多個臨時表空間
D、將臨時表空間檔案分散到多個磁碟上[@more@]
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/18921899/viewspace-1016895/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle.Performance.Tuning筆記OracleORM筆記
- Oracle Advanced Performance Tuning Scripts(轉)OracleORM
- 關閉sql tunningSQL
- Oracle Performance Tuning 11g2 (2)OracleORM
- Oracle 19c Concepts(06):Data Dictionary and Dynamic Performance ViewsOracleORMView
- 解密Prompt系列1. Tunning-Free Prompt:GPT2 & GPT3 & LAMA & AutoPrompt解密GPT
- PerformanceORM
- MySQL Performance SchemaMySqlORM
- oracle 3Oracle
- webpack Performance: The Comprehensive GuideWebORMGUIIDE
- Performance Without the Event LoopORMOOP
- 設定performance模式ORM模式
- Boost UDP Transaction PerformanceUDPORM
- [譯] Performance testing of Flutter appsORMFlutterAPP
- 1383. Maximum Performance of a TeamORM
- Performance and High-Availability OptionsORMAI
- Performance --- 前端效能監控ORM前端
- Guideline 2.3.10 - Performance - Accurate MetadataGUIIDEORM
- MySQL Performance Schema詳解MySqlORM
- chrome devtools使用詳解——PerformanceChromedevORM
- performance_schema詳解一ORM
- [Javascript] Using IIFE to improve code performanceJavaScriptORM
- 效能優化篇 - Performance(工具 & api)優化ORMAPI
- An Overview of High Performance Computing and Responsibly Reckless AlgorithmsViewORMGo
- Performance API不完全使用指北ORMAPI
- Oracle 11G RAC叢集安裝(3)——安裝OracleOracle
- 使用window.performance分析頁面效能ORM
- godaddy 的 Monitoring performance to make your website fasterGoORMWebAST
- MySQL5.6 PERFORMANCE_SCHEMA 說明MySqlORM
- 前端效能監控-window.performance(轉)前端ORM
- Dynamics CRM Performance Issue when CRM Forms OpeningORM
- improve spring integration read message performance from mqSpringORMMQ
- 前端效能監測,Runtime Performance Debug 技巧前端ORM
- 2022 Flutter Performance 效能除錯工具 devToolsFlutterORM除錯dev
- 3、Oracle 中的過濾、排序Oracle排序
- .NET Core 效能分析: xUnit.Performance 簡介ORM
- MySQL調優效能監控之performance schemaMySqlORM
- oracle drop table purge無備份bbed恢復(3/3)Oracle
- MySQL:簡單記錄performance_schema.threads中的3種執行緒ID各自的含義MySqlORMthread執行緒