Re: Allows Extend Protocol support CURSOR_OPT_HOLD with prepared stmt.

2020-08-11 Thread Andy Fan
On Mon, Jul 27, 2020 at 11:57 AM Andy Fan wrote: > >> 2. Currently I want to add a new GUC parameter, if set it to true, server >> will >> create a holdable portal, or else nothing changed. Then let the user set >> it to true in the above case and reset it to false

Re: Can I test Extended Query in core test framework

2020-08-11 Thread Andy Fan
On Tue, Aug 11, 2020 at 11:22 PM Tom Lane wrote: > Andy Fan writes: > > I want to write some test cases with extended query in core test system. > > Why? (That is, what is it you need to test exactly?) > > Thanks for your attention. The background is I hacked exec_bind_me

Re: Allows Extend Protocol support CURSOR_OPT_HOLD with prepared stmt.

2020-08-12 Thread Andy Fan
On Wed, Aug 12, 2020 at 5:54 PM Dave Cramer wrote: > > > > On Tue, 11 Aug 2020 at 22:33, Andy Fan wrote: > >> >> >> On Mon, Jul 27, 2020 at 11:57 AM Andy Fan >> wrote: >> >>> >>>> 2. Currently I want to add a new GUC parameter,

Re: Allows Extend Protocol support CURSOR_OPT_HOLD with prepared stmt.

2020-08-12 Thread Andy Fan
On Wed, Aug 12, 2020 at 8:11 PM Andy Fan wrote: > > > On Wed, Aug 12, 2020 at 5:54 PM Dave Cramer > wrote: > >> >> >> >> On Tue, 11 Aug 2020 at 22:33, Andy Fan wrote: >> >>> >>> >>> On Mon, Jul 27, 2020 at 11:57 AM

Re: Allows Extend Protocol support CURSOR_OPT_HOLD with prepared stmt.

2020-08-12 Thread Andy Fan
On Wed, Aug 12, 2020 at 8:21 PM Dave Cramer wrote: > > > On Wed, 12 Aug 2020 at 08:14, Andy Fan wrote: > >> >> >> On Wed, Aug 12, 2020 at 8:11 PM Andy Fan >> wrote: >> >>> >>> >>> On Wed, Aug 12, 2020 at 5:54 PM Dave Cramer

Re: Improve planner cost estimations for alternative subplans

2020-08-17 Thread Andy Fan
f invasive, but I think it shouldn't really > add noticeable costs as long as we save relevant rowcounts rather > than recomputing them in createplan.c. Is it worth doing? I dunno. > AlternativeSubPlan is pretty much a backwater, I think --- if it > were interesting performance-wise to a lot of people, more would > have been done with it by now. > > regards, tom lane > > -- Best Regards Andy Fan v1-0001-Convert-the-AlternativeSubplan-to-Subplan-as-soon.patch Description: Binary data

Re: Pulling up direct-correlated ANY_SUBLINK

2020-08-18 Thread Andy Fan
ery->havingQual. 4). no limit/offset cause. 5). No volatile function involved for safety. I can't tell how often it is, I just run into this by my own and search the maillist and get only 1 report [1]. Is it something worth doing or do we have a better strategy to handle it? Thanks! [1] https://www.postgresql.org/message-id/3691.1342650...@sss.pgh.pa.us -- Best Regards Andy Fan

Re: Hybrid Hash/Nested Loop joins and caching results from subplans

2020-08-25 Thread Andy Fan
you've voiced your feelings about this, but what I > > want to know is, how strongly do you feel about overloading the node? > > Will you stand in my way if I want to push ahead with the separate > > node? Will anyone else? > > I feel pretty darn strongly about this. If there's plenty people on your > side I'll not stand in your way, but I think this is a bad design based on > pretty flimsy reasons. > > Nice to see the different opinions from two great guys and interesting to see how this can be resolved at last:) -- Best Regards Andy Fan

Re: Hybrid Hash/Nested Loop joins and caching results from subplans

2020-08-25 Thread Andy Fan
ur feelings about this, but what I > > want to know is, how strongly do you feel about overloading the node? > > Will you stand in my way if I want to push ahead with the separate > > node? Will anyone else? > > I feel pretty darn strongly about this. If there's plenty people on your > side I'll not stand in your way, but I think this is a bad design based on > pretty flimsy reasons. > > Greetings, > > Andres Freund > > > -- Best Regards Andy Fan

Re: Hybrid Hash/Nested Loop joins and caching results from subplans

2020-08-26 Thread Andy Fan
On Wed, Aug 26, 2020 at 8:14 AM David Rowley wrote: > On Wed, 26 Aug 2020 at 05:18, Andy Fan wrote: > > > > > > On Tue, Aug 25, 2020 at 11:53 PM Andres Freund > wrote: > >> > >> On 2020-08-25 20:48:37 +1200, David Rowley wrote: > >> > Als

