本文介绍了索引不能提高Couchbase 4.5的速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面查询

SELECT day,count(DISTINCT campaignId) campaigns
FROM Inheritx use index(daily_type_1)
where _type='DailyCampaignUsage'
group by day

我的索引低于

 `CREATE INDEX `daily_type_1` ON `Inheritx` 
(`_type`,`day`,(distinct (`campaignId`))) WHERE (`_type` = "DailyCampaignUsage")`

这需要 3s ,我有52k数据集_type ="DailyCampaignUsage"

it is taking 3s and I habe 52k data whare _type= "DailyCampaignUsage"

如何提高速度?

推荐答案

按如下所示修改索引.

CREATE INDEX `daily_type_1` ON `Inheritx` (campaignId,`day`)
WHERE (`_type` = "DailyCampaignUsage");

在此答案中保留索引.修改查询,如下所示.

Keep the index in this answer. Modify your query as follows.

SELECT day,count(DISTINCT campaignId) campaigns
FROM Inheritx use index(daily_type_1)
where _type='DailyCampaignUsage'
and campaignId is not null
group by day;

这篇关于索引不能提高Couchbase 4.5的速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 01:50