Re: Add semi-join pushdown to postgres_fdw

2024-02-12 Thread Pavel Luzanov
Hi, Alexander! On 12.02.2024 05:27, Alexander Korotkov wrote: But the worst thing is that replacing AND with OR causes breaking session and server restart: I haven't managed to reproduce this yet. Could you give more details: machine, OS, compile options, backtrace? We already had off-list

Re: Add semi-join pushdown to postgres_fdw

2024-02-11 Thread Alexander Korotkov
Hi, Pavel! On Fri, Feb 9, 2024 at 10:08 PM Pavel Luzanov wrote: > But optimization not used for NOT EXISTS: Right, anti-joins are not supported yet. > Also, optimization not used after deleting first condition (a.aircraft_code = > '320'): This is a costing issue. Optimization worlds for me

Re: Add semi-join pushdown to postgres_fdw

2024-02-09 Thread Alexander Korotkov
On Fri, Feb 9, 2024 at 10:08 PM Pavel Luzanov wrote: > While playing with this feature I found the following. > > Two foreign tables: > postgres@demo_postgres_fdw(17.0)=# \det aircrafts|seats > List of foreign tables > Schema | Table | Server > +---+- >

Re: Add semi-join pushdown to postgres_fdw

2024-02-09 Thread Pavel Luzanov
Hello, While playing with this feature I found the following. Two foreign tables: postgres@demo_postgres_fdw(17.0)=# \det aircrafts|seats List of foreign tables Schema | Table | Server +---+- public | aircrafts | demo_server public | seats |

Re: Add semi-join pushdown to postgres_fdw

2023-12-05 Thread Alexander Pyhalov
Alexander Korotkov писал(а) 2023-12-03 23:52: Hi, Alexander! On Mon, Nov 27, 2023 at 5:11 PM Alexander Pyhalov wrote: Alexander Korotkov писал(а) 2023-11-27 03:49: > Thank you for the revision. > > I've revised the patch myself. I've replaced StringInfo with > additional conds into a list

Re: Add semi-join pushdown to postgres_fdw

2023-12-03 Thread Alexander Korotkov
Hi, Alexander! On Mon, Nov 27, 2023 at 5:11 PM Alexander Pyhalov wrote: > Alexander Korotkov писал(а) 2023-11-27 03:49: > > > Thank you for the revision. > > > > I've revised the patch myself. I've replaced StringInfo with > > additional conds into a list of strings as I proposed before. I

Re: Add semi-join pushdown to postgres_fdw

2023-11-27 Thread Alexander Pyhalov
Alexander Korotkov писал(а) 2023-11-27 03:49: Thank you for the revision. I've revised the patch myself. I've replaced StringInfo with additional conds into a list of strings as I proposed before. I think the code became much clearer. Also, it gets rid of some unnecessary allocations. I

Re: Add semi-join pushdown to postgres_fdw

2023-11-26 Thread Alexander Korotkov
Hi, Alexander! On Tue, Oct 31, 2023 at 1:07 PM Alexander Pyhalov wrote: > There are several cases when we can't push down semi-join in current > patch. > > 1) When target list has attributes from inner relation, which are > equivalent to some attributes of outer > relation, we fail to notice

Re: Add semi-join pushdown to postgres_fdw