Re: Improve planner cost estimations for alternative subplans

2020-08-26 Thread Andy Fan
On Mon, Aug 17, 2020 at 10:12 PM Andy Fan wrote: > > > On Mon, Jun 22, 2020 at 9:39 AM Tom Lane wrote: > >> I wrote: >> > Nope. The entire reason why we have that kluge is that we don't know >> > until much later how many times we expect to execute th

How is bushy plans generated in join_search_one_lev

2020-08-26 Thread Andy Fan
x Scan using part_pkey on part Index Cond: (p_partkey = partsupp.ps_partkey) Filter: ((p_name)::text ~~ 'lavender%'::text) (21 rows) -- Best Regards Andy Fan

Re: How is bushy plans generated in join_search_one_lev

2020-08-26 Thread Andy Fan
On Thu, Aug 27, 2020 at 8:05 AM Tom Lane wrote: > Andy Fan writes: > > I do see the README says we support bushy plans and I also see bushy > > plans in real life (for example tpc-h Q20) like below. However I don't > know > > how it is generated with the algorithm

Re: Improve planner cost estimations for alternative subplans

2020-08-28 Thread Andy Fan
On Wed, Aug 26, 2020 at 4:21 PM Andy Fan wrote: > > > On Mon, Aug 17, 2020 at 10:12 PM Andy Fan > wrote: > >> >> >> On Mon, Jun 22, 2020 at 9:39 AM Tom Lane wrote: >> >>> I wrote: >>> > Nope. The entire reason why we have that kluge

Re: Get rid of runtime handling of AlternativeSubPlan?

2020-08-30 Thread Andy Fan
; would overlap partition "part10" CREATE TABLE fail_part PARTITION OF hash_parted2 FOR VALUES WITH (MODULUS 2, REMAINDER 1); psql:src/test/regress/sql/create_table.sql:622: ERROR: partition "fail_part" would overlap partition "h2part_4" [1] https://www.postgresql.org/message-id/07b3fa88-aa4e-2e13-423d-8389eb1712cf%40imap.cc -- Best Regards Andy Fan

Re: Get rid of runtime handling of AlternativeSubPlan?

2020-08-31 Thread Andy Fan
On Tue, Sep 1, 2020 at 1:42 AM Tom Lane wrote: > Andy Fan writes: > > Thank you for this code! I still have some confusion about when a > SubPlan > > should be executed when a join is involved. I care about this because > this > > has an impact on when we can get

Re: Commitfest 2021-11 Patch Triage - Part 1

2021-11-05 Thread Andy Fan
gt; it > gets unstuck. Unless Tom has plans to hack on this shortly? Both Tom and David have provided many insights on this topic. I'd like to hear the decision from Tom and David. -- Best Regards Andy Fan (https://www.aliyun.com/)

Re: Commitfest 2021-11 Patch Triage - Part 1

2021-11-05 Thread Andy Fan
hen we had a discussion. Thanks for taking care of this. [1] https://www.postgresql.org/message-id/flat/CAH2-WzmUscvoxVkokHxP%3DuPTDjSi0tJkFpUPD-CeA35dvn-CMw%40mail.gmail.com is there any hope of > taking this further? Where do we go from here with this patch? > -- Best Regar

Re: using extended statistics to improve join estimates

