[jan] Optimize SQL query for garbage collection (hannes.brunssen@ewetel.de, Bug #13043).