Use a dedicated query for coordinate counts to reduce memory for #23.