Faster SQL-query, huge performance improvement on installations with thousands of tickets.