Query solutions count from db