Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add plan-time chunk exclusion for real-time CAggs #6325

Merged
merged 1 commit into from Jan 29, 2024

Commits on Jan 29, 2024

  1. Add plan-time chunk exclusion for real-time CAggs

    The watermark function for CAggs is declared as STABLE since the value
    of the function changes after every CAgg refresh. The function
    volatility prevents the planner from replacing the function invocation
    with a constant value and executing plan time chunk exclusion. This
    leads to high planning times on hypertables with many chunks.
    
    This PR replaces the function invocation with a constant value to allow
    plan time exclusion of chunks. We perform the replacement at plan time
    instead of changing the function volatility to IMMUTABLE, because we
    want to control the constification. Only queries that access the
    underlying hypertable in a query (i.e., no queries like SELECT
    cagg_watermark(...) without any FROM condition) are rewritten. This is
    done to make sure that the query is properly invalidated when the
    underlying table changes (e.g., the watermark is updated) and the query
    is replanned on the subsequent execution.
    
    Fixes: timescale#6105, timescale#6321
    Co-authored-by: Fabrizio de Royes Mello <fabriziomello@gmail.com>
    jnidzwetzki and fabriziomello committed Jan 29, 2024
    Configuration menu
    Copy the full SHA
    ddd3da6 View commit details
    Browse the repository at this point in the history