selfy
March 3, 2023, 9:38am
1
I have an index:
CREATE INDEX adv_type ON `my-db`(`type`)
When I execute the below query, why is the above index not being used ? As a result the query often times out. There are at least a million documents in the bucket.
select distinct type from `my-db`
Or how can I speed up the above query ?
dh
March 3, 2023, 10:59am
2
An index is only selected based on filters; without any filters an index will not be used.
To use the defined index, add the filter WHERE type IS VALUED
to your SELECT.
1 Like
vsr1
March 4, 2023, 8:34pm
3
EE use (which chan use index aggregates. i.e indexer will only return group values).
CREATE INDEX adv_type ON `my-db`(`type`);
SELECT d.type
FROM `my-db` AS d
WHERE d.type IS VALUED
GROUP BY d.type;
1 Like
system
Closed
June 2, 2023, 8:34pm
4
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.