?
Solved

Removing older records from a file

Posted on 2004-04-15
5
Medium Priority
?
226 Views
Last Modified: 2010-03-31
Hi,

i have an application that provides me with fixed-length records. These files are organized by date. What i would like to do is to get statistical data from them in the following way:

Last hour - 5 minutes
Last day - 15 minutes
Last week - 30 minutes
Last month - 1 hour

This should be updated every 5 minutes. Also, I want to delete automatically records older than one year, for example. What's your advice on an algorithm to store the stats and to remove the older records (i don't want to copy all the remaing records every time i delete the older ones).

Thanks in advance,
  Bruno
0
Comment
Question by:brunomsilva
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 14

Assisted Solution

by:Tommy Braas
Tommy Braas earned 500 total points
ID: 10837220
>> i don't want to copy all the remaing records every time i delete the older ones
Unfortunately that's the way you have to do it unless you use an indexing scheme for accessing the data in the file.

How often do you wish to 'expire' records? Once a week or continously (i.e. every 5 minutes)?
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 10837761
you could mark them as deleted in the file, and then periodically purge deleted records from the file by copying all undeleted records to a new file.
A RandomAccessFile could be used to mark records as deleted.
0
 
LVL 4

Author Comment

by:brunomsilva
ID: 10840632
orangehead911,

about once a week. and how should i remove the records when they should be stored with a higher interval (for example, after a day keep only 15 minutes stats?
0
 
LVL 92

Expert Comment

by:objects
ID: 10846677
to remove the records physically from the file you need to recreate the file ie. copy existing records to new file
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question