索引不会提高 Couchbase 4.5 中的速度
Index not improve speed in 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")`
它需要 3 秒,我有 52k 数据 whare _type= "DailyCampaignUsage"
我怎样才能提高它的速度?
按如下方式修改您的索引。
CREATE INDEX `daily_type_1` ON `Inheritx` (campaignId,`day`)
WHERE (`_type` = "DailyCampaignUsage");
保留此答案中的索引。按如下方式修改您的查询。
SELECT day,count(DISTINCT campaignId) campaigns
FROM Inheritx use index(daily_type_1)
where _type='DailyCampaignUsage'
and campaignId is not null
group by day;
我有以下查询
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")`
它需要 3 秒,我有 52k 数据 whare _type= "DailyCampaignUsage"
我怎样才能提高它的速度?
按如下方式修改您的索引。
CREATE INDEX `daily_type_1` ON `Inheritx` (campaignId,`day`)
WHERE (`_type` = "DailyCampaignUsage");
保留此答案中的索引。按如下方式修改您的查询。
SELECT day,count(DISTINCT campaignId) campaigns
FROM Inheritx use index(daily_type_1)
where _type='DailyCampaignUsage'
and campaignId is not null
group by day;