How to shrink `tc_positions` to 24 positions a day for each device?

Marcin8 days ago

Does anyone have an almost ready query for that?
My idea is something like:
delete from tc_positions everything which has more then one position for each hour / each device
Or is there something ready done which shrink it by daily route, so that i can see a route in 5 instead of 500 points?