2021-11-06 Thread Andy Fan
had per-column MCV. Patch 3 -- handle the case like WHERE t1.a = t2.a and t1.b = Const; Patch 3 -- handle the case for 3+ table joins. Patch 4 -- supports the outer join. I think we can do this if we are sure that each individual patch would work in some cases and would not make any other case worse. If you agree with this, I can do that splitting work during my review process. -- Best Regards Andy Fan (https://www.aliyun.com/)

Re: Keep notnullattrs in RelOptInfo (Was part of UniqueKey patch series)

2021-11-08 Thread Andy Fan
only the outer join's pathkey is maintained. As for the extra planning cost of this, it looks like our current infrastructure can support it well since we know all the information when we generate the pathkey for the Join Path. -- Best Regards Andy Fan (https://www.aliyun.com/)

isolation test output format

2021-11-16 Thread Andy Fan
88-12-14 01:03:03 +2', '1988-12-14 01:03:03 +2'); } step "s1read" { SELECT * FROM c_tm; } Is there any simple way to improve this? -- Best Regards Andy Fan

Re: isolation test output format

2021-11-16 Thread Andy Fan
version, the issue here is fixed perfectly. Thanks for that! -- Best Regards Andy Fan

Sequence's value can be rollback after a crashed recovery.

2021-11-21 Thread Andy Fan
lue may surprise them. [I didn't run into this issue in any real case, I just studied xlog / sequence stuff today and found this case]. -- Best Regards Andy Fan

Re: Keep notnullattrs in RelOptInfo (Was part of UniqueKey patch series)

2021-11-21 Thread Andy Fan
Hi Dmitry: On Wed, Nov 17, 2021 at 11:20 PM Dmitry Dolgov <9erthali...@gmail.com> wrote: > > > On Wed, Jul 07, 2021 at 01:20:24PM +1200, David Rowley wrote: > > On Wed, 7 Jul 2021 at 13:04, Andy Fan wrote: > > > Looking forward to watching this change closely, thank

Re: Sequence's value can be rollback after a crashed recovery.

2021-11-21 Thread Andy Fan
ze is 1. Currently It happens every 32 times on the nextval_internal at the worst case. > Perhaps it would make sense to document that you should never rely on > sequence values from an uncommitted transaction. I am OK with this if more people think this is the solution. -- Best Regards Andy Fan

Re: Sequence's value can be rollback after a crashed recovery.

2021-11-22 Thread Andy Fan
his issue. [1] https://www.postgresql.org/message-id/19521.1588183354%40sss.pgh.pa.us -- Best Regards Andy Fan

Re: Sequence's value can be rollback after a crashed recovery.

2021-11-23 Thread Andy Fan
he sequence goes back after a commit, that'd be an actual durability issue. This can't be called a tranaction's durability issue, but people usually think the value of sequence will not rollback. so it may surprise people if that happens. -- Best Regards Andy Fan

Re: Sequence's value can be rollback after a crashed recovery.

2021-11-23 Thread Andy Fan
e: SELECT nextval('s'); -- 1 begin; SELECT nextval('s'); \watch 0.1 for a while, many checkpointer or data flush happened. -- crashed. If we run nextval('s') from the recovered system, we probably will _not_ get the 2 (assume cachesize=1) like uncommitted DML. -- Best Regards Andy Fan

Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-11-28 Thread Andy Fan
ala->memctx); rel->balabala = NULL } For the failed cases: RelationClose(..) { if (RelationHasReferenceCountZero(relation)) release_bala_resource(relation); } Will my suluation work? -- Best Regards Andy Fan

Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-11-29 Thread Andy Fan
On Mon, Nov 29, 2021 at 10:33 PM Tom Lane wrote: > Andy Fan writes: > > During my recent work, I need some new stuff attached to Relation. > Rather > > than adding > > some new data structures, I added it to Relation directly. Like > > relation->balabala.

Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-11-29 Thread Andy Fan
On Mon, Nov 29, 2021 at 10:56 PM Robert Haas wrote: > On Mon, Nov 29, 2021 at 2:10 AM Andy Fan wrote: > > 1. During the ExecutorRun & ExecutorEnd, the relcache will never by > invalidated, if not > > the old relation->balabala will be lost. I assume this is correct

Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-11-29 Thread Andy Fan
like this are unsafe to access as well. Am I missing something? -- Best Regards Andy Fan

Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-11-29 Thread Andy Fan
/www.postgresql.org/message-id/CAKU4AWonyG2_5V+vKaD6GETNNDKbKFL=otwWSEA3UXOJ=rs...@mail.gmail.com [2] https://www.postgresql.org/message-id/CAKU4AWotGB7PH%2BSJk41cgvqxOfeEEvJ1MV%2B6b21_5DMDE8SLXg%40mail.gmail.com -- Best Regards Andy Fan

Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-11-30 Thread Andy Fan
since I bind some executor related data into a relcache related struct. But it should be workable in my modified user case. The most professional method I can think out is adding another resource type in ResourceOwner and let ResourceOwnerRelease to handle the exceptional cases. -- Best Regards Andy Fan

Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-11-30 Thread Andy Fan
On Wed, Dec 1, 2021 at 3:33 AM Robert Haas wrote: > On Tue, Nov 30, 2021 at 4:47 AM Andy Fan wrote: > >> my exception should be that the relcache should not be invalidated > _after the first relation open_ > >> in the executor (not the beginning of executorRun)。 > &g

Looks heap_create_with_catalog ignored the if_not_exists options

2019-03-01 Thread Andy Fan
for a createStmt, it will call transformCreateStmt, and then heap_create_with_catalog. but looks it just check the if_not_exists in transformCreateStmt. so there is a chance that when the transformCreateStmt is called, the table is not created, but before the heap_create_with_catalog is called,

Re: Looks heap_create_with_catalog ignored the if_not_exists options

2019-03-01 Thread Andy Fan
Michael Paquier wrote: > On Fri, Mar 01, 2019 at 07:17:04PM +0800, Andy Fan wrote: > > for a createStmt, it will call transformCreateStmt, and then > > heap_create_with_catalog. > > but looks it just check the if_not_exists in transformCreateStmt. > > > > is it

