Row Chaining and Migrating--行连接

2024-01-29 19:18
文章标签 连接 row migrating chaining

本文主要是介绍Row Chaining and Migrating--行连接,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

文章转载地址:http://woodbow.net/283.html

表里的一行对于一个数据块太大的情况有二种(一行在一个数据块里放不下)

第一种情况:
INSERT的时候,INSERT时候行的大小就超一个块的大小。Oracle把这行的数据存储在一连串的数据块里(Oracle Stores the data for the row in a chain of data blocks),这种情况称为行链接(Row Chain),一般不可避免(除非使用更大的数据块)。

第二种情况:
UPDATE的时候,UPDATE之后导致行的大小超过一个块的大小,Oracle将迁移这行数据(整行)到一个新的数据块(假设更新的行在新的数据块下放得下,否则这里发生一次行链接),在行迁移之前的地方有一个指向迁移后数据块的指针,行的rowid不会改变。

view source
-- 行链接
SQL> create table t01
  2  (
  3     col01 varchar2(4000),
  4     col02 varchar2(4000),
  5     col03 varchar2(2000)
  6  )
  7  /
 
Table created.
 
SQL> insert into t01 values(lpad('*',4000,'*'),lpad('*',4000,'*'),lpad('*',2000,'*'));
 
1 row created.
 
SQL> commit;
 
Commit complete.
 
SQL> select rowid from t01;
 
ROWID
------------------
AAASpTAAEAAAALdAAA
 
SQL> select from t01 where rowid='AAASpTAAEAAAALdAAA';
 
Execution Plan
----------------------------------------------------------
Plan hash value: 2326159110
 
-----------------------------------------------------------------------------------
| Id  | Operation                  | Name Rows  | Bytes | Cost (%CPU)| Time     |
-----------------------------------------------------------------------------------
|   0 | SELECT STATEMENT           |      |     1 |  5018 |     1   (0)| 00:00:01 |
|   1 |  TABLE ACCESS BY USER ROWID| T01  |     1 |  5018 |     1   (0)| 00:00:01 |
-----------------------------------------------------------------------------------
 
Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
          2  consistent gets
          0  physical reads
 
-- 行迁移
SQL> show parameter block_size
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_block_size                        integer     8192
 
SQL> create table t01
  2  (
  3     col01 varchar2(4000),
  4     col02 varchar2(4000),
  5     col03 varchar2(2000)
  6  )
  7  /
 
Table created.
 
SQL> insert into t01
  2    values(lpad('*',3000,'*'),lpad('*',3000,'*'),lpad('*',1000,'*'));
 
1 row created.
 
SQL> insert into t01
  2    values('a','a','a');
 
1 row created.
 
SQL> commit;
 
Commit complete.
 
SQL> select rowid from t01 where col01='a';
 
ROWID
------------------
AAASpWAAEAAAALrAAB
 
SQL> select from t01 where rowid='AAASpWAAEAAAALrAAB';
 
Execution Plan
----------------------------------------------------------
Plan hash value: 2326159110
 
-----------------------------------------------------------------------------------
| Id  | Operation                  | Name Rows  | Bytes | Cost (%CPU)| Time     |
-----------------------------------------------------------------------------------
|   0 | SELECT STATEMENT           |      |     1 |  5018 |     1   (0)| 00:00:01 |
|   1 |  TABLE ACCESS BY USER ROWID| T01  |     1 |  5018 |     1   (0)| 00:00:01 |
-----------------------------------------------------------------------------------
 
Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
          1  consistent gets
          0  physical reads
 
SQL> update t01
  2     set col01 = lpad(col01, 3000, 'a'),
  3         col02 = lpad(col02, 3000, 'a'),
  4         col03 = lpad(col03, 1000, 'a')
  5    where col01 = 'a';
 
1 row updated.
 
SQL> commit;
 
Commit complete.
 
SQL> select rowid from t01 where col01 like 'a%';
 
ROWID
------------------
AAASpWAAEAAAALrAAB
 
SQL> select rowid from t01 where col01 like 'a%';
 
ROWID
------------------
AAASpWAAEAAAALrAAB
 
SQL> set autot trace
SQL> select from t01 where rowid='AAASpWAAEAAAALrAAB';
 
Execution Plan
----------------------------------------------------------
Plan hash value: 2326159110
 
-----------------------------------------------------------------------------------
| Id  | Operation                  | Name Rows  | Bytes | Cost (%CPU)| Time     |
-----------------------------------------------------------------------------------
|   0 | SELECT STATEMENT           |      |     1 |  5018 |     1   (0)| 00:00:01 |
|   1 |  TABLE ACCESS BY USER ROWID| T01  |     1 |  5018 |     1   (0)| 00:00:01 |
-----------------------------------------------------------------------------------
 
Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
          2  consistent gets
          0  physical reads
 
-- 检查行迁移的记录
SQL> truncate table chained_rows;
 
Table truncated.
 
