Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for ideas on storage of data on local disk

Tags:

c#

.net

I have a large amount of data stored in an XML file, 173 MB (4.6 million lines), that I have stored in my Windows Forms application's working directory. It is the result of writing a datatable to an XML file. The datatable was originaly populated from a query to a SQL server.

The reason that I have it stored locally rather than requesting it from the server is that the data request took upwards of 40 seconds and at times timed out and the data is static and will never change, moreover the user can be offline and still use the data.

Loading the file back into the data table takes 20-30 seconds. I am not too woried about the time that it took to load from disk as I let the user know that data is loading and to be patient. However I don't like the XML file format and I am looking for other ideas for disk storage.

The data table is only beng used as a middleman for the eventual population of a collection object. If you have sugestions I would like to hear them.

I am hoping to stay away from a database solution and lean towards a binary file approach. Below is my first attempt, but I get an out of memory exception:

byte[] b = null;

using (MemoryStream stream = new MemoryStream())
{
   BinaryFormatter bformatter = new BinaryFormatter();
   bformatter.Serialize(stream, timeData);
   b = stream.ToArray();
}

using (FileStream fileStream = new
   FileStream("brad.bin", FileMode.Create, FileAccess.Write))
{
   fileStream.Write(b, 0, b.Length);
}
like image 594
Brad Avatar asked Dec 18 '09 22:12

Brad


People also ask

Where is the data stored?

Data storage can occur on physical hard drives, disk drives, USB drives or virtually in the cloud. The important thing is that your files are backed up and easily available should your systems ever crash beyond repair.

What is database storage system and how it works?

Database storage structureAll the information in a database is organized and structured in database tables. These tables are stored on the hard disk of the database server. The database tables are usually divided into columns and rows, just like a regular graphic table.

What is data storage in DBMS?

In a relational database type, the data storage is usually in the form of tables, columns, rows, and their corresponding relationships. In other words, it is normally a structured system arranged in a way to allocate the required space for the contents and operations of the database.

How is data physically stored in a database?

Data elements within the database are stored in the form of simple tables. Tables are related if they contain common fields. 4. DBMS packages based on the relational model can link data elements from various tables to provide information to users.


1 Answers

I'd look at a compact (local) database such as SQL Server CE or SQLite. Databases are designed for exactly this.

like image 146
Joe Avatar answered Nov 02 '22 02:11

Joe