any plan to support shared servers like Oracle in PG?

2019-03-05 Thread Andy Fan
currently there is one process per connection and it will not not very good for some short time connection.In oracle database, it support shared server which can serve more than 1 users at the same time. See https://docs.oracle.com/cd/B28359_01/server.111/b28310/manproc001.htm#ADMIN11166 do

Re: any plan to support shared servers like Oracle in PG?

2019-03-07 Thread Andy Fan
thank you for this information! takes 2 days to read the discussion.. On Wed, Mar 6, 2019 at 3:13 AM legrand legrand wrote: > There already are solutions regarding this feature in Postgres > using "connection pooler" wording > > see > > pgpool: http://www.pgpool.net/mediawiki/index.php/Main_Pa

what makes the PL cursor life-cycle must be in the same transaction?

2019-03-10 Thread Andy Fan
for example: begin; declare cur cursor for select * from t; insert into t2 values(...); fetch next cur; commit; // after this, I can't fetch cur any more. My question are: 1. Is this must in principle? or it is easy to implement as this in PG? 2. Any bad thing would happen if I keep the named

Re: what makes the PL cursor life-cycle must be in the same transaction?

2019-03-10 Thread Andy Fan
DECLARE cur CURSOR with hold FOR SELECT * FROM t; the "with hold" is designed for this purpose. sorry for this interruption. On Sun, Mar 10, 2019 at 4:14 PM Andy Fan wrote: > for example: > begin; > declare cur cursor for select * from t; > insert into t2 values(

I have some troubles to run test_shm_mq;

2019-03-11 Thread Andy Fan
My code is based on commit zhifan@zhifandeMacBook-Pro ~/g/polardb_clean> git log commit d06fe6ce2c79420fd19ac89ace81b66579f08493 Author: Tom Lane Date: Tue Nov 6 18:56:26 2018 -0500 what I did includes: 1. ./configure --enable-debug 2. make world // doesn't see the test_shm_mq on the outp

Re: I have some troubles to run test_shm_mq;

2019-03-11 Thread Andy Fan
Works, thank you Thomas! I have spent more than 2 hours on this. do you know which document I miss for this question? Thanks On Mon, Mar 11, 2019 at 4:05 PM Thomas Munro wrote: > On Mon, Mar 11, 2019 at 8:59 PM Andy Fan wrote: > > 4. CREATE EXTENSION test_shm_mq; ==> . co

Re: I have some troubles to run test_shm_mq;

2019-03-11 Thread Andy Fan
and whenever I run a simple query "SELECT test_shm_mq(1024, 'a');" I see the following log 2019-03-11 16:33:17.800 CST [65021] LOG: background worker "test_shm_mq" (PID 65052) exited with exit code 1 does it indicates something wrong? On Mon, Mar 11, 2

Re: I have some troubles to run test_shm_mq;

2019-03-11 Thread Andy Fan
Thanks for the clarification! On Mon, Mar 11, 2019 at 5:02 PM Thomas Munro wrote: > On Mon, Mar 11, 2019 at 9:35 PM Andy Fan wrote: > > and whenever I run a simple query "SELECT test_shm_mq(1024, 'a');" > > > > I see the following log > &

Suggestions on message transfer among backends

2019-03-11 Thread Andy Fan
Hi: I need some function which requires some message exchange among different back-ends (connections). specially I need a shared hash map and a message queue. Message queue: it should be many writers, 1 reader. Looks POSIX message queue should be OK, but postgre doesn't use it. is there any

Re: Suggestions on message transfer among backends

2019-03-11 Thread Andy Fan
notes on the shared hash map: it needs multi writers and multi readers. On Mon, Mar 11, 2019 at 9:36 PM Andy Fan wrote: > Hi: > I need some function which requires some message exchange among > different back-ends (connections). > specially I need a shared hash map and a m

Re: Suggestions on message transfer among backends

2019-03-11 Thread Andy Fan
On Tue, Mar 12, 2019 at 1:59 PM Andrey Lepikhov wrote: > On 11/03/2019 18:36, Andy Fan wrote: > > Hi: > >I need some function which requires some message exchange among > > different back-ends (connections). > > specially I need a shared hash map and a message q

Re: Suggestions on message transfer among backends

2019-03-12 Thread Andy Fan
On Tue, Mar 12, 2019 at 2:36 PM Andy Fan wrote: > On Tue, Mar 12, 2019 at 1:59 PM Andrey Lepikhov > wrote: > >> On 11/03/2019 18:36, Andy Fan wrote: >> > Hi: >> >I need some function which requires some message exchange among >> > different back-e

why doesn't optimizer can pull up where a > ( ... )

2019-11-20 Thread Andy Fan
Hi Hackers: First I found the following queries running bad on pg. select count(*) from part2 p1 where p_size > 40 and p_retailprice > (select avg(p_retailprice) from part2 p2 where p2.p_brand=p1.p_brand); the plan is QUERY PLAN

Re: why doesn't optimizer can pull up where a > ( ... )

2019-11-20 Thread Andy Fan
On Wed, Nov 20, 2019 at 8:15 PM Andy Fan wrote: > Hi Hackers: > > First I found the following queries running bad on pg. > > select count(*) from part2 p1 where p_size > 40 and p_retailprice > > (select avg(p_retailprice) from part2 p2 where p2.p_brand=p1.p

Re: why doesn't optimizer can pull up where a > ( ... )

2019-11-20 Thread Andy Fan
> > > Hm. That actually raises the stakes a great deal, because if that's > what you're expecting, it would require planning out both the transformed > and untransformed versions of the query before you could make a cost > comparison. I don't know an official name, let's call it as "bloom filte

Re: function calls optimization

2019-11-20 Thread Andy Fan
On Thu, Oct 31, 2019 at 11:07 PM Tom Lane wrote: > > > Possibly this could be finessed by only trying to find duplicates of > functions that have high cost estimates. Not sure how high is high > enough. can we just add a flag on pg_proc to show if the cost is high or not, if user are not happ

Re: why doesn't optimizer can pull up where a > ( ... )

2019-11-21 Thread Andy Fan
On Thu, Nov 21, 2019 at 6:12 PM Tomas Vondra wrote: > On Thu, Nov 21, 2019 at 08:30:51AM +0800, Andy Fan wrote: > >> > >> > >> Hm. That actually raises the stakes a great deal, because if that's > >> what you're expecting, it would req

Dynamic gathering the values for seq_page_cost/xxx_cost

2019-11-25 Thread Andy Fan
The optimizer cost model usually needs 2 inputs, one is used to represent data distribution and the other one is used to represent the capacity of the hardware, like cpu/io let's call this one as system stats. In Oracle database, the system stats can be gathered with dbms_stats.gather_system_stat

Re: Planner chose a much slower plan in hashjoin, using a large table as the inner table.

2019-11-28 Thread Andy Fan
On Fri, Nov 22, 2019 at 6:51 PM Jinbao Chen wrote: > Hi hackers, > > I have made a patch to fix the problem. > > Added the selection rate of the inner table non-empty bucket > > The planner will use big table as inner table in hash join > if small table have fewer unique values. But this plan is

Re: Planner chose a much slower plan in hashjoin, using a large table as the inner table.

2019-11-28 Thread Andy Fan
ate_series(1, 1)i ; > analyze t_small; > analyze t_big; > set max_parallel_workers_per_gather = 0; > > On Thu, Nov 28, 2019 at 5:46 PM Andy Fan wrote: > >> >> >> On Fri, Nov 22, 2019 at 6:51 PM Jinbao Chen wrote: >> >>> Hi hacke

what is the purpose to use 3 function to compare cost add_path/set_cheapest/get_cheapest_fractional_path

2019-12-05 Thread Andy Fan
Hello Hackers: I'm reading the code of optimizer and get confused about the 3 functions. add_path/set_cheapest/get_cheapest_fractional_path add_(partial_)path: For every relations, optimizer will build path for it and add then call add_path to the rel->pathlist. during this stage, *it compa

How to make a OpExpr check compatible among different versions

2020-01-12 Thread Andy Fan
During one of my works for logical rewrite, I want to check if the expr is a given Expr. so the simplest way is: if (expr->opno == 418 && nodeTag(linitial(expr->args)) == T_xxx && nodeTag(lsecond(expr->args)) == T_ ) { .. } if we write code like above, we may have issues if the oid change

Re: How to make a OpExpr check compatible among different versions

2020-01-13 Thread Andy Fan
On Mon, Jan 13, 2020 at 4:09 PM Peter Eisentraut < peter.eisentr...@2ndquadrant.com> wrote: > On 2020-01-13 08:29, Andy Fan wrote: > > During one of my works for logical rewrite, I want to check if the expr > > is a given Expr. > > > > so the simplest way is: >

[PATCH] query rewrite for distinct stage under some cases

2020-01-19 Thread Andy Fan
Hi Hackers: This is a patch for unique elimination rewrite for distinct query. it will cost much for a big result set and some times it is not necessary. The basic idea is the unique node like in the following can be eliminated. 1. select distinct pk, ... from t; 2. select distinct uk-col1

How to include the header files effectively

2019-04-11 Thread Andy Fan
I find the dependency is complex among header files in PG. At the same time, I find the existing code still can use the header file very cleanly/alphabetically. so I probably missed some knowledge here. for example, when I want the LOCKTAG in .c file, which is defined in "storage/lock.h".

Question about the holdable cursor

2019-04-18 Thread Andy Fan
when I fetch from holdable cursor, I found the fact is more complex than I expected. suppose we fetched 20 rows. 1). It will fill a PortalStore, the dest is not the client, it is the DestTupleStore, called ExecutePlan once and receiveSlot will be call 20 times. 2). the portal for client then

