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 2020/04/22 12:11:14 UTC

[GitHub] [incubator-superset] dpgaspar opened a new pull request #9612: [sql_lab] Improve performance, only use slow func when needed

dpgaspar opened a new pull request #9612:
URL: https://github.com/apache/incubator-superset/pull/9612


   ### CATEGORY
   
   Choose one
   
   - [ ] Bug Fix
   - [X] Enhancement (new features, refinement)
   - [ ] Refactor
   - [ ] Add tests
   - [ ] Build / Development Environment
   - [ ] Documentation
   
   ### SUMMARY
   When quering the examples table `wb_health_population` on SQLLab including all the columns on the statement:
   
   ``` sql
   SELECT "NY_GNP_PCAP_CD",
          "SE_ADT_1524_LT_FM_ZS",
          "SE_ADT_1524_LT_MA_ZS",
          "SE_ADT_1524_LT_ZS",
          "SE_ADT_LITR_FE_ZS",
     ... (8551 characters truncated) ... _IN_ZS",
          "SP_UWT_TFRT",
          country_code,
          country_name,
          region,
          year
   FROM public.wb_health_population
   ```
   
   The query would take approximately 50s to 70s to complete, yet the query itself only takes 10-20ms to execute. This is due to `ParsedQuery.__extract_from_token` function that extracts all the tables from a query, noticed that the property `tables` itself is seldom used/needed. This is a simple fix, that reduces the time to execute from 50s-70s to 10s-20s so 1/6 of the total time.
   
   Expected, since sql_json execution path instantiates ParsedQuery 6 times.
   
   Simple fix, but the `__extract_from_token` recursive loop should be visited and improved (@lilykuang).
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Changes UI
   - [ ] Requires DB Migration.
   - [ ] Confirm DB Migration upgrade and downgrade tested.
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   ### REVIEWERS
   @robdiciuccio @willbarrett 
   
   


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

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