Use a better SELECT COUNT query so complex queries don’t die
Version 1.0.1