根据我读过的文件,CLOB或BLOB的默认存储是内联的,这意味着如果它的大小小于约4k,那么它将保存在表中.
但是当我在Oracle(10.2.0.1.0)中的虚拟表上测试它时,Oracle Monitor(由Allround Automations)的性能和响应表明它正在被表格保留.
这是我的测试场景......
create table clobtest ( x int primary key, y clob, z varchar(100) )
;
insert into clobtest
select object_id, object_name, object_name
from all_objects where rownum < 10001
;
select COLUMN_NAME, IN_ROW
from user_lobs
where table_name = 'CLOBTEST'
;
Run Code Online (Sandbox Code Playgroud)
这显示:是(建议Oracle将clob存储在行中)
select x, y from CLOBTEST where ROWNUM < 1001 -- 8.49 seconds
select x, z from CLOBTEST where ROWNUM < 1001 -- 0.298 seconds
Run Code Online (Sandbox Code Playgroud)
因此,在这种情况下,CLOB值的最大长度为30个字符,因此应始终为内联.如果我运行Oracle Monitor,它会显示一个LOB.Length,后面跟着返回的每一行的LOB.Read(),再次表明clob值是用表保存的.
我也试过像这样创建表
create table clobtest
( x int primary key, y …Run Code Online (Sandbox Code Playgroud)