SQL Server 2008的新压缩特性
关于 SQL Server压缩 的故事,最早是从SQL Server 2005开始的,在企业版和开发版中增加了一种叫做vardecimal的新存储格式,这个表级的选项会影响到decimal和numeric字段。当对值的精度要求低于字段可用精度,如在一个decimal(18,9)类型的字段中存储1.5这个数
关于SQL Server压缩的故事,最早是从SQL Server 2005开始的,在企业版和开发版中增加了一种叫做vardecimal的新存储格式,这个表级的选项会影响到decimal和numeric字段。当对值的精度要求低于字段可用精度,如在一个decimal(18,9)类型的字段中存储1.5这个数值时,存储上就需要有相应的压缩。从效果上来看,它就是一个varchar类型的数字型版本。
SQL Server 2008所包含的已远不止这些小技巧,Chad Boyd写到 :
以下是引用片段: 无论从哪方面来看,SQL Server 2008的数据压缩都与现在有着巨大的差异(尽管它依然支持或者说包括vardecimal类型)――引起这种差异的真像是,如果你对一个给定的table/index启用压缩功能,那么底层的row/page格式将不再相同――是的,就是这样,你听得没错――如果你使用压缩(ROW或者PAGE),那么SQL 2008的row/page格式将不同于现有的格式(如果你只是在table/index上使用压缩的话)。因此,在SQL 2008中,有两种,没错,是两种可选row/page数据格式。你现在可能会想知道“那么,如果row/page格式改变了,那你们究竟是如何在这么短的时间内,依然有足够的时间去重新生成SQL Server所有需要识别这些格式的组件的呢?”答案就是我们不需要那样做――因为Storage Engine是SQL 2008中唯一一个需要知道新的row/page格式的组件。 |
行级压缩将大幅减少元数据所需的变量长度,较以前每个字段需要花费2个字节来存储,现在只要仅仅3个位。字段本身现在也变得更小,在整型字段中存储像1这样的数值,只需要一个字节,而大数值则最多只需要4个字节。
行级压缩则允许在行间共享共有数据。Chad首先谈到的两种技术就是列前缀和页字典:
假设你在一页的数据行中有一列数据有这些值:‘Chad’、‘Chadwick’、‘Chadly’、‘Chad’、‘Chadster’、‘Chadwick’和‘Chadly’(故意重复的数值)――正如你所见,有相当多的冗余‘前缀’数据在这一页的同一列的不同行中,是吧?因此,你最终可能会想到这样的一个场景:将列的前缀‘Chad’存储在CI结构中,每一个列的最后都指向这个前缀值,最后出现在磁盘上的值会像这样:‘’,‘1wick’,‘1ly’,‘1ster’,‘1wick’和‘1ly’。
所以,对于上述例子中的含有Chad的同列数值,在经过对“列前缀”值进行计算和存储后,你可能得到一个会含有如‘1ly’和‘1wick’这些值的页字典,而真正行内数值则极有可能看上去像这样:‘’、‘2’、‘3’、‘’、‘1ster’、‘3’和‘2’。通过这种方式,我们让原本需要大约25个字节来存储的行数据,减少到只要大约17个字节来存储,节省30%以上。
每一个页都是单独压缩的,前缀和字典也存储在页内。由于页是存储分配的原子单位,将半页压缩到四分之一页是没有任何意义的,所以,只有在页的内容快满的时候才会开始压缩处理。
在使用行和页压缩时还有一个性能权衡问题,因为CPU使用率会上升,但I/O使用率和内存占用会下降。
Backup Compression是2008的另一个特性,它是通过普通的文件系统型压缩技术实现的,对于给定的数据库,只有启用或者禁用,没有其它可调节选项。
尽管非企业版服务器可以恢复带压缩的备份,但这所有的压缩选项极有可能成为企业版专享选项。
查看英文原文:New Compression Features in SQL Server 2008
精彩推荐
|
SQL Server 2008 功能、特性介绍 |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

HQL and SQL are compared in the Hibernate framework: HQL (1. Object-oriented syntax, 2. Database-independent queries, 3. Type safety), while SQL directly operates the database (1. Database-independent standards, 2. Complex executable queries and data manipulation).

"Usage of Division Operation in OracleSQL" In OracleSQL, division operation is one of the common mathematical operations. During data query and processing, division operations can help us calculate the ratio between fields or derive the logical relationship between specific values. This article will introduce the usage of division operation in OracleSQL and provide specific code examples. 1. Two ways of division operations in OracleSQL In OracleSQL, division operations can be performed in two different ways.

Oracle and DB2 are two commonly used relational database management systems, each of which has its own unique SQL syntax and characteristics. This article will compare and differ between the SQL syntax of Oracle and DB2, and provide specific code examples. Database connection In Oracle, use the following statement to connect to the database: CONNECTusername/password@database. In DB2, the statement to connect to the database is as follows: CONNECTTOdataba

Interpretation of MyBatis dynamic SQL tags: Detailed explanation of Set tag usage MyBatis is an excellent persistence layer framework. It provides a wealth of dynamic SQL tags and can flexibly construct database operation statements. Among them, the Set tag is used to generate the SET clause in the UPDATE statement, which is very commonly used in update operations. This article will explain in detail the usage of the Set tag in MyBatis and demonstrate its functionality through specific code examples. What is Set tag Set tag is used in MyBati

I found that the compressed package downloaded from a download website will be larger than the original compressed package after decompression. The difference is tens of Kb for a small one and several dozen Mb for a large one. If it is uploaded to a cloud disk or paid space, it does not matter if the file is small. , if there are many files, the storage cost will be greatly increased. I studied it specifically and can learn from it if necessary. Compression level: 9-Extreme compression Dictionary size: 256 or 384, the more compressed the dictionary, the slower it is. The compression rate difference is larger before 256MB, and there is no difference in compression rate after 384MB. Word size: maximum 273 Parameters: f=BCJ2, test and add parameter compression rate will be higher

Solution: 1. Check whether the logged-in user has sufficient permissions to access or operate the database, and ensure that the user has the correct permissions; 2. Check whether the account of the SQL Server service has permission to access the specified file or folder, and ensure that the account Have sufficient permissions to read and write the file or folder; 3. Check whether the specified database file has been opened or locked by other processes, try to close or release the file, and rerun the query; 4. Try as administrator Run Management Studio as etc.

WindowsServerBackup is a function that comes with the WindowsServer operating system, designed to help users protect important data and system configurations, and provide complete backup and recovery solutions for small, medium and enterprise-level enterprises. Only users running Server2022 and higher can use this feature. In this article, we will explain how to install, uninstall or reset WindowsServerBackup. How to Reset Windows Server Backup If you are experiencing problems with your server backup, the backup is taking too long, or you are unable to access stored files, then you may consider resetting your Windows Server backup settings. To reset Windows

Database technology competition: What are the differences between Oracle and SQL? In the database field, Oracle and SQL Server are two highly respected relational database management systems. Although they both belong to the category of relational databases, there are many differences between them. In this article, we will delve into the differences between Oracle and SQL Server, as well as their features and advantages in practical applications. First of all, there are differences in syntax between Oracle and SQL Server.
