需要性能才能使用聚合 N1QL

need performance to use aggregate N1QL

我有如下查询

select sum(ARRAY_SUM(DailyCampaignUsage.`data`[*].cost)) revenue from 
Inheritx DailyCampaignUsage   WHERE DailyCampaignUsage._type='DailyCampaignUsage'

需要 12.3 秒

这里 count(ARRAY_SUM(DailyCampaignUsage.data[*].cost))51k

我怎样才能提高它的性能?? 我有如下索引

CREATE INDEX `abc` ON `Inheritx`(`_type`) USING GSI

使用覆盖部分索引。

CREATE INDEX idx_covering ON Inheritx(_type, data[*].cost) WHERE _type = 'DailyCampaignUsage';

select sum(ARRAY_SUM(DailyCampaignUsage.`data`[*].cost)) revenue
from Inheritx DailyCampaignUsage USE INDEX ( idx_covering )
WHERE DailyCampaignUsage._type='DailyCampaignUsage'