Informix插入记录的过程(insert row)

数据库版本:12.10.FC6X5
操作系统:RHEL 6U4 64bit
目的:通过onlog命令熟悉插入记录时的数据库内部操作过程

之前的创建表的语句:

create table ttt
(
  col1 integer,
  col2 char(40),
  col3 varchar(40),
  col4 text
);
create index ix_ttt on ttt(id);

由于有text字段,需要通过load方式导入记录

[informix@rhel6u4 temp]$ more ttt.unl
1|test001|test001|test001
[informix@rhel6u4 temp]$ dbaccess testdb -

Database selected.

> load from ttt.unl insert into ttt;

1 row(s) loaded.

通过onlog -n <逻辑日志编号> 的输出,可知数据库内部需要完成如下操作:
请输入图片描述

1、开始事务
BEGIN(begin work):包含事务号、开始时间、用户;
2、分配区段 -- 如果已经有空闲的页,不需要分配
CHALLOC(Chunk extent allocation):分配第一个extent,在7:65(chunk num:num of page)开始分配8页;
3、Partition页扩展
PTEXTEND(Tblspace extend):在7:65页的基础上扩展7个页引成8个页;
4、插入blob数据 -- 由于有text字段,故有该操作
PBINSERT(Insert tblspace blobpage):插入text数据到tblspace blobpage中;
5、插入普通数据
HINSERT(Home row insert):往表ttt中插入数据;
ADDITEM(Add item to index): 往ttt表的索引中增加相应的记录;
6、完成操作,提交
COMMIT(commit work): 包含提交时间。

标签: none

添加新评论

Free Web Hosting