query: define query.count_threads if not defined
database: add the database spec