Re: Question about the holdable cursor

2019-04-18 Thread Andy Fan
On Thu, Apr 18, 2019 at 10:09 PM Tom Lane wrote: > Andy Fan writes: > > when I fetch from holdable cursor, I found the fact is more complex > than I > > expected. > > ... > > why the 3rd time is necessary and will the performance be bad due to this > > desi

Re: the s_lock_stuck on perform_spin_delay

2024-01-10 Thread Andy Fan
Hi Matthias, Thanks for the review! Matthias van de Meent writes: > On Wed, 10 Jan 2024 at 02:44, Andy Fan wrote: >> Hi, >> >> I want to know if Andres or you have plan >> to do some code review. I don't expect this would happen very soon, just >> want

Re: the s_lock_stuck on perform_spin_delay

2024-01-10 Thread Andy Fan
Robert Haas writes: > Thanks for jumping in with a review, Matthias! FWIW, Matthias is also the first one for this proposal at this thread, thanks for that as well! -- Best Regards Andy Fan

Re: the s_lock_stuck on perform_spin_delay

2024-01-14 Thread Andy Fan
Robert Haas writes: > On Wed, Jan 10, 2024 at 10:17 PM Andy Fan wrote: >> fixed in v2. > > Timing the spinlock wait seems like a separate patch from the new sanity > checks. Yes, a separate patch would be better, so removed it from v4. > I suspect that the new sanity

