Help with index

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 ?

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

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
GROUP BY d.type;
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.