Re: SQLFunctionCache and generic plans

2024-10-01 Thread Alexander Pyhalov
n RevalidateCachedQuery(). I suppose not - as we plan in executor (so shouldn't catch userid change or see some changes in related objects. Revalidation would kill our plan, destroying resultDesc. Also while looking at this, fixed processing of instead of rules (which would lead to NULL exe

Re: SQLFunctionCache and generic plans

2024-09-03 Thread Alexander Pyhalov
es) if we can't use cached revalidation machinery? I hope to get some hints to move further. -- Best regards, Alexander Pyhalov, Postgres ProfessionalFrom d7cdde449daeefbfd9ccd3e72ae282f21be0c1c8 Mon Sep 17 00:00:00 2001 From: Alexander Pyhalov Date: Fri, 23 Aug 2024 15:48:38 +0300 Sub

Re: Asynchronous MergeAppend

2024-08-20 Thread Alexander Pyhalov
er of transactions actually processed: 14941 latency average = 6.693 ms initial connection time = 7.037 ms tps = 149.415688 (without initial connection time) -- Best regards, Alexander Pyhalov, Postgres ProfessionalFrom 67477ab452dfc57aa9e47e4462c9f87b66911951 Mon Sep 17 00:00:00 2001 From: Alexan

Asynchronous MergeAppend

2024-07-17 Thread Alexander Pyhalov
nd_plan() inserts sort node. In this case mark_async_capable() can treat Sort plan node as some other and crash, so there's a small fix for this. -- Best regards, Alexander Pyhalov, Postgres ProfessionalFrom 79e40d6bcdfa96435c06d2c668efd76f3bcd5325 Mon Sep 17 00:00:00 2001 From: Alexander Pyhal

Partition-wise join with whole row vars

2024-07-12 Thread Alexander Pyhalov
ERE ((r4.a = r6.b)) AND (((r6.a % 30) = 29)) [1] https://www.postgresql.org/message-id/CAFjFpRc8ZoDm0%2Bzhx%2BMckwGyEqkOzWcpVqbvjaxwdGarZSNrmA%40mail.gmail.com -- Best regards, Alexander Pyhalov, Postgres ProfessionalFrom e9695c968d2705b0c8986dfbb3fd2409e22acb63 Mon Sep 17 00:00:00 2001 From: Alexande

Re: Inconsistency between try_mergejoin_path and create_mergejoin_plan

2024-06-19 Thread Alexander Pyhalov
auses in the form "inner op outer" when selecting mergejoin/hash clauses. If a clause lacks a commutator, we should consider it unusable for the given pair of outer and inner rels. Please see the attached patch. This seems to be working for my test cases. -- Best regards, Alexander Pyhalov, Postgres Professional

MergeAppend could consider sorting cheapest child path

2024-06-18 Thread Alexander Pyhalov
selecting data. MergeAppend was generated with subpaths doing index scan on suitably ordered index and filtering a lot of data. The suggested fix allows MergeAppend to consider sorting on cheapest childrel total path as an alternative. -- Best regards, Alexander Pyhalov, Postgres

Inconsistency between try_mergejoin_path and create_mergejoin_plan

2024-06-17 Thread Alexander Pyhalov
d not find commutator for operator XXX The similar behavior seems to be present also for hash join. Attaching a test case (in patch) and a possible fix. -- Best regards, Alexander Pyhalov, Postgres ProfessionalFrom ea9497c9f62b3613482d5b267c7907070ba8fcd4 Mon Sep 17 00:00:00 2001 From: Alexander Py

Re: Partial aggregates pushdown

2024-06-04 Thread Alexander Pyhalov
was discussed at the Vancouver conference. What are the open issues? I know of several: * add tests that were requested by Fujii-san and now posted by Alexander Pyhalov * Where is the documentation? I know the original patch had some, and I improved it, but it seems to be missing

Re: CREATE INDEX CONCURRENTLY on partitioned index

2024-05-27 Thread Alexander Pyhalov
... ATTACH PARTITION. Once indexes for all the partitions are attached to the parent index, the parent index will but at least now it looks better. -- Best regards, Alexander Pyhalov, Postgres Professional

Re: Partial aggregates pushdown

2024-05-27 Thread Alexander Pyhalov
fujii.y...@df.mitsubishielectric.co.jp писал(а) 2024-05-28 00:30: Hi Mr. Pyhalov. Sorry for the late reply. Thank you for your modification and detailed review. I attach a fixed patch, have been not yet rebased. Monday, 25 March 2024 16:01 Alexander Pyhalov :. Comment in nodeAgg.c seems to

Re: Partial aggregates pushdown

2024-05-27 Thread Alexander Pyhalov
itioned table EXPLAIN (VERBOSE, COSTS OFF) SELECT avg(PARTIAL_AGGREGATE a), avg(a) FROM pagg_tab; fails with ERROR: variable not found in subplan target list -- Best regards, Alexander Pyhalov, Postgres Professional

