多版本cursor,與session_cached_cursors關係
在想如果一個存在多版本的cursor,如果讓每一個版本在session裡執行超過三次,那麼被cache的cursor是多個還是一個。實驗證明是多個。
create table wxh_tbd as select * from dba_tables;
var a varchar2(10)
var b varchar2(10)
var c varchar2(10)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
var a varchar2(10)
var b varchar2(100)
var c varchar2(10)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
var a varchar2(10)
var b varchar2(1000)
var c varchar2(10)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
var a varchar2(10)
var b varchar2(4000)
var c varchar2(10)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
var a varchar2(100)
var b varchar2(10)
var c varchar2(10)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
var a varchar2(1000)
var b varchar2(10)
var c varchar2(10)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
var a varchar2(4000)
var b varchar2(10)
var c varchar2(10)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
var a varchar2(100)
var b varchar2(100)
var c varchar2(10)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
var a varchar2(1000)
var b varchar2(1000)
var c varchar2(10)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
var a varchar2(2000)
var b varchar2(4000)
var c varchar2(10)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
var a varchar2(4000)
var b varchar2(10)
var c varchar2(100)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
var a varchar2(4000)
var b varchar2(10)
var c varchar2(300)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
var a varchar2(4000)
var b varchar2(10)
var c varchar2(1000)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
var a varchar2(4000)
var b varchar2(1000)
var c varchar2(100)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
var a varchar2(4000)
var b varchar2(100)
var c varchar2(4000)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
var a varchar2(1000)
var b varchar2(4000)
var c varchar2(10)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
var a varchar2(1)
var b varchar2(3000)
var c varchar2(300)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
var a varchar2(1000)
var b varchar2(400)
var c varchar2(400)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
var a varchar2(500)
var b varchar2(2500)
var c varchar2(10)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
var a varchar2(1000)
var b varchar2(100)
var c varchar2(2000)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
var a varchar2(600)
var b varchar2(1000)
var c varchar2(20)
exec :a := '1'
exec :b := '1'
exec :c := '1'
select * from wxh_tbd where table_name= :a and TABLESPACE_NAME= :b and instances= :c;
上面的程式碼執行N次,檢視v$sql裡的版本數是:
col name for a50
select sid, b.name, value
2 from v$sesstat a, v$statname b
3 where a.STATISTIC# = b.STATISTIC#
4 and name = 'session cursor cache count'
5 and sid = 3230;
SID NAME VALUE
---------- -------------------------------------------------- ----------
3230 session cursor cache count 6
select count(*) from v$sql where sql_text like 'select * from wxh_tbd where table_name= :a and TABLESPACE_NAME=%';
COUNT(*)
----------
6
看來會在PGA裡cache多個。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22034023/viewspace-681646/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- v$sqlarea_parse_calls與executions與session_cached_cursors關係SQLSession
- session_cached_cursors,cursor_space_for_timeSession
- 【最佳化】引數SESSION_CACHED_CURSORS與解析之間的關係Session
- open_cursor session_cached_cursors 優化Session優化
- v$sqlarea_parent cursor_v$sql_child cursor關係SQL
- RabbitMQ與Erlang的版本對應關係MQ
- android版本與linux核心版本對應關係AndroidLinux
- electron與node.js的版本對應關係(全版本)Node.js
- c#版本與vs的對應關係C#
- tensorflow與python版本對應關係Python
- SQL多版本控制 - _CURSOR_OBSOLETE_THRESHOLDSQL
- Spring Cloud與Spring Boot版本匹配關係CloudSpring Boot
- Cursor_sharing,Histogram,Analyze之間的關係Histogram
- spring cloud alibaba 元件版本關係 以及 畢業版本依賴關係SpringCloud元件
- 多程式命名管通通訊【無血緣關係程式】PHP 版本PHP
- Cursor_sharing,Histogram,Analyze之間的關係(轉)Histogram
- 多對多關係<EntityFramework6.0>Framework
- 與if的關係
- 線段與多邊形關係的演算法演算法
- 關聯關係與依賴關係的區別
- MySQL的多層SP中Cursor的m_max_cursor_index相關BUG分析MySqlIndex
- MyBatis加強(1)~myBatis物件關係對映(多對一關係、一對多關係)、延遲/懶載入MyBatis物件
- Cookie與Session 關係CookieSession
- 互動與關係
- MySQL JDBC驅動版本與資料庫版本的對應關係及注意事項MySqlJDBC資料庫
- v$sql_shared_cursor檢視記錄多版本的資訊SQL
- Laravel 中的多對多關係詳解Laravel
- 6.Hibernate多對多關係建立
- 域名和ip是多對多的關係
- mORMot2 定義多對多關係ORM
- 關於Hibernate多層1對多關係查詢
- 在EFCore中多對多關係的設計資料插入與查詢
- Android和SQLite版本對應關係AndroidSQLite
- .Net Framework各版本之間的關係Framework
- PyTorch和CUDA版本對應關係PyTorch
- 資料庫 - 關係代數與關係運算資料庫
- Spring系列:Spring版本和JDK版本對應關係SpringJDK
- Laravel 之多對多的關係模型Laravel模型