Sql-server – An mdf file of a Sql server 2008 database is bigger than expected

filestreamsql serversql-server-2008

I have a Sql server 2008 database that contains many images. In theory they should make up most of the space on the database.

I moved the images to Filestrem fields but the size of the mdf didn't decrease much at all.
How is that possible? How can I check what is taking up all this space inside the mdf file?
I tried to shrink the mdf file keeping some free space for growth but it wouldn't do much.
I am tring to keep the size low enough to be able to keep the mdf file in the faster C hard drive.

I also expected that the Filestream folder would take some more space than it currently does.

Size before the Filestream implementation:

mdf -> 40Gb or less
ldf -> raughly 90Gb

Current size:

mdf -> 39Gb
ldf -> 119Gb
Filestream folder -> 7.8Gb

Best Answer

I moved the images to Filestrem fields but the size of the mdf didn't decrease much at all. How is that possible?

Because file shrinks are not something that magically happens. It happens when you tell sql server to try to shring it. THere is also the point that blog data is slowly discarded - at a quite low rate. Can take a while for large data.

I am tring to keep the size low enough to be able to keep the mdf file in the faster C hard drive.

That makes me cringe, as long as C is not an SSD ;)

I also expected that the Filestream folder would take some more space than it currently does.

Why?

Or: un a report and find out wha the heck takes space. Maybe you overlooked something? If you expect a lot more data than filestream now has, maybe you di d not move all the data? I would run a report to see what usesu p the space -they are avaiable as standard report in management studio.