Re: CREATE INDEX CONCURRENTLY on partitioned index

2024-05-24 Thread Alexander Pyhalov
Ilya Gladyshev писал(а) 2024-05-24 00:14: Hi, Hi. I think it's well worth the effort to revive the patch, so I rebased it on master, updated it and will return it back to the commitfest. Alexander, Justin feel free to add yourselves as authors On 29.01.2024 12:43, Alexander Py

Re: Partial aggregates pushdown

2024-03-25 Thread Alexander Pyhalov
fpinfo->remote_conds = lappend(fpinfo->remote_conds, rinfo); else fpinfo->local_conds = lappend(fpinfo->local_conds, rinfo); From: Alexander Pyhalov Sent: Wednesday, February 28, 2024 10:43 PM contrib/postg

Re: ExecAppendAsyncEventWait() in REL_14_STABLE can corrupt PG_exception_stack

2024-03-22 Thread Alexander Pyhalov
Etsuro Fujita писал(а) 2024-03-21 13:59: On Sun, Feb 25, 2024 at 6:34 PM Etsuro Fujita wrote: > On Fri, Feb 23, 2024 at 01:21:14PM +0300, Alexander Pyhalov wrote: > > Recent commit 555276f8594087ba15e0d58e38cd2186b9f39f6d introduced final > > cleanup of node-

Re: Partial aggregates pushdown

2024-02-28 Thread Alexander Pyhalov
binary representations on different architectures and just refuse to push down partial aggregates on server version mismatch? At least at the first step? 3. Fixing the behavior when the HAVING clause is present From: Robert Haas Sent: Tuesday, November 28, 2023 4:08 AM On Wed, Nov 22, 2023 a

ExecAppendAsyncEventWait() in REL_14_STABLE can corrupt PG_exception_stack

2024-02-23 Thread Alexander Pyhalov
FDW. Unfortunately, I couldn't reproduce the issue with postgres_fdw, but it seems it is also affected. The following patch heals the issue. -- l Best regards, Alexander Pyhalov, Postgres ProfessionalFrom 025f40894d6d8f499144f0f7c45c0a124a46c408 Mon Sep 17 00:00:00 2001 From: Alexander

Re: CREATE INDEX CONCURRENTLY on partitioned index

2024-01-29 Thread Alexander Pyhalov
k all child tables in CIC session, you'll get deadlocks. -- Best regards, Alexander Pyhalov, Postgres ProfessionalFrom 37a13b7fa1c3277b9d038b7a0c75399ff05b28a7 Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Mon, 29 Jan 2024 10:41:01 +0300 Subject: [PATCH] Allow CREATE INDEX CONCURRENTLY

Re: Assert failure on 'list_member_ptr(rel->joininfo, restrictinfo)'

2023-12-07 Thread Alexander Pyhalov
join, one bitmapset field can have a size of about 1kB. Having bitmapset referencing Relation with a large index value, we had a lot of (for example, 1E4 * 1kB) copies on each reparametrization of such a field. Alexander Pyhalov should remember that case. Yes. If it matters, this happened d

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 > additi

Re: Add semi-join pushdown to postgres_fdw

2023-11-27 Thread Alexander Pyhalov
t regards, Alexander Pyhalov, Postgres ProfessionalFrom c17e05d09d5721d22785ed11bed053162d67d967 Mon Sep 17 00:00:00 2001 From: Alexander Pyhalov Date: Mon, 27 Nov 2023 14:35:29 +0300 Subject: [PATCH] postgres_fdw: add support for deparsing semi joins --- contrib/postgres_fdw/deparse.c

Re: Partial aggregates pushdown

2023-11-21 Thread Alexander Pyhalov
eneral, and not without additional aggregate support functions. So what I said above was wrong with respect to those. Or so I believe, anyway. But I still don't see why HAVING should be a problem. Hi. HAVING is also a problem. Consider the following query SELECT count(a) FROM t HAVING cou

Re: Add semi-join pushdown to postgres_fdw

2023-10-31 Thread Alexander Pyhalov
reconsider. This means that if later examine B join A, we don't try to push it down. As semi-join can be executed as JOIN_UNIQUE_INNER or JOIN_UNIQUE_OUTER, this can be a problem - we look at some of these paths and remember that we can't push down such join. -- Best regards

Re: Partial aggregates pushdown

2023-09-27 Thread Alexander Pyhalov
* Modified PathTarget cannot be used by FDW as-is to deparse this statement. * So, before modifying PathTarget, setGroupClausePartial generates * another Pathtarget and another list List of SortGroupClauses * to make deparsing possible. */ sounds better. -- Best regards, Alexander Pyhalov

Re: Partial aggregates pushdown

