You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/10/08 15:12:33 UTC

[GitHub] [superset] ul-fra opened a new issue #17035: Unnecessary SQL subquery for fetching diagram data

ul-fra opened a new issue #17035:
URL: https://github.com/apache/superset/issues/17035


   First of all I have setup Superset with the current docker image (https://superset.apache.org/docs/installation/installing-superset-using-docker-compose) on an AWS EC2 instance. I've also installed superset on my local laptop (https://hub.docker.com/r/apache/superset) but had the same thing.
   
   After registering the AWS Athena driver and an dataset, I have created a simple time series diagram with a "group by". The query is working and data is visualized. Please see screenshot.
   
   When I look at the sql query executed by Athena you can see this: --> ### Actual results
   
   There is a subquery included in the query which seems to be useless. The columns of the subquery are not used in the outer query. The join is useless.
   
   The disadvantage is, that the query takes much more time with this subquery - x*100% in comparision to the expected query.
   
   #### How to reproduce the bug
   
   create a timeseries chart and group by an attribute.
   
   ### Expected results
   
   SELECT date_trunc('day', CAST(date_parse(p_date, '%Y-%m-%d') AS TIMESTAMP)) AS "__timestamp",
          "c_jobid" AS "c_jobid",
          COUNT(*) AS "count"
   FROM "x"."y"
   WHERE "p_date" >= '2021-10-01'
   GROUP BY "c_jobid",
            date_trunc('day', CAST(date_parse(p_date, '%Y-%m-%d') AS TIMESTAMP))
   ORDER BY "count" DESC
   LIMIT 1000
   
   ### Actual results
   
   SELECT date_trunc('day', CAST(date_parse(p_date, '%Y-%m-%d') AS TIMESTAMP)) AS "__timestamp",
          "c_jobid" AS "c_jobid",
          COUNT(*) AS "count"
   FROM "x"."y"
   JOIN
     (SELECT "c_jobid" AS "c_jobid__",
             COUNT(*) AS "mme_inner__"
      FROM "vehicle_cdc2_cca_qual_pre"."te_mgu"
      WHERE "p_date" >= '2021-10-01'
      GROUP BY "c_jobid"
      ORDER BY "mme_inner__" DESC
      LIMIT 100) AS "anon_1" ON "c_jobid" = "c_jobid__"
   WHERE "p_date" >= '2021-10-01'
   GROUP BY "c_jobid",
            date_trunc('day', CAST(date_parse(p_date, '%Y-%m-%d') AS TIMESTAMP))
   ORDER BY "count" DESC
   LIMIT 1000
   
   #### Screenshots
   
   <img width="820" alt="grafik" src="https://user-images.githubusercontent.com/68276432/136579420-abbe922f-363d-41d6-86b6-51294f930c55.png">
   
   
   ### Environment
   
   (please complete the following information):
   
   - browser type and version: Firefox 88.0
   - superset version: Superset 0.0.0dev
   - python version: Python 3.8.12
   - node.js version: ? (docker exec -it superset node -v --> node not on path)
   - any feature flags active: no
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [x] I have checked the superset logs for python stacktraces and included it here as text if there are any.
   - [x] I have reproduced the issue with at least the latest released version of superset.
   - [x] I have checked the issue tracker for the same issue and I haven't found one similar.
   
   ### Additional context
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] ul-fra edited a comment on issue #17035: Unnecessary SQL subquery for fetching diagram data

Posted by GitBox <gi...@apache.org>.
ul-fra edited a comment on issue #17035:
URL: https://github.com/apache/superset/issues/17035#issuecomment-940709963


   Thanks. When I remove the value (pushing the x button on the right hand side of the combo box) and rerun the query, the default value (100) will be used and therefore also the subquery is used . This is not what I would expect.
   Furthermore, when I set the value to '0', the subquery does not appear - that's great - but when I save the chart the default value '100' appears again in the GUI. But the query does not use the subquery. That seems to be a bug.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] ul-fra commented on issue #17035: Unnecessary SQL subquery for fetching diagram data

Posted by GitBox <gi...@apache.org>.
ul-fra commented on issue #17035:
URL: https://github.com/apache/superset/issues/17035#issuecomment-940709963


   Thanks. When I remove the value (pushing the x button on the right hand side of the combo box) and rerun the query, the default value (100) will be used and therefore also the subquery is used . This is not what I would expect.
   Furthermore, when I set the value to '0', the subquery does not appear - that's great - but when I save the chart the default value '100' appears again. That seems to be a bug.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] akizminet commented on issue #17035: Unnecessary SQL subquery for fetching diagram data

Posted by GitBox <gi...@apache.org>.
akizminet commented on issue #17035:
URL: https://github.com/apache/superset/issues/17035#issuecomment-939904470


   You need to remove series limit to remove sub query.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org