Re: Strange Bitmapset manipulation in DiscreteKnapsack()

2024-01-17 Thread Andy Fan
he code, the worst case is much worse. > Looks like this is another user case of "user just wants to zero out the flags in bitmapset but keeping the memory allocation". [1] https://www.postgresql.org/message-id/flat/87il4jrk1l@163.com -- Best Regards Andy Fan

Re: Strange Bitmapset manipulation in DiscreteKnapsack()

2024-01-17 Thread Andy Fan
Hi, David Rowley writes: > On Thu, 18 Jan 2024 at 14:58, Andy Fan wrote: >> I want to know if "user just want to zero out the flags in bitmapset >> but keeping the memory allocation" is a valid requirement. Commit >> 00b41463c makes it is hard IIUC. &

Re: Strange Bitmapset manipulation in DiscreteKnapsack()

2024-01-18 Thread Andy Fan
s the github.com now so I can't test my idea, but basiclly I think we may need some improvement here. like 'sets[i] = NULL;' at the first and remove the bms_del_member later. -- Best Regards Andy Fan

Make a Bitset which is resetable

2024-01-18 Thread Andy Fan
ZYA%40mail.gmail.com Any feedback is welcome. -- Best Regards Andy Fan >From 0ee7e4789e58d6820e4c1ff62979910c0b01cdbb Mon Sep 17 00:00:00 2001 From: "yizhi.fzh" Date: Thu, 18 Jan 2024 16:52:30 +0800 Subject: [PATCH v1 1/1] Introduce a Bitset data struct. While Bitmapset is designed for variabl

Re: the s_lock_stuck on perform_spin_delay

2024-01-18 Thread Andy Fan
Hi Matthias / Robert: Do you still have interest with making some progress on this topic? > Robert Haas writes: > >> On Wed, Jan 10, 2024 at 10:17 PM Andy Fan wrote: >>> fixed in v2. >> >> Timing the spinlock wait seems like a separate patch from the new sanit

Re: the s_lock_stuck on perform_spin_delay

2024-01-18 Thread Andy Fan
Hi Robert, Thanks for your attention! > On Thu, Jan 18, 2024 at 7:56 AM Andy Fan wrote: >> Do you still have interest with making some progress on this topic? > > Some, but it's definitely not my top priority. I wish I could give as > much attention as everyone w

Re: the s_lock_stuck on perform_spin_delay

2024-01-18 Thread Andy Fan
e previous question. But I disagree with > Matthias -- I don't think miscadmin.h can be the right answer > regardless. > -- Best Regards Andy Fan

Re: Strange Bitmapset manipulation in DiscreteKnapsack()

