Hi,
I have a fairly simple query that counts and groups as follow.
Query
select count(form) as total, form from bucketName where username='test' and form is not null group by form
Index
CREATE INDEX idx_forms_by_username ON
bucketName(
username,
form) WHERE (
formis not missing)
The query runs pretty fast for those users with few documents.
The query takes 800ms+ to return the following result. It looks like the query slows down as the # of docs increases. I also suspect that the query is causing scan backfill in the query server (Iām not 100% sure yet though). Is there a way to improve the query other than using view?
[
{
"form": "creative",
"total": 2900
},
{
"form": "user",
"total": 1
},
{
"form": "comment",
"total": 89050
}
]