Hi everyone,
I’m facing an issue when I run the query:
SELECT “YearMonth” AS “YearMonth”,
SUM(“TotalAmountAct”) AS “SUM(TotalAmountAct)”
FROM X
GROUP BY “YearMonth”
ORDER BY “SUM(TotalAmountAct)” DESC
The reflection is use in the execution.
But when I applied a filter with where clause, the reflection is not being reading.
SELECT “YearMonth” AS “YearMonth”,
SUM(“TotalAmountAct”) AS “SUM(TotalAmountAct)”
FROM X
WHERE “YearMonth” BETWEEN ‘201801’ AND ‘201812’
GROUP BY “YearMonth”
ORDER BY “SUM(TotalAmountAct)” DESC
What can be happening? Why when I added the “where” the sql stop using the reflection?
The query with the filter that you provided is actually failing because one of the planning phases is taking too long. Do you have an example of the query executing successfully, or does it always fail?
Hi Ben,
Today the “where” condition is running the reflection (I made some changes in the view to simplificate the logic), but when I put in the SQL the sentence LIMIT 10000 appear the error of planning is taking to long. What can be happening? :’(
SQL that runs OK:
SELECT “LastDayMonth” AS “LastDayMonth”,
((sum(TotalAmountAct) - sum(TotalAmountPrev))/ sum(TotalAmountPrev)) AS percentage_change
FROM “SalesComparativeMonth”
WHERE “LastDayMonth” >= ‘2018-06-08 00:00:00’
GROUP BY “LastDayMonth”
ORDER BY percentage_change DESC
SQL that is not finishing planning:
SELECT “LastDayMonth” AS “LastDayMonth”,
((sum(TotalAmountAct) - sum(TotalAmountPrev))/ sum(TotalAmountPrev)) AS percentage_change
FROM “SalesComparativeMonth”
WHERE “LastDayMonth” >= ‘2018-06-08 00:00:00’
GROUP BY “LastDayMonth”
ORDER BY percentage_change DESC
LIMIT 10000
Click on Admin-On the left side “cluster”-support-scroll down on the right to support key and enter “planner.experimental.pclean_logical”, click show, disable and save