query statistics count for attachment