I have a table which is going to hold logs from GPS devices in the following format:
id | device | time | latitude | longitude
Currently, from the size of the logs (they are text files), it appears there are going to be around 10 thousand records per day. Most probably it will increase to somewhere like 50 thousands
The table should not have any duplicates, and is going to be updated frequently, somewhere around every 30 seconds, and I'm worried about possible performance issues if I pick the wrong approach.
Here are a few scenarios I thought about:
- Store all the records from the log file in a temporary table, then make a query like the one here with the two tables: https://stackoverflow.com/a/11767663/2857962
- Make an unique index on the columns
device
,time
,latitude
andlongitude
, and useINSERT IGNORE INTO
(the most obvious way) - Calculate a MD5 hash on the above 4 columns and compare it before sending to the database (there's a PHP app beneath this)
So my question is, what would be the most efficient way here to store such records in huge numbers very frequently?