mohamad
mohamad

Reputation: 21

storing vehicle tracking data in differnt table and delete many data after Specified time

im developing vehicle tracking I think in a very short period of time, the data will be be enormous because the gps device send many data in day, when we track many device These data will be enormous ...... i want create some table for these data,( table for data of current day, and table for 3days and table for 1 week data and table for 3 weeks data and one month and after 3 month we get backup) but for Implement this scenario i dont know how can delete many data after 3 month and store related data to the self table thnx for your guide

Upvotes: 1

Views: 140

Answers (2)

Gordon Linoff
Gordon Linoff

Reputation: 1270443

If you have a deletion issue (or a backup issue) for large chunks of data, then the solution is to partition your data, in your case probably by day.

Each partition is stored in a separate location. You can think of it as a file. Dropping partitions is very fast. On the other hand, deleting rows can be quite expensive, because each deleted row needs to be logged. In some databases, that can fill up log space, preventing the deletion.

On the other hand, partitions can be invisible when you are querying. They can also speed up queries, so queries that use only one day's worth of data only needs to read that data. They are also compatible with indexes.

You haven't specified your database, but pretty much all databases support partitioning or something similar.

Upvotes: 0

khalid MZIBRA
khalid MZIBRA

Reputation: 75

You can store the day, the week, month,and the year and use a combined index with all those columns plus the userid.hope it helps

Upvotes: 1

Related Questions