Get number of threads from db.