Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Compressing varchar fields

Author  Topic 

GustiX
Starting Member

28 Posts

Posted - 2010-03-03 : 06:41:24
Hi

I am using SQL Server 2008 Standard so I can't use
the built in page/row compression mechanism.

Is there no way to compress varchar(max) fields
(or blobs) directly like:

update table set x = compress(x)

Is there no compression function?

haroon2k9
Constraint Violating Yak Guru

328 Posts

Posted - 2010-03-03 : 06:57:24
quote:
Originally posted by GustiX

Hi

I am using SQL Server 2008 Standard so I can't use
the built in page/row compression mechanism.

Is there no way to compress varchar(max) fields
(or blobs) directly like:

update table set x = compress(x)

Is there no compression function?



could you please check out this thread..
http://www.sql-server-performance.com/articles/dba/Data_Compression_in_SQL_Server_2008_p2.aspx
Go to Top of Page

GustiX
Starting Member

28 Posts

Posted - 2010-03-03 : 09:22:52
quote:
Originally posted by GustiX


I am using SQL Server 2008 Standard so I can't use
the built in page/row compression mechanism.



Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2010-03-03 : 10:58:26
why would you want to do this? Storage is cheap (comparatively)

Performance is expensive. Sounds like you want to do cell level compression.

You could probably write a CLR function that implements zlib or some other compression routine and store the result as a varbinary or similar. However, this would mean that any fetches would have to be inflated. Also you couldn't directly query the field directly.


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

GustiX
Starting Member

28 Posts

Posted - 2010-03-04 : 05:12:17
This field we need to compress is only used once when the record is "processed" so performance is not
the problem. This field is never used in queries. The problem is that this field takes up about 60-70%
of the space in the database so if I can reduce it to 1/3 it would be very good.

I was hoping we could avoid writing a custom compression function...
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2010-03-04 : 05:35:28
why not store it as a file somewhere and instead keep the location of the file in that cell? Then change the app to go get the file based on the value in the cell rather than deliver the <whatever it is> directly.

Then you can use whatever compression method you like


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -