Do database queries in a thread for ^C-ability