CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2003
    Posts
    91

    Which is faster Database or Serialization?

    Hi,

    I am writing an application that will be storing 10's of thousands of records. I am wondering what would be faster in terms of searching for records, using serialization or using an Access 2000 database?

    I know that access 2000 sucks and that is why I am thinking of using object serialization to store my records versus an access 2000 database. My database structure is very simple and there is no relational data at all.

    The only thing I am worried about is the record searching. If I have 40,000 records in a CObject array and have to loop through the array to find the record with a MediaID of 3564, would that be just as quick as a "SELECT MediaID FROM tblMedia WHERE MediaID = 3546" ?

    If so I will use serialization instead.

    Any thoughts or guidence on this would be much appreciated! Thanks

  2. #2
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815

    Re: Which is faster Database or Serialization?

    Quote Originally Posted by revg75
    The only thing I am worried about is the record searching. If I have 40,000 records in a CObject array and have to loop through the array to find the record with a MediaID of 3564, would that be just as quick as a "SELECT MediaID FROM tblMedia WHERE MediaID = 3546" ?
    That depends on many things - however, it is almost sure that a linear search over 40000 records (even if in memory) will be slower than a database query (which uses highly optimized indexing techniques). But if you use a map (CMap is implemented as a hash table) instead of a linear search in an array, things will change dramatically. Another thing to consider, apart from search times, is memory requirements. 40000 records in memory can mean a lot of space - and that's another reason why databases are used in the first place.

  3. #3
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Which is faster Database or Serialization?

    If your array is sorted, a binary search would be faster than a database. For unsorted data, a properly indexed database would likely be quicker. If the database is on a slow server even an unsorted array may be faster as it's all in RAM, so it's not possible to answer definitively.

    Access 2000 doesn't suck if you only have one user or infrequent updates. Its biggest limitation is its locking doesn't support concurrent updates very well.

  4. #4
    Join Date
    Jun 2003
    Posts
    91

    Re: Which is faster Database or Serialization?

    Ok, well it sounds like I should stick with the access 2000 database since I already have all the code written. it would be a rather large undertaking to switch it over to serialization.

    I guess my biggest problem with Access 2000 is the fact that there is no documents that I can find that tell me what I need to include in the installation in order to make sure the client machine has all the necessary components for access to run properly.

    I know it needs to make sure the machine has DAO 3.6, Jet 4.0 service pack 8, and I think that's all it needs. however, somtimes the access database gets corrupt. Anyone have any tips I can use to make sure I install all the necessary requirements for an MFC application using an Access 2000 database? Is there some all in one package I can include in my installer to make sure the client machine has all the stuff it needs?

    Thanks

  5. #5
    Join Date
    Mar 2001
    Posts
    2,529

    Re: Which is faster Database or Serialization?

    How many users are there on the system?

    ahoodin

  6. #6
    Join Date
    Jun 2003
    Posts
    91

    Re: Which is faster Database or Serialization?

    There will only ever be 1 user on the system maximum ever. It is a single user application.

    Cheers,
    greg

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured