List devices with higher position generation

smsoousa3 years ago

Hello Anton! Would there be any way to query the devices that are generating the most positions in the database? My disk space is filling up quickly, around 4 days. And I would like to identify which devices are doing this.

Anton Tananaev3 years ago

You should be able to do it with a fairly simple SQL query.

smsoousa3 years ago

Not wanting to abuse your time and patience, could you show me more or less how the query would be? Because I tried in several ways and I couldn't filter. I have little knowledge in the area. Thanks

Anton Tananaev3 years ago

Something like this:

SELECT deviceid, COUNT(*) FROM tc_positions WHERE fixtime > DATE_ADD(NOW(), INTERVAL -1 DAY) GROUP BY deviceid;
smsoousa3 years ago

Thank you Anton! I got it. I had to make a small change to make it work in postgres, so it looks like this:

SELECT deviceid, COUNT(*) FROM tc_positions WHERE fixtime > (NOW() - INTERVAL '5 DAY') GROUP BY deviceid ORDER BY count DESC;
Richard Acosta3 years ago

If you give a look at the log, you may find which device has the most reports or the closer ones in time, or the never stopping ones. There's few stuff more visual than a log.