2024-01-18 Thread Andy Fan
David Rowley writes: > On Fri, 19 Jan 2024 at 01:07, Andy Fan wrote: >> I find the following code in DiscreteKnapsack is weird. >> >> >> for (i = 0; i <= max_weight; ++i) >> { >> values[i] = 0; >> >> ** me

Re: the s_lock_stuck on perform_spin_delay

2024-01-18 Thread Andy Fan
nd on the previous question. But I disagree with >> Matthias -- I don't think miscadmin.h can be the right answer >> regardless. I put it into spin.h this time in commit 1, and include the extern function VerifyNoSpinLocksHeld in spin.c into miscadmin.h like what we did fo

Re: the s_lock_stuck on perform_spin_delay

2024-01-21 Thread Andy Fan
Hi, Andy Fan writes: > Hi, > > v6 attached which addressed all the items Robert suggested except the > following 2 open items. They are handled differently. > >> >> Here is the summary of the open-items, it would be great that Andres and >> Matthias have a

Re: cleanup patches for dshash

2024-01-21 Thread Andy Fan
} Assert(strlen((const char *) a) < DSMRegistryNameSize); -- Best Regards Andy Fan

Re: the s_lock_stuck on perform_spin_delay

2024-01-21 Thread Andy Fan
Andy Fan writes: > I found a speical case about checking it in errstart. So commit 3 in v7 > is added. > > commit 757c67c1d4895ce6a523bcf5217af8eb2351e2a1 (HEAD -> s_stuck_v3) > Author: yizhi.fzh > Date: Mon Jan 22 07:14:29 2024 +0800 > > Bypass SpinLock

Re: the s_lock_stuck on perform_spin_delay

2024-01-22 Thread Andy Fan
Robert Haas writes: > On Mon, Jan 22, 2024 at 2:22 AM Andy Fan wrote: >> I used sigismember(&BlockSig, SIGQUIT) to detect if a process is doing a >> quickdie, however this is bad not only because it doesn't work on >> Windows, but also it has too poor

Re: the s_lock_stuck on perform_spin_delay

2024-01-22 Thread Andy Fan
Robert Haas writes: > On Mon, Jan 22, 2024 at 11:58 AM Andy Fan wrote: >> I get your point! Acquiring an already held spinlock in quickdie is >> unlikely to happen, but since our existing infrastructure can handle it, >> then there is no reason to bypass it.

Re: the s_lock_stuck on perform_spin_delay

2024-01-22 Thread Andy Fan
Robert Haas writes: > On Mon, Jan 22, 2024 at 12:13 PM Andy Fan wrote: >> > On Mon, Jan 22, 2024 at 11:58 AM Andy Fan wrote: >> >> I get your point! Acquiring an already held spinlock in quickdie is >> >> unlikely to happen, but since our existing infr

Re: Shared detoast Datum proposal

2024-01-22 Thread Andy Fan
, including the jsonb_out function. I think this would be not rare to happen. -- Best Regards Andy Fan

Re: Shared detoast Datum proposal

2024-01-23 Thread Andy Fan
[1] https://postgr.es/m/CAApHDvpdp9LyAoMXvS7iCX-t3VonQM3fTWCmhconEvORrQ%2BZYA%40mail.gmail.com [2] https://postgr.es/m/875xzqxbv5.fsf%40163.com As for the commit "Introduce a Bitset data struct.", the test coverage is 100% now. So it would be great that people can review this first

Re: the s_lock_stuck on perform_spin_delay

2024-01-24 Thread Andy Fan
Hi, > Hi, > > On 2024-01-22 15:18:35 +0800, Andy Fan wrote: >> I used sigismember(&BlockSig, SIGQUIT) to detect if a process is doing a >> quickdie, however this is bad not only because it doesn't work on >> Windows, but also it has too poor performance even

Re: the s_lock_stuck on perform_spin_delay

2024-01-24 Thread Andy Fan
buffer header locks. The exact same dangers apply > there. The only reason this isn't using a plain spinlock is that this way we > can modify more state with a single atomic operation. But all the dangers of > using spinlocks apply just as well. Thanks for speaking on this! -- Best Regards Andy Fan

Re: Properly pathify the union planner

2024-02-06 Thread Andy Fan
>setop_pathkeys, pathkeys, + &n_common_pathkeys); + + return n_common_pathkeys; +} The two if-clauses looks unnecessary, it should be handled by pathkeys_count_contained_in already. The same issue exists in pathkeys_useful_for_o

Re: the s_lock_stuck on perform_spin_delay

2024-02-08 Thread Andy Fan
; - spinlock_prepare_spin() - about to spin waiting for a spinlock > like the current init_spin_delay() > > This would get called in s_lock(), LockBufHdr() etc. > > > - spinlock_finish_spin() - completed waiting for a spinlock > like the current finish_spin_delay() > > This w

Re: Extract numeric filed in JSONB more effectively

