SQL Server 2008新特性-数据压缩
数据压缩(Data Compression)是SQL Server 2008引入的新特性之一,这项技术使数据更有效的保存并且极大减少了存储开销,同时也带来了性能上的显著提高,尤其是对需要大量磁盘I/O的数据仓库。
注:其实在SQL Server 2005 SP2版本中,已经引入了 vardecimal ,它使用变长的格式存储定长的decimal和numberic数据。
SQL Server 2008支持两种数据压缩:行压缩(Row Compression)和页面压缩(Page Compression)。
数据压缩仅在企业版和开发版中可用。
行压缩将定长的字段以变长的物理空间来存储,从而节省了存储空间。
例如,定长的字段char(100)中存储“SQL Server 2008”只需要15字符的长度,而非100字符,从而节约了85%的空间,另外,对于0和null,将不占用存储空间。
行压缩下各类型数据的空间占用:
数据类型
是否影响
细节
tinyint
No
1 byte is the minimum storage needed.
smallint
Yes
If the value fits in 1 byte, only 1 byte will be used.
int
Yes
Uses only the bytes that are needed. For example, if a value can be stored in 1 byte, storage will take only 1 byte.
bigint
Yes
Uses only the bytes that are needed. For example, if a value can be stored in 1 byte, storage will take only 1 byte.
decimal
Yes
This storage is exactly same as the vardecimal storage format. For more information, see Storing Decimal Data As Variable Length.
numeric
Yes
This storage is exactly same as the vardecimal storage format. For more information, see Storing Decimal Data As Variable Length.
bit
Yes
The metadata overhead brings this to 4 bits.
smallmoney
Yes
Uses the integer data representation by using a 4-byte integer. Currency value is multiplied by 10000 and the resulting integer value is stored by removing any digits after the decimal point. This type has a storage optimization similar to that for integer types.
money
Yes
Uses the integer data representation by using an 8-byte integer. Currency value is multiplied by 10000 and the resulting integer value is stored by removing any digits after the decimal point. This type has a larger range than smallmoney. This type
相关文档:
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--每页显示记录条数
@currentpage int output,--第几页
@orderid nvarchar(50),--主键排序
@sort int,--排序方式,1表示升序,0表示降序排列
......
系统环境:Windows 7
软件环境:Visual C++ 2008 SP1 +SQL Server 2005
本次目的:编写一个航空管理系统
这是数据库课程设计的成果,虽然成绩不佳,但是作为我用VC++ 以来编写的最大程序还是传到网上,以供参考。用VC++ 做数据库设计并不容易,但也不是不可能。以下是我的程序界面,后面 ......
一.数据控制语句 (DML) 部分
1.Insert (往数据表里插入记录的语句)
Insert INTO 表名(字段名1, 字段名2, ……) VALUES ( 值1, 值2, ……);
&nb ......
在mysql中执行sql文件(如test.sql)的常用方法
为了方便,可以将mysql的安装路径下bin目录的地址放到环境变量PATH中,如;C:\Program Files\MySQL\MySQL Server 5.0\bin。这样在任意位置打开的命令行程序都能找到mysql.exe。
可以打开mysql命令行,也可以在命令行中通过mysql -u r ......