473,406 Members | 2,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

compressing data stored in a database

Hi all,

My application uses a database to store big blobs (0.5 - 1 Gb). I have
a List of a class Sample that I store in a blob. Since the blob can
become very big I want to use compression.

The class Sample contains a lot of properties. When I store the List
of samples only a few of the properties are used. Does it makes sense
to make a class sampleSimple that only contains the properties I use
for database storage and thus save storage space?

Is it possible to first compress the blob and then store it in the
database? Does .NET provides such functionality?

Many thanks in advance.

Stijn

Aug 20 '07 #1
5 2074
Tarscher wrote:
[...]
The class Sample contains a lot of properties. When I store the List
of samples only a few of the properties are used. Does it makes sense
to make a class sampleSimple that only contains the properties I use
for database storage and thus save storage space?
I would say so. Though, my first thought would be to try to understand
better why you are using a class that has many more properties than you
consider essential for saving.

Also, I admit I don't really get the "blob" stuff -- outside my database
use experience -- but if it's anything like the regular serialization
stuff, you should be able to suppress serialization of specific
properties without creating a whole new class (there's an attribute that
does this per-property).
Is it possible to first compress the blob and then store it in the
database? Does .NET provides such functionality?
Depends on how you are creating the blob. If the mechanism involves
getting a MemoryStream, byte array or similar binary representation of
the data, then you can probably use the GzipStream class to compress the
data before you store it in the database.

Pete
Aug 20 '07 #2
Peter Duniho <Np*********@NnOwSlPiAnMk.comwrote in news:13cihm9ip5mpje4
@corp.supernews.com:

<snip>
Depends on how you are creating the blob. If the mechanism involves
getting a MemoryStream, byte array or similar binary representation of
the data, then you can probably use the GzipStream class to compress the
data before you store it in the database.
Note also that some databases can be configured to automatically compress &
decompress data.
Aug 20 '07 #3
Tarcher,

If your blob is used for images, than AFAIK you can spare the time. Most
image types are so optimalized that compressing can even result in some
extra bytes.

Cor

"Tarscher" <ta******@gmail.comschreef in bericht
news:11**********************@19g2000hsx.googlegro ups.com...
Hi all,

My application uses a database to store big blobs (0.5 - 1 Gb). I have
a List of a class Sample that I store in a blob. Since the blob can
become very big I want to use compression.

The class Sample contains a lot of properties. When I store the List
of samples only a few of the properties are used. Does it makes sense
to make a class sampleSimple that only contains the properties I use
for database storage and thus save storage space?

Is it possible to first compress the blob and then store it in the
database? Does .NET provides such functionality?

Many thanks in advance.

Stijn

Aug 20 '07 #4
On Mon, 20 Aug 2007 00:22:17 -0700, Tarscher <ta******@gmail.com>
wrote:
>Hi all,

My application uses a database to store big blobs (0.5 - 1 Gb). I have
a List of a class Sample that I store in a blob. Since the blob can
become very big I want to use compression.

The class Sample contains a lot of properties. When I store the List
of samples only a few of the properties are used. Does it makes sense
to make a class sampleSimple that only contains the properties I use
for database storage and thus save storage space?

Is it possible to first compress the blob and then store it in the
database? Does .NET provides such functionality?

Many thanks in advance.

Stijn
Well, first you might want to rethink your class design. If there are
so many properties that are not necessary for persistence, any
particular reason why they're there?

Also, like Cor has said, for some types of data like MP3, Image, Video
etc you are unlikely to get much savings from additional compression.
What sort of data are you storing in the blob?

--
http://bytes.thinkersroom.com
Aug 20 '07 #5
On 20 aug, 14:30, "Rad [Visual C# MVP]" <r...@nospam.comwrote:
On Mon, 20 Aug 2007 00:22:17 -0700,Tarscher<tarsc...@gmail.com>
wrote:
Hi all,
My application uses a database to store big blobs (0.5 - 1 Gb). I have
a List of a class Sample that I store in a blob. Since the blob can
become very big I want to use compression.
The class Sample contains a lot of properties. When I store the List
of samples only a few of the properties are used. Does it makes sense
to make a class sampleSimple that only contains the properties I use
for database storage and thus save storage space?
Is it possible to first compress the blob and then store it in the
database? Does .NET provides such functionality?
Many thanks in advance.
Stijn

Well, first you might want to rethink your class design. If there are
so many properties that are not necessary for persistence, any
particular reason why they're there?

Also, like Cor has said, for some types of data like MP3, Image, Video
etc you are unlikely to get much savings from additional compression.
What sort of data are you storing in the blob?

--http://bytes.thinkersroom.com
many thanks for all the replies.

There aren't actually that many properties but (4 in total) of which I
use 3 when stored in the database. Since I store a large number of
objects I think every byte I can save in serialization process will
eventuelly add up to the savings.

My object contains a string, an integer and a double. I create a list
of the object with about 1 million objects. This data I thus want to
compress
Aug 20 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Jerry Weinstein | last post by:
Hi, I know about stored procedures and that they can speed up data entry via the SQL 'insert ' statement. However, one drawback to this method is that using the stored procedure still requires...
6
by: Junkmail | last post by:
I have an application with highly compressable strings (gzip encoding usually does somewhere between 20-50X reduction.) My base 350MB database is mostly made up of these slowly (or even static)...
10
by: Dennis Farr | last post by:
It has been suggested that rather than convert an already large flat file, with many similar rows, to XML, some type of header be attached to the file, containing some sort of meta-XML description...
0
by: Yuancai \(Charlie\) Ye | last post by:
Hi, All: I am happy to annouce that we have formally released our latest SocketPro version 4 at www.udaparts.com, an advanced remoting framework written from batching/queue, asynchrony and...
0
by: sedefo | last post by:
I ran into this Microsoft Patterns & Practices Enterprise Library while i was researching how i can write a database independent data access layer. In my company we already use Data Access...
16
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For...
2
by: Jarry | last post by:
I am a bit new to VB, and I have set up a program which loads a large text file. The text file (.txt) has a file size of around 6 megabytes. This is the figure I would like to rreduce. I have...
12
by: jimdan | last post by:
I have a ms access database that I have split into a front and backend database. After the user enters data into the database (stored in the backend), the DB grows to about 50 MB. The user then...
4
by: Scott M. | last post by:
When profile data is stored in ASP .NET, where is the user data persisted? For how long is it persisted: is it session persisted or permanent (like a cookie)?
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.