SQL> analyze table t01 list chained rows into chained_rows;
 
Table analyzed.
 
SQL> exec print_table('select * from chained_rows')
OWNER_NAME                    : YAO
TABLE_NAME                    : T01
CLUSTER_NAME                  :
PARTITION_NAME                :
SUBPARTITION_NAME             : N/A
HEAD_ROWID                    : AAASpWAAEAAAALrAAB
ANALYZE_TIMESTAMP             : 2012-12-24 11:31:51
-----------------
 
PL/SQL procedure successfully completed.
 
-- 消除行迁移
 
SQL> alter table t01 move;
 
Table altered.
 
SQL> select rowid from t01 where col01 like 'a%';
 
ROWID
------------------
AAASpZAAEAAAAL8AAA
 
SQL> set autot trace
 
SQL> select from t01 where rowid='AAASpZAAEAAAAL8AAA'
 
Execution Plan
----------------------------------------------------------
Plan hash value: 2326159110
 
-----------------------------------------------------------------------------------
| Id  | Operation                  | Name Rows  | Bytes | Cost (%CPU)| Time     |
-----------------------------------------------------------------------------------
|   0 | SELECT STATEMENT           |      |     1 |  5018 |     1   (0)| 00:00:01 |
|   1 |  TABLE ACCESS BY USER ROWID| T01  |     1 |  5018 |     1   (0)| 00:00:01 |
-----------------------------------------------------------------------------------
 
Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
          1  consistent gets
          0  physical reads

这篇关于Row Chaining and Migrating--行连接的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/657915

相关文章

W外链微信推广短连接怎么做?

制作微信推广链接的难点分析 一、内容创作难度 制作微信推广链接时,首先需要创作有吸引力的内容。这不仅要求内容本身有趣、有价值,还要能够激起人们的分享欲望。对于许多企业和个人来说,尤其是那些缺乏创意和写作能力的人来说,这是制作微信推广链接的一大难点。 二、精准定位难度 微信用户群体庞大,不同用户的需求和兴趣各异。因此,制作推广链接时需要精准定位目标受众,以便更有效地吸引他们点击并分享链接

Java 连接Sql sever 2008

Java 连接Sql sever 2008 /Sql sever 2008 R2 import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; public class TestJDBC

实例:如何统计当前主机的连接状态和连接数

统计当前主机的连接状态和连接数 在 Linux 中,可使用 ss 命令来查看主机的网络连接状态。以下是统计当前主机连接状态和连接主机数量的具体操作。 1. 统计当前主机的连接状态 使用 ss 命令结合 grep、cut、sort 和 uniq 命令来统计当前主机的 TCP 连接状态。 ss -nta | grep -v '^State' | cut -d " " -f 1 | sort |

【Go】go连接clickhouse使用TCP协议

离开你是傻是对是错 是看破是软弱 这结果是爱是恨或者是什么 如果是种解脱 怎么会还有眷恋在我心窝 那么爱你为什么                      🎵 黄品源/莫文蔚《那么爱你为什么》 package mainimport ("context""fmt""log""time""github.com/ClickHouse/clickhouse-go/v2")func main(

nginx长连接的问题

转自: http://www.360doc.com/content/12/1108/17/1073512_246644318.shtml

NGINX轻松管理10万长连接 --- 基于2GB内存的CentOS 6.5 x86-64

转自:http://blog.chinaunix.net/xmlrpc.php?r=blog/article&uid=190176&id=4234854 一 前言 当管理大量连接时,特别是只有少量活跃连接,NGINX有比较好的CPU和RAM利用率,如今是多终端保持在线的时代,更能让NGINX发挥这个优点。本文做一个简单测试,NGINX在一个普通PC虚拟机上维护100k的HTTP

TL-Tomcat中长连接的底层源码原理实现

长连接:浏览器告诉tomcat不要将请求关掉。  如果不是长连接,tomcat响应后会告诉浏览器把这个连接关掉。    tomcat中有一个缓冲区  如果发送大批量数据后 又不处理  那么会堆积缓冲区 后面的请求会越来越慢。

DBeaver 连接 MySQL 报错 Public Key Retrieval is not allowed

DBeaver 连接 MySQL 报错 Public Key Retrieval is not allowed 文章目录 DBeaver 连接 MySQL 报错 Public Key Retrieval is not allowed问题解决办法 问题 使用 DBeaver 连接 MySQL 数据库的时候, 一直报错下面的错误 Public Key Retrieval is

Github连接方式

打开Linux中git的配置文件: /home/username/git/MyRepository/.git/config [core]repositoryformatversion = 0filemode = truebare = falselogallrefupdates = true[remote "origin"]fetch = +refs/heads/*:refs/remot

ora-01017 ora-02063 database link,oracle11.2g通过dblink连接oracle11.2g

错误图示: 问题解决 All database links, whether public or private, need username/password of the remote/target database. Public db links are accessible by all accounts on the local database, while private