Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDaoDatabase Huge Trouble

Status
Not open for further replies.

Nosferatu

Programmer
Jun 9, 2000
412
RO
Hello...
First of all, I am not sure if this is not a FAQ, but even if it is, please bare with me.

I have little experience with database code and I can't figure out why the database I am constructing is getting so darn huge.
I use CDaoDatabase to manipulate the data and SQL queries to add data.
There are only 3 tables defined so far, one of which contains about 1000 records. However, the database is huge, in my opinion: 700K!!!

Obviously, I am missing something here, can anybody point me into the right direction?

TIA...
[red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
Do you try to compact it every once in a while?
Greetings,
Rick
 
No. I don't. Actually, I am really puzzled about the huge sparsity of the file, if I can say so. Huge chunks of 0s are all over the file and no empty records are added. (actually, the total number of records is precisely 1000).

But I was thinking that I won't have to compact the database each and every time something gets written into it.
Seems that I am wrong...

But anyway, how would I do that with DaoDatabase? As I said before, I have little experience with databases, so any help is appreciated.

Thanks [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
700K/1000=700 bytes per record - it is quite few, assuming all that stuff like trailing zeroes, indexes, etc. I have no idea about CDaoDatabase, but compressing of .MDB files is possible using MS Access. The steady growing up data files are one of the worst features of .MDB.

 
I am totally confused...
700 bytes per record which contains 2 columns (a date-time and a double) is still huge...

But anyway, I erased the old database and re-constructed it, this time with 2000 records. And the size now is 185K...

I'm totally lost.

And, using Access to compact it is not an option. The database is available separately from Access (no drivers needed, no ODBC). [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
Correction: 4000 records, all added in the absolute same manner, no changes into the code.
I don't get it... Maybe it is just me [mad] [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
Try to create a MS Word document with single line "Hello world!", how big do you estimate would be the .doc file? :) Database files generally are many times les thrifty in storage resources in comparison with text documents.

If you want small data files, try MS ODBC driver of text files. I have no idea what it is, but the name sounds well. The data files must be in this case simply plain text files, sort & search capabilities - as slow as possible. :)

The compression in point of view of MS Access is creation of new empty database with the same structure and transfer of old data to that database. Such a tool you can write, I think, using the CDaoDatabase as well.

The size of .MDB files grows more essentially during creating and deleting of records, also running queries with big amount of temporary output data. Simply editing of fields of existing records increases size of database less significant.
 
You can compact the database with the CDAOWorkspace::CompactDatabase method (a pointer to this object is in the m_pWorkspace member of your database object.

I don't know if there's much deletion and updating being done in the tables of your DB, but those are the kind of actions that have a DB grow (the data isn't really deleted, it's just "freed" or something like that). Don't know exactly how MDBs manage that, but when compacting a database "marked for free data" or whatever its called or however its maintained, actually gets freed.
Greetings,
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top