Closed PeteLawrence closed 3 months ago
With SQLite I am seeing query times of 3 - 5ms on a rpi5 with sd card, but I do agree that query could be optimized so I changed it to use id column intestad with https://github.com/tphakala/birdnet-go/commit/86a119a36cc0b9835e3c53835c662b1b4af0387a.
Thank you for reporting.
Many thanks, I've pulled the latest dev image and query times are way down. 👍
I'm running Birdnet Go on a Raspberry Pi 5 with a SSD, and using MySQL as a backend. I have around 220,000 detections in the records table, and I'm constantly getting the following message in the logs every time I reload the dashboard -
Running
EXPLAIN SELECT * FROM notes ORDER BY date DESC, time DESC LIMIT 5
on the database I can see that MySQL is having to do a filesort due to the ordering on 2 different fields resulting in the slowness, and which will only get worse as more detections are added.I'm not sure whether sqlite suffers from the same problem or not?
I'd suggest that the query needs updating to use a single DATETIME field (eg. begin_time), and an index adding to that field. When doing this the query time goes down to sub 10ms, and should remain pretty constant regardless of the number of detections