-
Notifications
You must be signed in to change notification settings - Fork 17
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
AlchemyFDW: Clause pushdown not working with OR boolop #8
Comments
Can you provide a simple test that shows it on a simple table? I think I know where in the code this is likely happening. |
Apologies for the late response again! Here are the reproduction steps for this:
create table pushdown_example (id1 int, id2 int);
insert into pushdown_example values (0, 0)
create foreign table pushdown_test
(id1 int, id2 int)
server alchemy_srv
options (db_url 'postgresql://postgres:postgres@localhost/postgres_physical', schema 'public', tablename 'pushdown_example')
explain verbose
select * from pushdown_test pt
where pt.id1 = 0 or pt.id2 = 0 creates the following output as well as 4 Removing |
I added a blurb to the projects main README saying pg14 support is still experimental. |
I think you are very likely correct
…On Sat, May 11, 2024 at 2:17 AM ShaheedHaque ***@***.***> wrote:
I think I see the same thing. @luss <https://github.com/luss>, I presume
the code at
https://github.com/pgsql-io/multicorn2/blob/2c3d0c00caf4aa72fccb28f1924e06bfbffe1af4/src/query.c#L331
needs a case T_BoolOpExpr or similar?
—
Reply to this email directly, view it on GitHub
<#8 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMWOHWGCZAWVJT3XS5CYZDZBWZYXAVCNFSM5VY4EV32U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJQGU2TQOBYHE2A>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
So, here is what I have deduced:
Now, even putting aside writing code to cover this case, the question is whether Multicorn should aspire, in principle, to support a wider set of qualifier expressions, starting with a recursive walk in the The alternative is to say that (as I understand it) Postgres does not assume pushdown, and must therefore do its own qualifier checking, and few - if any - plausible use cases for Multicorn would need such a general approach, and so, simply make unwanted qualifiers a no-op and silence the messages while gradually adding other wanted qualifiers [2]. [1] Example of BOOLEXPR query:
which emits:
[2] Example of other currently unsupported qualifier:
which emits:
|
I think it is smart to be skeptical about supporting ORs, as it really complicates building a simple FDW. My own dynamodb_fdw based onto a system that doesn't support OR queries, so it would have to fail, ignore (do a full table scan and let PG handle it), or split the ORs into multiple conditions and make multiple independent internal operations. That last one is an interesting idea that could be adapted into multicorn... I'd be imagining a solution like this, when an OR is identified by multicorn:
|
To counter my own argument, I suppose an FDW which connects to a database (or an ORM), as in the case of the OP, is the exception where pushdown for OR and other complex "quals" would actually make sense. |
I'm also skeptical about anything that complicates multcorns's core mission
of making it simple to build FDW's in python. DynamoDB, ElasticSearch,
BigQuery (and others) are perfect FDW examples where there is no
(popular/supported) C/C++ interface into these datastores and multicorn2 is
used to simplify the writing of the FDW obviating the need to do any C
coding in the FDW itself.
…On Thu, May 23, 2024 at 4:16 AM ShaheedHaque ***@***.***> wrote:
To counter my own argument, I suppose an FDW which connects to a database
(or an ORM), as in the case of the OP, is the exception where pushdown for
OR and other complex "quals" would actually make sense.
—
Reply to this email directly, view it on GitHub
<#8 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMWOHVT6UJZKZSFJDXHIYTZDWQXBAVCNFSM5VY4EV32U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJSGY2TANJWGU4Q>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Another issue in AlchemyFDW: using OR in Where clauses involving foreign tables causes Multicorn to respond with the following warning:
It seems the error happens explicitly with the boolop OR regardless of any operators under it. AND and other boolean operators are supported and pushdown as normal.
The text was updated successfully, but these errors were encountered: