I store data based on intervals (gps location), and I don't want the database to inflate, so I determined the maximum number of rows that it can go to, and then just deletes the oldest row every time I insert a new one.
Now the database expert has looked at my code, and he says that his method is inefficient, because deleting a row from the database is the most amount of time / memory / procedures, and I should avoid it at all costs.
He says that instead I should run the oldest line (update) after reaching MAX. (so every time it goes from top to bottom)
This means that I need to save a separate "header" table in order to save the current pointer to the oldest row and update it on every insert (I don't want to lose it if the application crashes). is it really more efficient? any other ways to do this more efficiently?
source share