Getting rid of old data?

Discussions about CSEntry
Post Reply
Anne
Posts: 104
Joined: January 11th, 2012, 12:55 am

Getting rid of old data?

Post by Anne »

Hi,
I'm working on an app to collect prices for CPI, and of course I want to compare to the prices last month. Hence I have an external dictionary with a csdb file of the relevant data.
And each month, I want to get rid of the data that I don't need anynore. I can't just delete the datafile as it's already opened in the app, so I tried to loop through it using delcase on every observation before reading the new data from a tab separated file.
This work-ish, but I notice that the datafile grows despite the number of occurences stays approximately the same, and this is of course a worry in the long run.

Any other suggestion on how to do it? (I guess I could make a separate app which does not open the dictionary and use this to delete the datafile, but this is also not very elegant..

Anne
Gregory Martin
Posts: 1948
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Getting rid of old data?

Post by Gregory Martin »

Cases deleted from the .csdb file actually aren't removed. They're simply marked as deleted. However, unless you're syncing that data to a server, then the size of the file isn't that important. The .csdb file has indices on several fields so operating on it should be of a similar speed regardless of how much data is in the file.

However, if you do want to truly delete everything in the file, you should be able to do this:
open(CPI_DICT, create);
Anne
Posts: 104
Joined: January 11th, 2012, 12:55 am

Re: Getting rid of old data?

Post by Anne »

As the data file grew by almost 1 Mb per month, I feel it's safer to delete the data, as they're not used anymore anyway..

And the "create" argument worked perfectly. Thank you! Would never have thought about it..

A
Post Reply