Make sure to not query db when there aren't any ids