码迷,mamicode.com
首页 > 其他好文 > 详细

allocation Unit 理解

时间:2015-12-04 20:52:19      阅读:400      评论:0      收藏:0      [点我收藏+]

标签:

Hobt_id和Partition_id这两个字段的值是相同的,每一个分区都有一个ID值,这个值是Partition_id。在每一个partition中,最多有三个allocation unit,type分别是 in_row, Lob, row_overflow。每一个allocation unit 都含有很多data page,存储data和index。

Allocation Unit 可以理解为partition的单一data pages的集合。

 

Each parition can have three types of rows, each stored on its own set of pages.

These types are called in-row data pages, row-overflow data pages and LOB data pages.

A set of pages of one particular type for one particular partition is called an allocation unit.

Each heap or index on each partition can have as many as three allocation units.

 

示例图

 技术分享

Sql server 提供两个视图用于查看 allocation unit。

1,sys.allocation_units

Contains a row for each allocation unit in the database.

Column name

Data type

Description

allocation_unit_id

bigint

ID of the allocation unit. Is unique within a database.

type

tinyint

Type of allocation unit:

0 = Dropped

1 = In-row data (all data types, except LOB data types)

2 = Large object (LOB) data (text, ntext, image, xml, large value types, and CLR user-defined types)

3 = Row-overflow data

type_desc

nvarchar(60)

Description of the allocation unit type:

  • DROPPED

  • IN_ROW_DATA

  • LOB_DATA

  • ROW_OVERFLOW_DATA

container_id

bigint

ID of the storage container associated with the allocation unit.

If type = 1 or 3, container_id = sys.partitions.hobt_id.

If type is 2, then container_id = sys.partitions.partition_id.

0 = Allocation unit marked for deferred drop

data_space_id

int

ID of the filegroup in which this allocation unit resides.

total_pages

bigint

Total number of pages allocated or reserved by this allocation unit.

used_pages

bigint

Number of total pages actually in use.

data_pages

bigint

Number of used pages that have:

  • In-row data

  • LOB data

  • Row-overflow data

Value returned excludes internal index pages and allocation-management pages.

 

When you drop or rebuild large indexes, or drop or truncate large tables, the Database Engine defers the actual page deallocations, and their associated locks, until after the transaction commits. Deferred drop operations do not release allocated space immediately. Therefore, the values returned by sys.allocation_units immediately after dropping or truncating a large object may not reflect the actual disk space available.

 

2,sys.system_internals_allocation_units

比 sys.allocation_units 多三个column:first page,root page 和 first iam page

技术分享

sys.system_internals_allocation_units 系统视图保留为仅供 Microsoft SQL Server 内部使用。

 

参考文档:

https://technet.microsoft.com/zh-cn/library/ms189051(v=sql.105).aspx

https://msdn.microsoft.com/en-us/library/ms189792.aspx

allocation Unit 理解

标签:

原文地址:http://www.cnblogs.com/ljhdo/p/5016067.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!