开发者

Can I reasonably use Dictionary(of Integer, Structure) instead of a RDBMS database?

开发者 https://www.devze.com 2023-01-25 21:50 出处:网络
I\'m currently developing a project that will use one small table (say less than 10 Megabytes in total) on one PC for one user at a time. (But of course will be installed on many computers).

I'm currently developing a project that will use one small table (say less than 10 Megabytes in total) on one PC for one user at a time. (But of course will be installed on many computers).

I say small because 10 MB looks like 1/300th of the current available RAM on my PC (!)

In that table I will store XML Document shaped strings or elements of each 2 开发者_Go百科to 4 Kbytes.

Trying to avoid the huge overhead and difficult installation process of a RDBMS, my question is:

Is it reasonable to run the table as a dictionary (Key, Value) where I will create, update, and delete items and against which I shall perform LINQ queries?

Will the load (deserialization) time be comparable to the time needed to connect to say a SQL Server compact edition database?

Will I be able to LINQ Query the value part of the items with something like:

Dim Results = from r in myDictionnary
              where r.Value like "*mySearchString*"
              Select r

for each aChunk in Results

    dim xChunk as xElement = xElement.parse(aChunk)
    etc...

next

Any clue highly appreciated. Thanks in advance


The dictionary should work fine. Linq queries will work also.

If it gets any more complicated than a single table, I would consider an embedded database like MySql or SQL server compact.


This solution will work well, and load time should be almost instantaneous. 10 MB just isn't very much data these days, so read time will be very small and deserializing the XML will be very fast.

Understand, though, that an in-memory database will lack some of the benefits you get with an RDBMS or noSQL solution. Most importantly, changes to the database aren't persisted until the user closes the program or saves the database. If the program crashes or the system loses power, all changes that were made to the in-memory database since the last save will be lost.

Obviously, that's not an issue if the "table" is read-only.

0

精彩评论

暂无评论...
验证码 换一张
取 消