You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to enhance our query performance after users send the API request to run our data endpoint to get the result from the data source. We need to provide a Caching (pre-loading) Layer with the duckDB to enhance query performance.
Describe the solution you’d like
Define the cache layer in YAML by cache field, and define each cacheTableName and its config. For example we define an sql select * from order query the result from data source pg and keep to duckDB by order table name.
Otherwise, the refreshTime and refreshExpression means when should we need to refresh the query and keep the new result in the cache table in duckDB. The index is a duckDB indexes feature to index like the original database and make query efficient.
# API schema YAMLcache:
# "order" table keep in duckDB
- cacheTableName: "order"sql: "select * from order",# optionalprofile: pg# optionalrefreshTime:
every: "5m"# optionalrefreshExpression:
expression: "MAX(created_at)"every: "5m"# optionalindexes:
'idx_a': 'col_a''idx_b': 'col_b'# "product" table keep in duckDB
- cacheTableName: "product"sql: "select * from product",# used data sourceprofiles: pg
Here is our SQL file, which makes our query send to duckDB to get results. In the scop of {% cache %} ... {% endcache %} , when we send the query to duckDB, we will search the each table keep in duckDB or not, so if your YAML not defined the same cache table name, it will make the query failed.
-- The "cache" scope means the SQL statement will send the query to duckDB cache data source
{% cache %}
select*from order
where type = {{ context.params.type }}
andwhere exists (
select*from product where price >= {{ context.params.price }}
andorder.product_id=product.id
)
{% endcache %}
kokokuo
changed the title
Caching (pre-loading) Layer with the duckDB - Parse “cache” setting from API Schema YAML
Parse “cache” setting from API Schema YAML
Apr 6, 2023
kokokuo
changed the title
Parse “cache” setting from API Schema YAML
Caching (pre-loading) Layer with the duckDB - Parse “cache” setting from API Schema YAML
Apr 6, 2023
kokokuo
changed the title
Caching (pre-loading) Layer with the duckDB - Parse “cache” setting from API Schema YAML
Epic Request: Caching (pre-loading) Layer with the duckDB
Apr 6, 2023
kokokuo
changed the title
Epic Request: Caching (pre-loading) Layer with the duckDB
Epic Feature: Request: Caching (pre-loading) Layer with the duckDB
Apr 6, 2023
kokokuo
changed the title
Epic Feature: Request: Caching (pre-loading) Layer with the duckDB
Epic Request: Caching (pre-loading) Layer with the duckDB
Apr 6, 2023
What’s the problem you're trying to solve
In order to enhance our query performance after users send the API request to run our data endpoint to get the result from the data source. We need to provide a Caching (pre-loading) Layer with the duckDB to enhance query performance.
Describe the solution you’d like
Define the cache layer in YAML by
cache
field, and define eachcacheTableName
and its config. For example we define an sqlselect * from order
query the result from data sourcepg
and keep to duckDB byorder
table name.Otherwise, the
refreshTime
andrefreshExpression
means when should we need to refresh the query and keep the new result in the cache table in duckDB. Theindex
is a duckDB indexes feature to index like the original database and make query efficient.Here is our SQL file, which makes our query send to duckDB to get results. In the scop of
{% cache %} ... {% endcache %}
, when we send the query to duckDB, we will search the each table keep in duckDB or not, so if your YAML not defined the same cache table name, it will make the query failed.Breakdown
cache
config from API Schema YAML #151{% cache %} ... {% endcache %}
tag #152cache
tag could keep result query result to variable likereq
#153The #157 not contains in the epic, we will arrange to develop it in the future.
The text was updated successfully, but these errors were encountered: