共計 1098 個字符,預計需要花費 3 分鐘才能閱讀完成。
這篇文章主要介紹“怎么理解 sql 體系結構 shared pool”,在日常操作中,相信很多人在怎么理解 sql 體系結構 shared pool 問題上存在疑惑,丸趣 TV 小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”怎么理解 sql 體系結構 shared pool”的疑惑有所幫助!接下來,請跟著丸趣 TV 小編一起來學習吧!
1. Shared pool 作用
(1)將 sql 語句解析成執行計劃
(2)對執行計劃進行執行,讀取數據
(3)將讀取到的數據返回給客戶端
2. Shared pool 組成
① free 空間
② 庫緩存,用于緩存 SQL 語句和執行計劃
③ 字典緩存,存儲數據庫自己本身的信息,包括數據字典
3. 查詢 shared pool 各部分大小
SQL select * from v$sgastat a where a.name=’library cache’;
SQL select * from v$sgastat a where a.pool = shared pool and a.name= free memory
SQL select * from v$sgastat a where a.name= row cache
4. 硬解析和軟解析
在 shard pool 中,前臺進程會將 SQL 語句解析成執行計劃,這部分中解析方式有兩種:硬解析和軟解析。
(1)硬解析(hard parse): 當一條 SQL 語句進入共享池后,沒有解析成執行計劃的緩存,就需要進行硬解析。
(2)軟解析(soft parse): 當一條 SQL 語句進入共享池后,共享池中有執行計劃的緩存,就進行軟解析。
SQL select name,value from v$sysstat where name like parse%
NAME VALUE
—————————————————————- ———-
parse time cpu 1479
parse time elapsed 2524
parse count (total) 60356
parse count (hard) 6524
parse count (failures) 16
parse count (describe) 50
在這個結果中,parse count (total) 代表從數據庫啟動之后,發生的全部解析數目。上述中當失敗解析和硬解析量比較大,說明有問題了。
到此,關于“怎么理解 sql 體系結構 shared pool”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注丸趣 TV 網站,丸趣 TV 小編會繼續努力為大家帶來更多實用的文章!