Skip to content

Fix #233 Add limit pushdown to attached queries #313

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

noahisaksen
Copy link

Implements limit pushdown #233

Gets applied on all postgres attached queries, if preferred can be applied only when an option like experimental pushdown is set, however in this implementation triggers the same as the mysql_scanner limit pushdown implementation.

This change greatly improves performance for queries that include a LIMIT.

What it does:

select bar from attached_pg.foo limit 1;

Previously

COPY (SELECT "bar" FROM "attached_pg"."foo" ) TO STDOUT (FORMAT "binary");

Now

COPY (SELECT "bar" FROM "attached_pg"."foo" LIMIT 1) TO STDOUT (FORMAT "binary");


I am not sure how a specific test for this would look like as I am not sure there is a way to verify generated SQL. A generic limit test was added.


Works for LIMIT and OFFSET. If an ORDER_BY is present it will not be added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants