SQL SERVER 2005 页面文件头部结构
Next up in the Inside the Storage Engine series is a discussion of page structure. Pages exist to store records. A database page is an 8192-byte (8KB) chunk of a database data file. They are aligned on 8KB boundaries within the data files, starting at byte-offset 0 in the file.
Here's a picture of the basic structure
Header
The page header is 96 bytes long. What I'd like to do in this section is take an example page header dump from DBCC PAGE and explain what all the fields mean. I'm using the database from the page split post and I've snipped off the rest of the DBCC PAGE output.
DBCC
TRACEON (3604)DBCC
PAGE ('pagesplittest', 1, 143, 1);GO
m_pageId = (1:143) m_headerVersion = 1 m_type = 1
m_typeFlagBits = 0x4 m_level = 0 m_flagBits = 0x200
m_objId (AllocUnitId.idObj) = 68 m_indexId (AllocUnitId.idInd) = 256
Metadata: AllocUnitId = 72057594042384384
Metadata: PartitionId = 72057594038386688 Metadata: IndexId = 1
Metadata: ObjectId = 2073058421 m_prevPage = (0:0) &
相关文档:
USE master
GO
CREATE DATABASE testbase2
ON
PRIMARY
(NAME = prim_sub_dat1,
FILENAME = 'G:\SQL SERVER2000\prim_sub_dat.mdf',
SIZE = 5MB,
MAXSIZE = 50MB,
FILEGROWTH = 20%),
(NAME = prim_sub_dat2,
FILENAME = 'G:\SQL SERVER2000\prim_sub_dat.ndf'
SIZE = 5MB,
MAXSIZE = 50MB,
......
首先我建好了一张用户表表中有俩个字段 一个是账号,一个是密码当然这里我写的知识简单的登录很注册,
表明 users 用户表
字段 accountnum varchar(50) --表示账号
password varchar(50) --表示密码
登录存储过程
create proc use_l ......
Sample1:
/* Variable Declaration */
DECLARE @EmpID AS SMALLINT
DECLARE @SQLQuery AS NVARCHAR(500)
/* Build and Execute a Transact-SQL String with a single parameter value Using EXECUTE Command */
SET @EmpID = 1001
SET @SQLQuery = 'SELECT * from tblEmployees WHERE EmployeeID = ' + CAST(@EmpID A ......
与持久表一样,优化器创建并维护临时表的分布统计信息,并跟踪它的基数。当索引临时表时,这种能力尤其重要。当优化器需要评估选择性时,它就可以根据这些分布统计信息生成经过优化的计划。这是临时表在性能方面不同于表变量的主要特性之一。
此外,因为临时表会维护统计信息,如果上次编译后被引用表有足够多的行发 ......