NONE: Implements no compression for the table.
ROW: Implements only row compression for the table.
PAGE: Implements row and page compression for the table.
In this scenario, DBA/Developer could create the SalaryAudit table with page-level compression using the following statement:
CREATE TABLE Salary Audit
(ID int PRIMARY KEY, EmpID int, LastName varchar(35),
FirstName varchar(25), DeptName varchar(30),OldAmt money, NewAmt money, UpdDate datetime,UpdID int)
WITH (DATA_COMPRESSION
= PAGE);
DBA/Developer
can also alter an existing table to use data compression. For example, DBA/Developer
could use the following statement to modify a previously created table, Table1,
to use row compression:ALTER TABLE Table1
REBUILD WITH (DATA_COMPRESSION=ROW);
DBA/Developer should note that compression requires additional overhead, especially if the table is frequently accessed or modified, because the data must be compressed and uncompressed when it is accessed or modified. Therefore, DBA/Developer should closely evaluate not only the storage requirements but also how the table is used before implementing compression. In this scenario, the data is written only once to the table when a salary update occurs, and is rarely queried. Therefore, the additional overhead would likely have no adverse effects. DBA/Developer should not use FILESTREAM storage and implement NTFS compression. FILESTREAM storage is implemented to store large binary objects, such as image or video files, as files on the file system and be able to manage them using Transact-SQL. FILESTREAM data can also be accessed using Win32 APIs. FILESTREAM storage is tightly integrated with most database functionality, including backup and recovery. When a DBA/Developer takes a database backup, FILESTREAM storage is also backed up unless DBA/Developer override this functionality by performing a partial backup. To create a table that can store FILESTREAM data, DBA/Developer creates a table that contains a column of the varbinary(max) data type and include the FILESTREAM attribute. DBA/Developer cannot implement column-level compression for the table because column-level compression is not a compression strategy supported by SQL Server. SQL Server can implement compression at the row or page levels only. DBA/Developer should not set the PERSISTED property for the EmpID, LastName, FirstName, and UpdID columns. The PERSISTED property is only applicable to computed columns, which are not used in this scenario. Computed columns are virtual columns that by default are not physically stored in the table. Each computed column uses the AS keyword, followed by an expression that evaluates to a value. The expression can contain constants, functions, operators, and references to other columns within the table. The value of the computed column is calculated each time a query references it executes. Computed columns that specify the PERSISTED property are physically stored in the table and recalculated each time a column value referenced in the calculation expression is changed.
No comments:
Post a Comment