ORALCE的段管理简单说明

简介: 一、高水位线的说明To manage space, Oracle Database tracks the state of blocks in the segment. The high water mark (HWM) is the point in a segment beyond which data blocks are unformatted and have never been used. 为了管理表空间,ORACLEG跟踪块在段中的状态,这个HWM是一个标记,用来说明已经有多少没有使用的数据块分配给这个segment。

一、高水位线的说明

To manage space, Oracle Database tracks the state of blocks in the segment. The high water mark (HWM) is the point in a segment beyond which data blocks are unformatted and have never been used. 为了管理表空间,ORACLEG跟踪块在段中的状态,这个HWM是一个标记,用来说明已经有多少没有使用的数据块分配给这个segment。说明:HWM通常增长的幅度为一次5个数据块,原则上HWM只会增大,不会缩小,即使将表中的数据全部删除,HWM还是为原值,由于这个特点,使HWM很象一个水库的历史最高水位,这也就是HWM的原始含义,当然不能说一个水库没水了,就说该水库的历史最高水位为0。

二、段管理的演变

1、MSSM uses free lists to manage segment space. At table creation, no blocks in the segment are formatted. When a session first inserts rows into the table, the database searches the free list for usable blocks. If the database finds no usable blocks, then it preformats a group of blocks, places them on the free list, and begins inserting data into the blocks. In MSSM, a full table scan reads all blocks below the HWM.

早期数据库的段管理方式:早期ORACLE通过MSSM(Manual Segment Space Management),这种管理方式所有的segment的分配都是统一由数据库的一个free list来进行管理的(可以简单理解为中央集权制),这中段的管理方式效率慢,所以后面就被淘汰了。但是数据库为了向下兼容,11g的时候在创建表空间的时候,还可以选择MSSM的方式进行管理表空间,但是请不要使用;

 

2、ASSM does not use free lists and so must manage space differently. When a session first inserts data into a table, the database formats a single bitmap block instead of preformatting a group of blocks as in MSSM. The bitmap tracks the state of blocks in the segment, taking the place of the free list. The database uses the bitmap to find free blocks and then formats each block before filling it with data. ASSM spread out inserts among blocks to avoid concurrency issues.

从ORACLE 9I开始推出了新的表空间管理方式ASSM(Auto  Segment Space Management),创建段的时候首先创建一个位图,通过位图来跟踪或管理每个分配到对象的块,每个块有多少剩余空间根据位图的状态来确定。当FREELIST中不包含可插入数据块时 HWM默认每次上升5个数据块。

 

3、HWM和LOW HWM

Every data block in an ASSM segment is in one of the following states:

  • Above the HWM(高水位线之上)

    These blocks are unformatted and have never been used.(所有的块都是未格式化和使用的)

  • Below the HWM (高水位线之下)

    These blocks are in one of the following states:

    • Allocated, but currently unformatted and unused(已分配,但是未格式化且未使用)
    • Formatted and contain data(格式化并且有数据)
    • Formatted and empty because the data was deleted(格式化但是由于原先的数据被删除,所以是没数据的)

The low HWM is important in a full table scan. Because blocks below the HWM are formatted only when used, some blocks could be unformatted,. For this reason, the database reads the bitmap block to obtain the location of the low HWM. The database reads all  blocks up to the low HWM because they are known to be formatted, and then carefully reads only the formatted blocks between the low HWM and the HWM.

Assume that a new transaction inserts rows into the table, but the bitmap indicates that insufficient free space exists under the HWM. In Figure 12-26, the database advances the HWM to the right, allocating a new group of unformatted blocks.

三、总结

ASSM的引入进一步减轻了DBA的工作,但是如果一个表进行大量的删除以后,在做表的全表扫描就会以下问题,因为HWM和LHWM在插入数据时,当现有空间不足而进行空间的扩展时会向上移,但删除数据时不会往下移,所以问题就产生了.当用户发出一个全表扫描时,ORACLE 始终必须从段一直扫描到 HWM,即使它什么也没有发现。该任务延长了全表扫描的时间。

所以当一个表进行大量的删除之后,需要进行相应的收缩工作,从而保证了全表扫描的性能;

..........................................................................................................................................................................................................................本文作者:JOHN

ORACLE技术博客:ORACLE 猎人笔记               数据库技术群:367875324 (请备注ORACLE管理 )  

................................................................................................................................................................................................................................

相关文章
|
人工智能 数据可视化 搜索推荐
Katalist官网体验入口 生成式AI视觉故事板工具
【2月更文挑战第26天】Katalist官网体验入口 生成式AI视觉故事板工具
501 4
Katalist官网体验入口 生成式AI视觉故事板工具
|
编解码 内存技术
四款好用的免费直播编码推流软件
现代生活已经离不开互联网,离不开软件了。 这说法毫不夸张。 比如手机上各种APP眼花缭乱 ,各种行业, 各种功能, 各种Logo, 各种的各种。 没有良好的整理力,是真 的不好意思让别人看到啊。 这些功能各异的APP程序大多数是免费APP。
7538 0
|
XML 开发框架 前端开发
http请求响应的contentType
http请求响应的contentType
233 5
|
机器学习/深度学习 人工智能 自然语言处理
深度学习与CV教程(15) | 视觉模型可视化与可解释性
本文讲解了一些理解 CNN 可视化的方法(特征、滤波器可视化),以及一些有趣的应用,如DeepDream、图像神经风格迁移(特征反演 + 纹理生成)等【对应 CS231n Lecture 12】
19224 1
深度学习与CV教程(15) | 视觉模型可视化与可解释性
|
网络安全 开发者
[CTF/网络安全] 攻防世界 cookie 解题详析
题目描述:X老师告诉小宁他在cookie里放了些东西,小宁疑惑地想:这是夹心饼干的意思吗?
459 0
|
域名解析 缓存 负载均衡
linux【网络】DNS 解析时快时慢,我该怎么办?
linux【网络】DNS 解析时快时慢,我该怎么办?
linux【网络】DNS 解析时快时慢,我该怎么办?
|
物联网 API 开发者
3_2_AliOS Things 命令行介绍|学习笔记
快速学习3_2_AliOS Things 命令行介绍。
445 0
3_2_AliOS Things 命令行介绍|学习笔记
【琐琐碎碎小知识】Keil5软件 文件符号上带一个黄色的钥匙
【琐琐碎碎小知识】Keil5软件 文件符号上带一个黄色的钥匙
1552 0
【琐琐碎碎小知识】Keil5软件 文件符号上带一个黄色的钥匙
|
小程序 前端开发 JavaScript
【微信小程序 | 实战开发】开发环境、测试环境和生产环境
【微信小程序 | 实战开发】开发环境、测试环境和生产环境
1467 0
【微信小程序 | 实战开发】开发环境、测试环境和生产环境
|
编解码 前端开发 算法
激光slam:LeGO-LOAM---代码编译安装与gazebo测试
LeGO-LOAM 的英文全称是 **lightweight and ground optimized lidar odometry and mapping**。轻量化具有地面优化的激光雷达里程计和建图 ![在这里插入图片描述](https://img-blog.csdnimg.cn/eea194f4d9a6426d9231e310ec18c37c.png) 其框架如下,大体和LOAM是一致的 ![在这里插入图片描述](https://img-blog.csdnimg.cn/29f5f9ee21544be48aad35b99f6b4e27.png) LeGO-LOAM是基于LOAM的改进版本
激光slam:LeGO-LOAM---代码编译安装与gazebo测试