2023-09-27 Thread Alexander Pyhalov
fujii.y...@df.mitsubishielectric.co.jp писал 2023-09-27 01:35: Hi Mr.Momjian, Mr.Pyhalov. Tuesday, 26 September 2023 22:15 Alexander Pyhalov : Do you mean that extra->partial_target->sortgrouprefs is not replaced, and so we preserve tlesortgroupref numbers? Yes, that is correct.

Re: Partial aggregates pushdown

2023-09-26 Thread Alexander Pyhalov
the remote server unless the partial aggregate function and the aggregate function match. The default is false. -- Thursday, 20 July 2023 19:23 Alexander Pyhalov : fujii.y...@df.mitsubishielectric.co.jp писал 2023-07-19 03:43: > Hi Mr.Pyhalov, hackers. > 3) > I modified the patch to sa

postgres_fdw could support row comparison pushdown

2023-08-07 Thread Alexander Pyhalov
is in foreign_expr_walker(). -- Best regards, Alexander Pyhalov, Postgres ProfessionalFrom 655148c85768afbbfc034e6f5dc5a5a6d72139b8 Mon Sep 17 00:00:00 2001 From: Alexander Pyhalov Date: Mon, 7 Aug 2023 11:47:31 +0300 Subject: [PATCH] postgres_fdw: support RowCompareExpr pushdown --- contrib/postg

Re: Partial aggregates pushdown

2023-07-20 Thread Alexander Pyhalov
2) We replace extra->partial_target->exprs with partial_target->exprs after processing. Why are we sure that after this tleSortGroupRef is correct? -- Best regards, Alexander Pyhalov, Postgres Professionaldiff --git a/contrib/postgres_fdw/sql/postgres_fdw.sql b/contrib/p

Re: Partial aggregates pushdown

2023-07-14 Thread Alexander Pyhalov
ne. I'm attaching a patch which seems to fix it, but I'm not quite sure in it. We have not been able to add a test for the case where the remote server version is older than the local server version to the regression test. Is there any way to add such tests to the existing regressi

Re: CREATE INDEX CONCURRENTLY on partitioned index

2023-07-12 Thread Alexander Pyhalov
Justin Pryzby писал 2023-07-13 05:27: On Mon, Mar 27, 2023 at 01:28:24PM +0300, Alexander Pyhalov wrote: Justin Pryzby писал 2023-03-26 17:51: > On Sun, Dec 04, 2022 at 01:09:35PM -0600, Justin Pryzby wrote: > > This currently handles partitions with a loop around the

Re: memory leak in trigger handling (since PG12)

2023-06-22 Thread Alexander Pyhalov
py it into the proper long-lived context (e.g. AfterTriggerEvents). I'll get that fixed. Alexander, can you try if this fixes the issue for you? regard Hi. The patch fixes the problem and looks good to me. -- Best regards, Alexander Pyhalov, Postgres Professional

Re: memory leak in trigger handling (since PG12)

2023-06-22 Thread Alexander Pyhalov
; language C; create trigger test_update after update ON test FOR EACH ROW EXECUTE FUNCTION report_update_fields(); insert into test values (1, 12); update test set j=2; -- Best regards, Alexander Pyhalov, Postgres Professional#include #include #include #include #include #ifdef PG_MODULE_M

Re: Partial aggregates pushdown

2023-06-19 Thread Alexander Pyhalov
'm not saying we shouldn't do it - just hint at possible consequences. -- Best regards, Alexander Pyhalov, Postgres Professional

Re: Partial aggregates pushdown

2023-06-09 Thread Alexander Pyhalov
PostgreSQL is used, And here. Overall the code looks good to me, but I suppose that documentation needs further review from some native speaker. -- Best regards, Alexander Pyhalov, Postgres Professional

Re: Partial aggregates pushdown

2023-06-08 Thread Alexander Pyhalov
fujii.y...@df.mitsubishielectric.co.jp писал 2023-06-08 02:08: From: Alexander Pyhalov Sent: Wednesday, June 7, 2023 6:47 PM This seems to be more robust, but the interface became more strange. I'm not sure what to do with it. Some ideas I had to avoid introducing this parameter. Not s

Re: Partial aggregates pushdown

2023-06-07 Thread Alexander Pyhalov
ate itself - check it. If it's still not found, error out. Also seems to be a bit ugly - you leave uncommitted garbage for vacuum in catalogue. Another issue - the patch misses recording dependency between aggpartialfn and aggregate procedure. -- Best regards, Alexander Pyhalov, Postgres Professional

Re: Partial aggregates pushdown

