You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "gingeard (via GitHub)" <gi...@apache.org> on 2023/06/03 12:02:38 UTC

[GitHub] [superset] gingeard opened a new issue, #24281: Using Custom SQL in chart causes slow query generation

gingeard opened a new issue, #24281:
URL: https://github.com/apache/superset/issues/24281

   Using Custom SQL in the Row/Column section significantly increases the time required to generate a chart compared to using the same SQL expressions in Calculated Columns.
   
   The simplest way to check the duration of a query generation is to click on the three dots at the top right and select "View query." Below are described two scenarios: one where query generation in chart is very slow (Scenario A) and another where it is instantaneous (Scenario B). 
   
   #### How to reproduce the bug
   
   Scenario A (time-consuming):
   
   1. Go to Charts -> + Chart -> 1). Choose any dataset with a date column. 2). Pivot Table -> Create New Chart
   2. Set the Query modal settings as follows:
   3. Columns -> Custom SQL: DATE_TRUNC(column_with_some_date, QUARTER)
   4. Metrics -> any, for example, COUNT(*)
   5. Click on Update Chart
   6. See unexpected behavior that the chart will be created 15-20 seconds slower. It also could be checked by pressing three dots at the top right corner of the chart and clicking View query. The modal window with the query will be shown NOT immediately.
   
   ### Expected results
   
   A chart creating quickly. The modal window with the query shows immediately.
   
   ### Actual results
   
   Additional 15-20 seconds of waiting. The modal window with the query hasn't shown immediately.
   
   ### Workaround:
   
   I'm able to build the identical chart but will work much quicker as following steps:
   
   Scenario B (quick): 
   
   1. The same: Go to Charts -> + Chart -> 1). Choose any dataset with a date column. 2). Pivot Table -> Create New Chart
   2. Go to Chart Source -> Three dots -> Edit dataset
   3. Open the tab Calculated columns
   7. Add item with name quarter_date and SQL Expression: DATE_TRUNC(column_with_some_date, QUARTER)
   8. Set the Query modal settings as follows:
   9. Columns -> Saved -> Saved expressions -> column_with_quarter
   10. Metrics -> any, for example, COUNT(*)
   11. Click on Update Chart
   12. See that the chart will be created quickly. It also could be checked by pressing three dots at the top right corner of the chart and clicking View query. The modal with the query will be shown immediately.
   
   #### Screenshots
   
   Scenario A (time-consuming): With custom SQL as Column/Row (23 sec):
   
   <img width="1313" alt="image" src="https://github.com/apache/superset/assets/7454811/b91c897a-1760-448a-b0c8-5528a549ad5c">
   
   Scenario B (quick): With Calculated Column with the same SQL expression (6 sec):
   
   <img width="1313" alt="image" src="https://github.com/apache/superset/assets/7454811/f8e53044-d501-421e-bdfd-0638433ed2c1">
   
   Also we can check that produced SQL query is the same:
   
   Scenario A (time-consuming):
   
   <img width="1175" alt="image" src="https://github.com/apache/superset/assets/7454811/964db948-3ec6-447c-a54c-c77152a6fa93">
   
   Scenario B (quick):
   
   <img width="1183" alt="image" src="https://github.com/apache/superset/assets/7454811/eb13c697-a9fc-4b5a-ac28-726e0bb519f0">
   
   ### Environment
   
   - browser type and version: Google Chrome Version 113.0.5672.126 (Official Build) (arm64)
   - superset version: 2.1.0
   


-- 
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.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


Re: [I] Using Custom SQL in chart causes slow query generation [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #24281: Using Custom SQL in chart causes slow query generation
URL: https://github.com/apache/superset/issues/24281


-- 
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


Re: [I] Using Custom SQL in chart causes slow query generation [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #24281:
URL: https://github.com/apache/superset/issues/24281#issuecomment-1973587358

   This seems unusual, and we haven't heard any other complaints of anything this drastic. I'm not sure if this is still an issue in current versions of Superset (3.x). If it is, we can re-open this, or feel free to open a new issue with updated context and a reproducible case using example data so we can confirm/measure/compare against your report. We're no longer supporting Superset 2.x or prior, and it's been a while since this thread saw any activity, so I'm closing this as absolute. Again, happy to revisit if this is still happening to you in newer versions.
   


-- 
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