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 support for router INSERT .. SELECT commands #7077

Merged
merged 1 commit into from
Jul 28, 2023

Commits on Jul 28, 2023

  1. Add support for router INSERT .. SELECT commands

    Tradionally our planner works in the following order:
       router - > pushdown -> repartition -> pull to coordinator
    
    However, for INSERT .. SELECT commands, we did not support "router".
    
    In practice, that is not a big issue, because pushdown planning
    can handle router case as well.
    
    However, with PG 16, certain outer joins are converted to
    JOIN without any conditions (e.g., JOIN .. ON (true)) and
    the filters are pushed down to the tables.
    
    When the filters are pushed down to the tables, router planner
    can detect. However, pushdown planner relies on JOIN conditions.
    
    An example query:
    ```
    INSERT INTO agg_events (user_id)
            SELECT raw_events_first.user_id
            FROM raw_events_first LEFT JOIN raw_events_second
            	ON raw_events_first.user_id = raw_events_second.user_id
            WHERE raw_events_first.user_id = 10;
    ```
    
    As a side effect of this change, now we can also relax
    certain limitation that "pushdown" planner emposes, but not
    "router". So, with this PR, we also allow those.
    onderkalaci committed Jul 28, 2023
    Configuration menu
    Copy the full SHA
    05b97fd View commit details
    Browse the repository at this point in the history