2023-06-05 Thread Alexander Pyhalov
fujii.y...@df.mitsubishielectric.co.jp писал 2023-06-06 06:08: Hi Mr.Pyhalov. Thank you for your always thoughtful review. From: Alexander Pyhalov Sent: Monday, June 5, 2023 6:00 PM Have found one issue - src/backend/catalog/pg_aggregate.c 585 if(strcmp(strVal(linitial

Re: Partial aggregates pushdown

2023-06-05 Thread Alexander Pyhalov
Bruce Momjian писал 2023-06-05 19:26: On Mon, Jun 5, 2023 at 12:00:27PM +0300, Alexander Pyhalov wrote: Note that after these changes "select sum()" will fail for certain cases, when remote server version is not the latest. In other cases we tried to preserve compatibility. Should

Re: Partial aggregates pushdown

2023-06-05 Thread Alexander Pyhalov
l fail for certain cases, when remote server version is not the latest. In other cases we tried to preserve compatibility. Should we have a switch for a foreign server to turn this optimization off? Or do we just state that users should use different workarounds if remote server version d

Re: buffer refcount leak in foreign batch insert code

2023-05-02 Thread Alexander Pyhalov
the fix down to 14. The buildfarm is digesting it fine. -- Michael Thank you. Sorry for the late response, was on vacation. -- Best regards, Alexander Pyhalov, Postgres Professional

buffer refcount leak in foreign batch insert code

2023-04-21 Thread Alexander Pyhalov
ut it seems that created slots should still be cleared in the end of ExecBatchInsert(). At least the attached patch seems to fix the issue. -- Best regards, Alexander Pyhalov, Postgres ProfessionalCREATE EXTENSION postgres_fdw; DO $d$ BEGIN EXECUTE $$CREATE SERVER loopback FOREIGN

Re: CREATE INDEX CONCURRENTLY on partitioned index

2023-03-27 Thread Alexander Pyhalov
pecifying if we are dealing with a partitioned relation. -- Best regards, Alexander Pyhalov, Postgres Professional

Re: Add semi-join pushdown to postgres_fdw

2023-01-20 Thread Alexander Pyhalov
t style is to break after '&&'. Added comment. It seems to be a rephrasing of lower comment in joinrel_target_ok(). -- Best regards, Alexander Pyhalov, Postgres ProfessionalFrom f37d26d9b622767f94e89034fa8e4fccc69e358d Mon Sep 17 00:00:00 2001 From: Alexander Pyhalov Date: Mon

Re: Inconsistency in vacuum behavior

2023-01-18 Thread Alexander Pyhalov
r can vacuum it" and return success status. -- Best regards, Alexander Pyhalov, Postgres Professional

Re: Inconsistency in vacuum behavior

2023-01-16 Thread Alexander Pyhalov
not suitable for vacuum. Any thoughts or objections? No objections for not throwing an error. -- Best regards, Alexander Pyhalov, Postgres Professional

Re: Inconsistency in vacuum behavior

2023-01-16 Thread Alexander Pyhalov
way. -- Best regards, Alexander Pyhalov, Postgres Professional

Inconsistency in vacuum behavior

2023-01-16 Thread Alexander Pyhalov
nd session. Is it intended? Why don't we perform vacuum_is_permitted_for_relation() check for inheritors in expand_vacuum_rel()? -- Best regards, Alexander Pyhalov, Postgres Professional

Re: Add semi-join pushdown to postgres_fdw

2022-12-06 Thread Alexander Pyhalov
_conds and remote_conds). Not sure if subquery_expr sounds better, but if you come with better idea, I'm fine with renaming them. question4) Although really detail, there is expression making space such as "ft4.c2 = ft2.c2" and one making no space such as "c1=ftupper.c1".

Re: Partial aggregates pushdown

2022-12-01 Thread Alexander Pyhalov
ks as expected. -- Best regards, Alexander Pyhalov, Postgres Professionaldiff --git a/contrib/postgres_fdw/deparse.c b/contrib/postgres_fdw/deparse.c index 35f2d102374..bd8a4acc112 100644 --- a/contrib/postgres_fdw/deparse.c +++ b/contrib/postgres_fdw/deparse.c @@ -3472,9 +3472,9 @@ deparseAggref(A

Re: Partial aggregates pushdown

2022-11-30 Thread Alexander Pyhalov
regards, Alexander Pyhalov, Postgres Professional

Re: Partial aggregates pushdown

2022-11-30 Thread Alexander Pyhalov
ed here. But there is an issue - is_shippable() is too optimistic. -- Best regards, Alexander Pyhalov, Postgres Professional

Re: Partial aggregates pushdown

2022-11-30 Thread Alexander Pyhalov
ts or better should be moved to src/test/regress/sql/create_aggregate.sql, as they are not specific to postgres_fdw -- Best regards, Alexander Pyhalov, Postgres Professional

Re: Partial aggregates pushdown

2022-11-22 Thread Alexander Pyhalov
ndard_ProcessUtility (pstmt=0x562698671a68, queryString=0x5626986705d8 "CREATE AGGREGATE SUM(COMPLEX) (\nSFUNC=sum_complex,\nSTYPE=COMPLEX,\npartialaggfunc=scomplex,\npartialagg_minversion=1400\n);", readOnlyTree=false, context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0, dest=0x562698671b48, qc=0x7ffd1a4053c0) at utility.c:1074 Later will look at it again. -- Best regards, Alexander Pyhalov, Postgres Professional

Re: CREATE INDEX CONCURRENTLY on partitioned index

2022-11-21 Thread Alexander Pyhalov
gards, Alexander Pyhalov, Postgres Professional

Re: Add semi-join pushdown to postgres_fdw

2022-11-06 Thread Alexander Pyhalov
e update the patch. Once you think the patchset is ready for review again, you (or any interested party) can move the patch entry forward by visiting https://commitfest.postgresql.org/40/3838/ and changing the status to "Needs review". Hi. I've rebased the patch. -- B

Re: Add semi-join pushdown to postgres_fdw

2022-08-29 Thread Alexander Pyhalov
xpected. As I see, we have expression FuncExprdate(oid = 2029, args=Var ) = Const(type date) (date(r3.c5) = '1970-01-17'::date). Function is # select proname, provolatile from pg_proc where oid=2029; proname | provolatile -+- date| i So it's shippable. -- Best regards, Alexander Pyhalov, Postgres Professional

Add semi-join pushdown to postgres_fdw

2022-08-24 Thread Alexander Pyhalov
t;T 1" r3 WHERE ((date(r3.c5) = '1970-01-17'::date)) AND ((r1.c3 = r3.c3 Deparsing semi-joins leads to generating (text) conditions like 'EXISTS (SELECT NULL FROM inner_rel WHERE join_conds) . Such conditions are generated in deparseFromExprForRel() and distributed

Re: CREATE INDEX CONCURRENTLY on partitioned index

2022-06-29 Thread Alexander Pyhalov
Justin Pryzby писал 2022-06-28 21:33: Hi, On Thu, Feb 10, 2022 at 06:07:08PM +0300, Alexander Pyhalov wrote: I've rebased patches and tried to fix issues I've seen. I've fixed reference after table_close() in the first patch (can be seen while building with CPPFLAGS='-DRE

Re: CREATE INDEX CONCURRENTLY on partitioned index

2022-06-28 Thread Alexander Pyhalov
Justin Pryzby писал 2022-06-28 21:33: Hi, On Thu, Feb 10, 2022 at 06:07:08PM +0300, Alexander Pyhalov wrote: I've rebased patches and tried to fix issues I've seen. I've fixed reference after table_close() in the first patch (can be seen while building with CPPFLAGS='-DRE

Re: Partial aggregates pushdown

2022-03-22 Thread Alexander Pyhalov
Tomas Vondra писал 2022-03-22 15:28: On 3/22/22 01:49, Andres Freund wrote: On 2022-01-17 15:27:53 +0300, Alexander Pyhalov wrote: Alexander Pyhalov писал 2022-01-17 15:26: Updated patch. Sorry, missed attachment. Needs another update: http://cfbot.cputube.org/patch_37_3369.log Marked as

Re: CREATE INDEX CONCURRENTLY on partitioned index

2022-03-01 Thread Alexander Pyhalov
Hi. I've added 0005-Mark-intermediate-partitioned-indexes-as-valid.patch which fixed the following issues - when partitioned index is created, indexes on intermediate partitioned tables were preserved in invalid state. Also added some more tests. -- Best regards, Alexander Pyhalov, Pos

Re: postgres_fdw and skip locked

2022-02-20 Thread Alexander Pyhalov
Ashutosh Bapat писал 2022-02-17 16:30: On Wed, Feb 16, 2022 at 8:38 PM Alexander Pyhalov wrote: Ashutosh Bapat писал 2022-02-16 16:40: > On Mon, Feb 14, 2022 at 4:23 PM Alexander Pyhalov > wrote: >> > I see that these options will work for all kinds of relations. So no >

Re: postgres_fdw and skip locked

2022-02-16 Thread Alexander Pyhalov
Ashutosh Bapat писал 2022-02-16 16:40: On Mon, Feb 14, 2022 at 4:23 PM Alexander Pyhalov wrote: Hi. Now select ... for update ... [skip locked|nowait] options are not pushed down to remote servers. I see the only reason is that we can speak to pre-9.5 server, which doesn't understand

postgres_fdw and skip locked

2022-02-14 Thread Alexander Pyhalov
ntrol this behavior? -- Best regards, Alexander Pyhalov, Postgres ProfessionalFrom f416cb0afdf42b8ab5375e7a3ccab6e41ebb16ab Mon Sep 17 00:00:00 2001 From: Alexander Pyhalov Date: Mon, 14 Feb 2022 12:01:26 +0300 Subject: [PATCH] postgres_fdw could pass lock wait policy to foreign server --- co

Re: CREATE INDEX CONCURRENTLY on partitioned index

2022-02-10 Thread Alexander Pyhalov
s() and ReindexMultipleInternal() should know how many to correctly update PROGRESS_CREATEIDX_PARTITIONS_DONE counter. Also it needs IndexOid to correctly generate pg_stat_progress_create_index record, so we pass these parameters to it. -- Best regards, Alexander Pyhalov, Postgres ProfessionalFrom

CREATE INDEX CONCURRENTLY on partitioned index

2022-02-09 Thread Alexander Pyhalov
Alexander Pyhalov писал 2022-02-09 15:18: Hi. I've looked at patches, introducing CREATE INDEX CONCURRENTLY for partitioned tables - https://www.postgresql.org/message-id/flat/20210226182019.GU20769%40telsasoft.com#da169a0a518bf8121604437d9ab053b3 . The thread didn't have any acti

Justin Pryzby

2022-02-09 Thread Alexander Pyhalov
f oids and immediately free it, but at least it shouldn't do much harm. -- Best regards, Alexander Pyhalov, Postgres ProfessionalFrom adf4242708c2d86092f7c942c7bbb6ef12e6891b Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Mon, 7 Feb 2022 10:28:42 +0300 Subject: [PATCH 1/4] Allow CREAT

Re: Foreign join search stops on the first try

2022-01-25 Thread Alexander Pyhalov
1:26 PM Alexander Pyhalov wrote: It is surprising that the planning time halves with the patch. I expected it to increase slightly since we will compute estimates thrice instead of once. I wouldn't look at estimate times here precisely (and would looked at costs). Real example where we fou

Foreign join search stops on the first try

2022-01-24 Thread Alexander Pyhalov
e FROM ((test.order_line r1 INNER JOIN test.district r3 ON (((r1.ol_o_id < r3.d_next_o_id)) AND ((r1.ol_o_id >= (r3.d_next_o_id - 20))) AND ((r3.d_id = 1)) AND ((r1.ol_d_id = 1 INNER JOIN test.stock r2 ON (((r1.ol_i_id = r2.s_i_id)) AND ((r2.s_quantity &l

Re: Push down time-related SQLValue functions to foreign server

2022-01-20 Thread Alexander Pyhalov
Tom Lane писал 2022-01-18 23:01: I wrote: Alexander Pyhalov writes: This means we'll translate something like explain select * from t where d > now() - '1 day'::interval; to select * from t where d > $1; Right. After thinking about that a bit more, I see that this w

Re: Push down time-related SQLValue functions to foreign server

2022-01-18 Thread Alexander Pyhalov
Tom Lane писал 2022-01-18 19:53: Alexander Pyhalov writes: [ updated patch ] Thanks for updating the patch. (BTW, please attach version numbers to new patch versions, to avoid confusion.) However, before we proceed any further with this patch, I think we really ought to stop and think

Re: Push down time-related SQLValue functions to foreign server

2022-01-18 Thread Alexander Pyhalov
Hi. Tom Lane писал 2022-01-18 02:08: Alexander Pyhalov writes: Perhaps in a MACRO? Changed this check to a macro, also fixed condition in is_foreign_param() and added test for it. Also fixed comment in prepare_query_params(). I took a quick look at this. I'm unconvinced that you

Re: Partial aggregates pushdown

2022-01-17 Thread Alexander Pyhalov
Alexander Pyhalov писал 2022-01-17 15:26: Zhihong Yu писал 2022-01-17 11:43: Hi, + FdwScanPrivateConvertors + * Generate attinmeta if there are some converters: I think it would be better if converter is spelled the same way across the patch. For build_conv_list(): + if (IS_UPPER_REL

Re: Partial aggregates pushdown

2022-01-17 Thread Alexander Pyhalov
!IS_UPPER_REL(foreignrel) - this would save indentation for the body of the func. Hi. Updated patch. -- Best regards, Alexander Pyhalov, Postgres Professional

Re: Asymmetric partition-wise JOIN

2022-01-17 Thread Alexander Pyhalov
t: t1.a, t2.b Relations: (public.ftprt1_p1 t1) INNER JOIN (public.ftprt2_p1 t2) Remote SQL: SELECT r4.a, r2.b FROM (public.fprt1_p1 r4 INNER JOIN public.fprt2_p1 r2 ON (((r4.a = r2.b)) AND ((r2.c ~~ '%0004')) AND ((r4.a < 250 -- Best regards, Alexander Pyhalov, Pos

Re: Partial aggregates pushdown

2022-01-16 Thread Alexander Pyhalov
Julien Rouhaud писал 2022-01-14 15:16: Hi, On Mon, Nov 15, 2021 at 04:01:51PM +0300, Alexander Pyhalov wrote: I've updated patch - removed catversion dump. This version of the patchset doesn't apply anymore: http://cfbot.cputube.org/patch_36_3369.log === Applying patches

Re: postgres_fdw: incomplete subabort cleanup of connections used in async execution

2021-12-21 Thread Alexander Pyhalov
-subabort (pgfdw_subxact_callback()). This causes a crash when re-executing a query that was aborted in a subtransaction: Hi. Looks good to me. -- Best regards, Alexander Pyhalov, Postgres Professional

Re: Partial aggregates pushdown

2021-11-15 Thread Alexander Pyhalov
Daniel Gustafsson писал 2021-11-15 13:16: On 3 Nov 2021, at 15:50, Alexander Pyhalov wrote: Daniel Gustafsson писал 2021-11-03 16:45: On 2 Nov 2021, at 10:12, Alexander Pyhalov wrote: Updated and rebased patch. + state = (Int128AggState *) palloc0(sizeof(Int128AggState

Re: Partial aggregates pushdown

2021-11-03 Thread Alexander Pyhalov
Daniel Gustafsson писал 2021-11-03 16:45: On 2 Nov 2021, at 10:12, Alexander Pyhalov wrote: Updated and rebased patch. + state = (Int128AggState *) palloc0(sizeof(Int128AggState)); + state->calcSumX2 = false; + + if (!PG_ARGISNULL(0)) + { +#ifdef HAVE_INT

Re: Partial aggregates pushdown

2021-11-02 Thread Alexander Pyhalov
Hi. Updated and rebased patch. Ilya Gladyshev писал 2021-11-02 00:31: Hi, On 21.10.2021 13:55, Alexander Pyhalov wrote: Hi. Updated patch. Now aggregates with internal states can be pushed down, if they are marked as pushdown safe (this flag is set to true for min/max/sum), have internal

Re: Partial aggregates pushdown

2021-11-01 Thread Alexander Pyhalov
Peter Eisentraut писал 2021-11-01 12:47: On 21.10.21 12:55, Alexander Pyhalov wrote: Now aggregates with internal states can be pushed down, if they are marked as pushdown safe (this flag is set to true for min/max/sum), have internal states and associated converters. Converters are called

Re: Partial aggregates pushdown

2021-10-21 Thread Alexander Pyhalov
checked for '-'). -- Best regards, Alexander Pyhalov, Postgres ProfessionalFrom a18e2ff8de00592797e7c3ccb8d6cd536a2e4e72 Mon Sep 17 00:00:00 2001 From: Alexander Pyhalov Date: Thu, 14 Oct 2021 17:30:34 +0300 Subject: [PATCH] Partial aggregates push down --- contrib/postgres_fdw/depar

Re: Partial aggregates pushdown

2021-10-21 Thread Alexander Pyhalov
Tomas Vondra писал 2021-10-19 16:25: On 10/19/21 08:56, Alexander Pyhalov wrote: Hi. Tomas Vondra писал 2021-10-15 17:56: As for the proposed approach, it's probably good enough for the first version to restrict this to aggregates where the aggregate result is sufficient, i.e. we don&#

Re: Partial aggregates pushdown

2021-10-18 Thread Alexander Pyhalov
aggtranstype. -- Best regards, Alexander Pyhalov, Postgres ProfessionalFrom 823a389caf003a21dd4c8e758f89d08ba89c5856 Mon Sep 17 00:00:00 2001 From: Alexander Pyhalov Date: Thu, 14 Oct 2021 17:30:34 +0300 Subject: [PATCH] Partial aggregates push down --- contrib/postgres_fdw/deparse.c

Re: Partial aggregates pushdown

2021-10-15 Thread Alexander Pyhalov
ould it be server property or should it somehow find out it while connecting to the server? -- Best regards, Alexander Pyhalov, Postgres Professional

Partial aggregates pushdown

2021-10-15 Thread Alexander Pyhalov
https://www.postgresql.org/message-id/flat/9998c3af9fdb5f7d62a6c7ad0fcd9142%40postgrespro.ru -- Best regards, Alexander Pyhalov, Postgres ProfessionalFrom f2cf87a0ba1f4e4bf3f5f9e5b10b782c51717baf Mon Sep 17 00:00:00 2001 From: Alexander Pyhalov Date: Thu, 14 Oct 2021 17:30:34 +0300 Subject: [

Re: Function scan FDW pushdown

2021-10-04 Thread Alexander Pyhalov
l local table with a large foreign table by sending the local table rows down to the foreign server. -- Best regards, Alexander Pyhalov, Postgres ProfessionalFrom d997c313daf0031b812d3fca59d338be1a4f2196 Mon Sep 17 00:00:00 2001 From: Alexander Pyhalov Date: Mon, 17 May 2021 19:19:31 +0300 Subje

Re: Defer selection of asynchronous subplans until the executor initialization stage

2021-09-14 Thread Alexander Pyhalov
project and no separate Result is needed in that case, so I modified mark_async_capable_plan() as such, and added test cases to the postgres_fdw regression test. Attached is an updated version of the patch. Hi. The patch looks good to me and seems to work as expected. -- Best regards, Alexander

Re: Push down time-related SQLValue functions to foreign server

2021-08-20 Thread Alexander Pyhalov
nitialized by makeNode(). -- Best regards, Alexander Pyhalov, Postgres Professional

Re: Push down time-related SQLValue functions to foreign server

2021-08-20 Thread Alexander Pyhalov
this list, then the comment is outdated? Fixed comment in the new version of the patches. -- Best regards, Alexander Pyhalov, Postgres Professional

Re: Push down time-related SQLValue functions to foreign server

2021-08-20 Thread Alexander Pyhalov
d comment in prepare_query_params(). -- Best regards, Alexander Pyhalov, Postgres ProfessionalFrom 2cfd3e42cad07ed552a1eb23b06040b0f74a7f2f Mon Sep 17 00:00:00 2001 From: Alexander Pyhalov Date: Thu, 29 Jul 2021 11:45:28 +0300 Subject: [PATCH 1/2] SQLValue functions pushdown current_timestamp, lo

Re: Push down time-related SQLValue functions to foreign server

2021-08-19 Thread Alexander Pyhalov
e, not immutable, so we need additional check. -- Best regards, Alexander Pyhalov, Postgres Professional

Push down time-related SQLValue functions to foreign server

2021-08-19 Thread Alexander Pyhalov
mp with time zone)) explain verbose update test set t=current_timestamp where t -> Foreign Update on public.test (cost=100.00..137.93 rows=414 width=50) Remote SQL: UPDATE data.test SET t = $1::timestamp with time zone WHERE ((t < $1::timestamp with time zone))

Why timestamptz_pl_interval and timestamptz_mi_interval are not immutable?

2021-08-16 Thread Alexander Pyhalov
ostgres=*# select timestamptz '2021-08-18 13:26:59.366452+03' = timestamptz '2021-08-18 10:26:59.366452+00'; ?column? -- t (1 row) What do I miss? -- Best regards, Alexander Pyhalov, Postgres Professional

Re: Case expression pushdown

2021-07-30 Thread Alexander Pyhalov
Tom Lane писал 2021-07-29 23:54: Alexander Pyhalov writes: [ 0001-Allow-pushing-CASE-expression-to-foreign-server-v7.patch ] I looked this over. It's better than before, but the collation handling is still not at all correct. We have to consider that a CASE's arg expression su

Re: Case expression pushdown

2021-07-26 Thread Alexander Pyhalov
Tom Lane писал 2021-07-26 18:18: Alexander Pyhalov writes: [ 0001-Allow-pushing-CASE-expression-to-foreign-server-v6.patch ] This doesn't compile cleanly: deparse.c: In function 'foreign_expr_walker.isra.4': deparse.c:920:8: warning: 'collation' may be used unini

Re: Case expression pushdown

2021-07-22 Thread Alexander Pyhalov
t to fix the existing violations of that rule that I see in deparse.c; but the fact that somebody got this wrong before isn't license to make things worse. regards, tom lane Fixed this. Thanks for review. -- Best regards, Alexander Pyhalov, Postgres ProfessionalFro

Re: Case expression pushdown

2021-07-07 Thread Alexander Pyhalov
Hi. Gilles Darold писал 2021-07-07 15:02: Le 22/06/2021 à 15:39, Alexander Pyhalov a écrit : Seino Yuki писал 2021-06-22 16:03: On 2021-06-16 01:29, Alexander Pyhalov wrote: Hi. Ashutosh Bapat писал 2021-06-15 16:24: Looks quite useful to me. Can you please add this to the next commitfest

PostgreSQL 14 backend crash on incorrect trigger

2021-07-07 Thread Alexander Pyhalov
bplan $2 = {type = T_Result, startup_cost = 0, total_cost = 0, plan_rows = 0, plan_width = 0, parallel_aware = false, parallel_safe = false, async_capable = false, plan_node_id = 0, targetlist = 0x563f06020d40, qual = 0x0, lefttree = 0x0, righttree = 0x0, initPlan = 0x0, extParam = 0x0, al

Re: Asymmetric partition-wise JOIN

2021-07-06 Thread Alexander Pyhalov
AppendRelInfos are copied, because as a part of a subplan its could 285 * be visited many times in the case of asymmetric join. 286 */ 287 foreach(lc, root->append_rel_list) 288 { its -> it (or they) ? -- Best regards, Alexander Pyhalov, Postgres Professional

  1   2   >