Database and Table Size properies?

Mar 15, 2011 at 2:58 AM

Any chance that you might add a Size property for the Database and Tables to show how many bytes of storage they are taking up?

You already added one method for me today, hope I'm not pushing my luck :-)

Mar 15, 2011 at 11:34 PM

Maybe :-)

What is the use case you are trying to cover?  Typically you do not need to worry about sizes of files on disk.

Mar 16, 2011 at 5:00 AM

I have zip files that contain a bunch of images and users download them to their phones.  Once downloaded the images are extracted and stored into a new database.   After a while there could be quite a few dbs and it would be nice to show the user how much space each one is taking up so they can decide if they want to delete them and reclaim the space.

Mar 16, 2011 at 10:46 AM

I am not sure if you want to store the images in the DB.  This came up before, and my suggestion was to just store them in isolated storage as files and just store file names in DB.  You will greatly improve performance this was, especially if images are large.  You can write a converter that would create an image from file name at the time of data binding.  Also, there is not reason to worry about size of files unless you get into dozens of MBs.  Is this the case for you?  Do your users really end up with that many files?  Also, if you pursue the strategy I am suggesting, DB file sizes will be irrelevent. 

Also, I wonder if a feature to store images in separate files similarly to FILESTEREAM feature in SQL Server 2008 would be useful instead?  Then we could compute total sizes of each table.

Mar 16, 2011 at 6:32 PM

The images are small, so I haven't seen any performance issues yet (and thats why each zip becomes a seperate DB).  I've only tested on the emulator so hopefully its not an issue on the real hardware.  I allow the users to delete the database when they are done with it so displaying the size might influence which ones they decide to delete ( I know it would for me).  

This isn't a critical feature,  I just thought it would be more accurate and convienent if the database and tables had a Size property.  Currently I calculate the size of the DB by adding up the size of the images, but its not 100% accurate as there are other things in the database. 


Each Table is a single file that is stored in IsolatedStorate, Right?  So couldn't the size be calculated based on tableStream.Length property?


Mar 17, 2011 at 1:15 AM

Yep, indeed.  I added the feature to the Issue Tracker page.