溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

v$sql v$sqlarea v$sqltext

發(fā)布時(shí)間:2020-07-12 12:20:24 來(lái)源:網(wǎng)絡(luò) 閱讀:515 作者:lych528 欄目:MySQL數(shù)據(jù)庫(kù)

這里做個(gè)筆記,純屬是加深印象:

V$SQL lists statistics on shared SQL areas without the GROUP BY clause and contains one row for each child of the original SQL text entered. Statistics displayed in V$SQL are normally updated at the end of query execution. However, for long running queries, they are updated every 5 seconds. This makes it easy to see the impact of long running SQL statements while they are still in progress.

明顯v$sql的信息來(lái)源于共享內(nèi)存區(qū)shared SQL areas,也就是說(shuō)相關(guān)SQL信息在數(shù)據(jù)庫(kù)重啟,數(shù)據(jù)庫(kù)緩存被刷,或相關(guān)SQL信息被踢出緩存區(qū),此SQL的信息就不能在V$SQL里查詢。而V$SQL記錄每一個(gè)SQL的每一個(gè)子游標(biāo)的信息。

V$SQLAREA displays statistics on shared SQL areas and contains one row per SQL string. It provides statistics on SQL statements that are in memory, parsed, and ready for execution.

同樣v$sqlarea也存儲(chǔ)于library cache,然而這個(gè)視圖卻做了一個(gè)統(tǒng)計(jì)分析,統(tǒng)計(jì)的方式是以sql string分組,也就是以sql_text文本做了group by,在此前提下對(duì)其他信息統(tǒng)計(jì)sum()。通過(guò)version_count可以得出SQL子游標(biāo)的總數(shù)。所以簡(jiǎn)單的說(shuō):v$sqlarea存放的是相同SQL語(yǔ)句不同version一個(gè)匯總。

version_count:Number of child cursors that are present in the cache under this parent

excutions : Total number of executions, totalled over all the child cursors

V$SQLTEXT displays the text of SQL statements belonging to shared SQL cursors in the SGA.

v$sql及v$sqlarea存放的更多的是性能數(shù)據(jù),但其sql_text是不完整的的,如果想獲得完整的sql就要用v$sqltext。

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI