I have a query like below
select sum(ARRAY_SUM(DailyCampaignUsage.`data`[*].cost)) revenue from
Inheritx DailyCampaignUsage WHERE DailyCampaignUsage._type='DailyCampaignUsage'
it is taking 12.3s
here count(ARRAY_SUM(DailyCampaignUsage.data
[*].cost)) it is 51k
How I can improve it's performance ?? I have index like below
CREATE INDEX `abc` ON `Inheritx`(`_type`) USING GSI
Use a covering partial index.