查询在“创建排序索引”上停留时间过长

时间:2018-05-23 20:18:28

标签: mysql

我的BI数据库查询运行时间太长(差不多10分钟)

查询几乎所有时间都处于“创建排序索引”状态。 MySQL文档没有帮助,因为它声明当缺少内部表时会显示此状态。

我该如何解决?

由于

- 编辑:

以下是相关的SQL:

SELECT * FROM POWERBI_FUNIL

POWERBI_FUNIL定义:

SELECT 
    `FC`.`id_date` AS `id_date`,
    `FC`.`id_tenant` AS `id_tenant`,
    `FC`.`id_portfolio` AS `id_portfolio`,
    SUM(`FC`.`documents_qtt`) AS `documents_qtt`,
    SUM(`FC`.`has_any_contact_qtt`) AS `has_any_contact_qtt`,
    SUM(`FC`.`has_email_qtt`) AS `has_email_qtt`,
    SUM(`FC`.`has_phone_qtt`) AS `has_phone_qtt`
FROM
    (`BI_summarized`.`POWERBI_FUNIL_MAXDATE` `MX`
    JOIN `BI_summarized`.`fact_contacts` `FC` ON (((`FC`.`id_date` = `MX`.`id_date`)
        AND (`FC`.`id_tenant` = `MX`.`id_tenant`)
        AND (`FC`.`id_portfolio` = `MX`.`id_portfolio`))))
WHERE
    (`FC`.`id_date` >= 2426)
GROUP BY `FC`.`id_date` , `FC`.`id_tenant` , `FC`.`id_portfolio`

对于POWERBI_FUNIL_MAXDATE:

SELECT 
    MAX(`BI_summarized`.`fact_contacts`.`id_date`) AS `id_date`,
    `BI_summarized`.`fact_contacts`.`id_tenant` AS `id_tenant`,
    `BI_summarized`.`fact_contacts`.`id_portfolio` AS `id_portfolio`
FROM
    `BI_summarized`.`fact_contacts`
WHERE
    (`BI_summarized`.`fact_contacts`.`id_date` >= 2426)
GROUP BY `BI_summarized`.`fact_contacts`.`id_tenant` , `BI_summarized`.`fact_contacts`.`id_portfolio`

0 个答案:

没有答案