首頁 資料庫 mysql教程 clob加||隐式转换造成的性能问题

clob加||隐式转换造成的性能问题

Jun 07, 2016 pm 03:29 PM
clob 效能 類型 轉換 問題

CLOB在隐式类型转换的时候,会消耗这么多的current mode read和 consistent read(同时也会引起db block change,db block gets 的飙升),也就是CPU飙升。 SQL drop table t_clob; SQL create table t_clob(id number,cb clob); SQL insert into t_clob values

CLOB在隐式类型转换的时候,会消耗这么多的current mode read和 consistent read(同时也会引起db block change,db block gets 的飙升),也就是CPU飙升。

SQL> drop table t_clob;

SQL> create table t_clob(id number,cb clob);
SQL> insert into t_clob values(1,'3,4,5,6,77,88,99,10,222');
SQL> begin
for i in 1 .. 1000 loop
insert into t_clob values(i,'3,4,99,71,18,91,89,'||i);
end loop;
commit;
end;
/
SQL> set autotrace traceonly
SQL> alter session set events '10046 trace name context forever ,level 12';
SQL> select *
from t_clob
where cb like ',4,'
or cb like ',16'
or cb like ',91';
已用时间: 00: 00: 00.23
执行计划
----------------------------------------------------------
Plan hash value: 3459655851
----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 2015 | 39 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T_CLOB | 1 | 2015 | 39 (0)| 00:00:01 |
----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("CB" LIKE ',4,' OR "CB" LIKE ',16' OR "CB" LIKE ',91')
Note
-----
- dynamic sampling used for this statement
统计信息
----------------------------------------------------------
820 recursive calls
0 db block gets
175 consistent gets
7 physical reads
0 redo size
416 bytes sent via SQL*Net to client
385 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
13 sorts (memory)
0 sorts (disk)
0 rows processed

SQL> select *
from t_clob
where ',' || cb like ',4'
or ',' || cb like ',16'
or ',' || cb like ',91';
未选定行
已用时间: 00: 00: 00.50
执行计划
----------------------------------------------------------
Plan hash value: 3459655851
----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 2015 | 39 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T_CLOB | 1 | 2015 | 39 (0)| 00:00:01 |
----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter(','||"CB" LIKE ',4' OR ','||"CB" LIKE ',16' OR ','||"CB"
LIKE ',91')
Note
-----
- dynamic sampling used for this statement
统计信息
----------------------------------------------------------
5 recursive calls
84084 db block gets
18057 consistent gets

0 physical reads
0 redo size
416 bytes sent via SQL*Net to client
385 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
0 rows processed
SQL> alter session set events '10046 trace name context off';
会话已更改。
已用时间: 00: 00: 00.00

SQL> set autotrace off

10046 trace的结果:

select *
from t_clob
where cb like ',4,'
or cb like ',16'
or cb like ',91'
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.01 0.00 0 7 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 0.01 0.01 0 16 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 3 0.03 0.01 0 23 0 0


Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 61
Rows Row Source Operation
------- ---------------------------------------------------
0 TABLE ACCESS FULL T_CLOB (cr=16 pr=0 pw=0 time=12823 us)

select *
from t_clob
where ',' || cb like ',4'
or ',' || cb like ',16'
or ',' || cb like ',91'


call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.03 0 7 15 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 0.21 0.20 0 9025 42027 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 3 0.21 0.24 0 9032 42042 0
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 61
Rows Row Source Operation
------- ---------------------------------------------------
0 TABLE ACCESS FULL T_CLOB (cr=9025 pr=0 pw=0 time=207946 us)

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

本地運作效能超越 OpenAI Text-Embedding-Ada-002 的 Embedding 服務,太方便了! 本地運作效能超越 OpenAI Text-Embedding-Ada-002 的 Embedding 服務,太方便了! Apr 15, 2024 am 09:01 AM

Ollama是一款超實用的工具,讓你能夠在本地輕鬆運行Llama2、Mistral、Gemma等開源模型。本文我將介紹如何使用Ollama實現對文本的向量化處理。如果你本地還沒有安裝Ollama,可以閱讀這篇文章。本文我們將使用nomic-embed-text[2]模型。它是一種文字編碼器,在短的上下文和長的上下文任務上,效能超越了OpenAItext-embedding-ada-002和text-embedding-3-small。啟動nomic-embed-text服務當你已經成功安裝好o

不同Java框架的效能對比 不同Java框架的效能對比 Jun 05, 2024 pm 07:14 PM

不同Java框架的效能比較:RESTAPI請求處理:Vert.x最佳,請求速率達SpringBoot2倍,Dropwizard3倍。資料庫查詢:SpringBoot的HibernateORM優於Vert.x及Dropwizard的ORM。快取操作:Vert.x的Hazelcast客戶端優於SpringBoot及Dropwizard的快取機制。合適框架:根據應用需求選擇,Vert.x適用於高效能Web服務,SpringBoot適用於資料密集型應用,Dropwizard適用於微服務架構。

PHP 陣列鍵值翻轉:不同方法的效能比較分析 PHP 陣列鍵值翻轉:不同方法的效能比較分析 May 03, 2024 pm 09:03 PM

PHP數組鍵值翻轉方法效能比較顯示:array_flip()函數在大型數組(超過100萬個元素)下比for迴圈效能更優,耗時更短。手動翻轉鍵值的for迴圈方法耗時相對較長。

C++ 函式對程式效能有哪些影響? C++ 函式對程式效能有哪些影響? Apr 12, 2024 am 09:39 AM

函数对C++程序性能的影响包括函数调用开销、局部变量和对象分配开销:函数调用开销:包括堆栈帧分配、参数传递和控制权转移,对小函数影响显著。局部变量和对象分配开销:大量局部变量或对象创建和销毁会导致堆栈溢出和性能下降。

C++中如何優化多執行緒程式的效能? C++中如何優化多執行緒程式的效能? Jun 05, 2024 pm 02:04 PM

優化C++多執行緒效能的有效技術包括:限制執行緒數量,避免爭用資源。使用輕量級互斥鎖,減少爭用。優化鎖的範圍,最小化等待時間。採用無鎖定資料結構,提高並發性。避免忙等,透過事件通知執行緒資源可用性。

PHP 數組轉物件對效能的影響是什麼? PHP 數組轉物件對效能的影響是什麼? Apr 30, 2024 am 08:39 AM

在PHP中,陣列到物件的轉換會對效能產生影響,主要受陣列大小、複雜度、物件類別等因素影響。為了優化效能,可以考慮使用自訂迭代器、避免不必要的轉換、批次轉換數組等技巧。

PHP函數的效能如何? PHP函數的效能如何? Apr 18, 2024 pm 06:45 PM

不同PHP函數的效能對應用程式效率至關重要。效能較好的函數包括echo、print,而str_replace、array_merge、file_get_contents等函數效能較慢。例如,str_replace函數用於替換字串,性能中等,而sprintf函數用於格式化字串。效能分析表明,執行一個範例僅需0.05毫秒,證明了函數效能良好。因此,明智地使用函數可以建立更快、更有效率的應用程式。

C++ 靜態函數的效能考量有哪些? C++ 靜態函數的效能考量有哪些? Apr 16, 2024 am 10:51 AM

靜態函數效能考慮如下:程式碼大小:靜態函數通常更小,因為不包含成員變數。記憶體佔用:不屬於任何特定對象,不佔用對象記憶體。呼叫開銷:更低,無需透過物件指標或引用呼叫。多線程安全:通常線程安全,因為不依賴類別實例。

See all articles