2023-10-31 Thread Alexander Pyhalov
Alexander Korotkov писал 2023-10-30 19:05: Hi, Alexander! Thank you for working on this. I believe this is a very interesting patch, which significantly improves our FDW-based distributed facilities. This is why I decided to review this. Hi. Thanks for reviewing. + /* +* We can't

Re: Add semi-join pushdown to postgres_fdw

2023-10-30 Thread Alexander Korotkov
Hi, Alexander! Thank you for working on this. I believe this is a very interesting patch, which significantly improves our FDW-based distributed facilities. This is why I decided to review this. On Fri, Jan 20, 2023 at 11:00 AM Alexander Pyhalov wrote: > Tomas Vondra писал 2023-01-19 20:49: >

Re: Add semi-join pushdown to postgres_fdw

2023-01-20 Thread Alexander Pyhalov
Hi. Tomas Vondra писал 2023-01-19 20:49: I took a quick look at the patch. It needs a rebase, although it applies fine using patch. A couple minor comments: 1) addl_conds seems a bit hard to understand, I'd use either the full wording (additional_conds) or maybe extra_conds Renamed to

Re: Add semi-join pushdown to postgres_fdw

2023-01-19 Thread Tomas Vondra
Hi. I took a quick look at the patch. It needs a rebase, although it applies fine using patch. A couple minor comments: 1) addl_conds seems a bit hard to understand, I'd use either the full wording (additional_conds) or maybe extra_conds 2) some of the lines got quite long, and need a wrap 3)

RE: Add semi-join pushdown to postgres_fdw

2022-12-06 Thread fujii.y...@df.mitsubishielectric.co.jp
Hi Mr.Pyhalov. Thank you for fixing it and giving more explanation. > IIRC, planner can create semi-join, which targetlist references Vars > from inner join relation. However, it's deparsed as exists and so we > can't reference it from SQL. So, there's this check - if Var is > referenced in

Re: Add semi-join pushdown to postgres_fdw

2022-12-06 Thread Alexander Pyhalov
Hi, Yuki. Thanks for looking at this patch. fujii.y...@df.mitsubishielectric.co.jp писал 2022-12-03 06:02: question1) > + if (jointype == JOIN_SEMI && bms_is_member(var->varno, innerrel->relids) && !bms_is_member(var->varno, outerrel->relids)) It takes time for me to find in what case

RE: Add semi-join pushdown to postgres_fdw

2022-12-02 Thread fujii.y...@df.mitsubishielectric.co.jp
Hi Mr.Pyhalov. Thank you for work on this useful patch. I'm starting to review v2 patch. I have cheked we can apply v2 patch to commit ec386948948c1708c0c28c48ef08b9c4dd9d47cc (Date:Thu Dec 1 12:56:21 2022 +0100). I briefly looked at this whole thing and did step execute this by running simple

Re: Add semi-join pushdown to postgres_fdw

2022-11-06 Thread Alexander Pyhalov
Ian Lawrence Barwick писал 2022-11-04 02:21: This entry was marked as "Needs review" in the CommitFest app but cfbot reports the patch no longer applies. We've marked it as "Waiting on Author". As CommitFest 2022-11 is currently underway, this would be an excellent time update the patch. Once

Re: Add semi-join pushdown to postgres_fdw

2022-11-03 Thread Ian Lawrence Barwick
2022年8月30日(火) 15:58 Alexander Pyhalov : > > Ashutosh Bapat писал 2022-08-29 17:12: > > Hi Alexander, > > Thanks for working on this. It's great to see FDW join pushdown scope > > being expanded to more complex cases. > > > > I am still figuring out the implementation. It's been a while I have > >

Re: Add semi-join pushdown to postgres_fdw

2022-08-30 Thread Alexander Pyhalov
Ashutosh Bapat писал 2022-08-29 17:12: Hi Alexander, Thanks for working on this. It's great to see FDW join pushdown scope being expanded to more complex cases. I am still figuring out the implementation. It's been a while I have looked at join push down code. But following change strikes me

Re: Add semi-join pushdown to postgres_fdw

2022-08-29 Thread Ashutosh Bapat
Hi Alexander, Thanks for working on this. It's great to see FDW join pushdown scope being expanded to more complex cases. I am still figuring out the implementation. It's been a while I have looked at join push down code. But following change strikes me odd -- subquery using immutable function

Add semi-join pushdown to postgres_fdw

2022-08-24 Thread Alexander Pyhalov
Hi. It's possible to extend deparsing in postgres_fdw, so that we can push down semi-joins, which doesn't refer to inner reltarget. This allows us to push down joins in queries like SELECT * FROM ft1 t1 WHERE t1.c1 < 10 AND t1.c3 IN (SELECT c3 FROM ft2 t2 WHERE date(c5) =