trentlavoie opened a new pull request, #32830:
URL: https://github.com/apache/superset/pull/32830

   ### SUMMARY
   Add cache for table schema in sqllab. 
   
   Motivation: Fetching schema can be a slow operation on query engines such as 
Trino and Athena. We have noticed the schema takes up to 300s to appear when 
Trino cluster is under load. Caching the schema allows users to have better 
interactive experience with sqllab.
   
   Design: Added a new schema cache to cache manager so this can be managed 
separately from other caches. Many users including relational DB's such as 
Postgres or MySQL likely won't require this feature as this feature is ideal 
for query engines where fetching table schema is not a trivial operation. 
Feature is disabled by default and requires setting SCHEMA_CACHE_CONFIG in 
config.py to be enable.
   
   ### TESTING INSTRUCTIONS
   1. Add Trino cluster as a database
   2. Test to ensure there are no breaking changes (schema cache disabled, by 
default): Open sqllab and select a schema and table. Opening table schema takes 
up to 300s.
   3. Enable schema cache: Add to config.py and restart:
   ```
   SCHEMA_CACHE_CONFIG = {
       'CACHE_TYPE': 'redis',
       'CACHE_DEFAULT_TIMEOUT': 60 * 60 * 12, # 12 hr cache
       'CACHE_KEY_PREFIX': 'superset_schema_',
       'CACHE_REDIS_URL': f"redis://{REDIS}:{REDIS_PORT}/{REDIS_DB}"
   }
   ```
   4. Test schema cache enabled: open sqllab and select a schema and table. 
Opening schema table takes long on cache miss but subsequent requests are fast.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   [x] Required feature flags:
   SCHEMA_CACHE_CONFIG = {
       'CACHE_TYPE': 'redis',
       'CACHE_DEFAULT_TIMEOUT': 60 * 60 * 12, # 12 hr cache
       'CACHE_KEY_PREFIX': 'superset_schema_',
       'CACHE_REDIS_URL': f"redis://{REDIS}:{REDIS_PORT}/{REDIS_DB}"
   } 
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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-unsubscr...@superset.apache.org

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


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

Reply via email to