2024-02-09 Thread Andy Fan
the previous version. I'm not sure which way is better, but this is the place the current feature is blocked. 3. what do I want now? Since this feature uses the planner support function which needs some catalog changes, so it is better that we can merge this feature in PG17, or else, we have

Re: Question about pull_up_sublinks_qual_recurse

2023-03-20 Thread Andy Fan
On Sat, Oct 15, 2022 at 3:27 AM Tom Lane wrote: > Andy Fan writes: > > After some more self review, I find my proposal has the following side > > effects. > > Yeah, I do not think this works at all. The discussion of outer join > reordering in optimizer/READM

Re: a wrong index choose when statistics is out of date

2024-03-30 Thread Andy Fan
costs off) select * from t where a = 109 and b = 8; explain (costs off, analyze) select * from t join t2 on t.c = t2.id where t.a = 109; I will add this to our commitfest application, any feedback is welcome! -- Best Regards Andy Fan >From 0d842e39275710a544b11033f5eec476147daf06 Mon Sep 1

Re: Extract numeric filed in JSONB more effectively

2024-03-31 Thread Andy Fan
message-id/8734t6c5rh.fsf%40163.com -- Best Regards Andy Fan >From fb38be5addb93d7c0b8c1a3e8376751c9b3be5f5 Mon Sep 17 00:00:00 2001 From: "yizhi.fzh" Date: Mon, 1 Apr 2024 09:36:08 +0800 Subject: [PATCH v17 1/1] Improve the performance of Jsonb numeric/bool extraction. JSO

Re: [HACKERS] make async slave to wait for lsn to be replayed

2024-04-01 Thread Andy Fan
+pg_wal_replay_wait ( + target_lsn pg_lsn, + timeout bigint DEFAULT 0) +void + Should we return the millseconds of waiting time? I think this information may be useful for customer if they want to know how long time it waits for for minitor purpose. -- Best Regards Andy Fan

Re: [HACKERS] make async slave to wait for lsn to be replayed

2024-04-02 Thread Andy Fan
now how long time it waits unless they check it in application side, I think such information will be useful for monitor purpose sometimes. select pg_wal_replay_wait(lsn, 1000); may just take 1ms in fact, in this case, I want this function return 1. -- Best Regards Andy Fan

Re: using extended statistics to improve join estimates

2024-04-02 Thread Andy Fan
h, and I think it can be committed individually if you are OK with that. Hope this kind of review is helpful. -- Best Regards Andy Fan >From daa6c27bc7dd0631607f0f254cc15491633a9ccc Mon Sep 17 00:00:00 2001 From: Tomas Vondra Date: Mon, 13 Dec 2021 14:05:17 +0100 Subject: [PATCH v1 1/8] Es

Re: [HACKERS] make async slave to wait for lsn to be replayed

2024-04-02 Thread Andy Fan
how to make sure the "read your writes consistency" internally, and the soluation here looks good to me. Glad to know that this patch will be committed very soon. [1] https://www.postgresql.org/message-id/CAPpHfdtuiL1x4APTs7u1fCmxkVp2-ZruXcdCfprDMdnOzvdC%2BA%40mail.gmail.com -- Best Regards Andy Fan

Re: using extended statistics to improve join estimates

2024-04-02 Thread Andy Fan
Tomas Vondra writes: > On 4/2/24 10:23, Andy Fan wrote: >> >>> On Wed, Mar 02, 2022 at 11:38:21AM -0600, Justin Pryzby wrote: >>>> Rebased over 269b532ae and muted compiler warnings. >> >> Thank you Justin for the rebase! >> >> Hello T

Re: [HACKERS] make async slave to wait for lsn to be replayed

2024-04-03 Thread Andy Fan
replay_wait() and spreading words about it > at conferences would be highly appreciated. Sure, once it is committed, I promise I can doing a knowledge sharing in our organization and write a article in chinese language. -- Best Regards Andy Fan

Replace FunctionCall2Coll with FunctionCallInvoke

2024-04-07 Thread Andy Fan
if such changes is necessary at the first place. [1] https://www.postgresql.org/message-id/c8c0ff31-3a8a-7562-bbd3-78b2ec65f16c%40enterprisedb.com -- Best Regards Andy Fan >From e852ce631f9348d5d29c8a53090ee71f7253767c Mon Sep 17 00:00:00 2001 From: "yizhi.fzh" Date: M

Re: Replace FunctionCall2Coll with FunctionCallInvoke

2024-04-07 Thread Andy Fan
Hello Michael, > [[PGP Signed Part:Undecided]] > On Mon, Apr 08, 2024 at 12:25:00PM +0800, Andy Fan wrote: >> During the review of using extended statistics to improve join estimates >> [1], I found some code level optimization opportunities which apply to >> existi

<    1   2   3   4   5   6   7   >