Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-11-29 Thread Robert Haas
On Tue, Nov 29, 2022 at 1:35 PM Andres Freund wrote: > On 2022-11-29 13:30:02 -0500, Tom Lane wrote: > > I still wonder whether we'll regret losing information about the > > subtransaction tree structure, as discussed in the other thread [1]. > > That seems like the main barrier to proceeding

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-11-29 Thread Andres Freund
Hi, On 2022-11-29 13:30:02 -0500, Tom Lane wrote: > I still wonder whether we'll regret losing information about the > subtransaction tree structure, as discussed in the other thread [1]. > That seems like the main barrier to proceeding with this. Yea, this has me worried. I suspect that we have

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-11-29 Thread Tom Lane
Simon Riggs writes: > New version of patch, now just a one-line patch! Of course, there's all the documentation and comments that you falsified. Also, what of the SubTransSetParent call in ProcessTwoPhaseBuffer? (The one in ProcArrayApplyXidAssignment is actually okay, though the comment making

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-11-29 Thread Julien Tachoires
Hi Tomas, Le mar. 29 nov. 2022 à 14:06, Tomas Vondra a écrit : > > On 11/29/22 13:49, Simon Riggs wrote: > > On Thu, 17 Nov 2022 at 17:29, Simon Riggs > > wrote: > > > >> (yes, the last line shows x10 performance patched, that is not a typo) > > > > New version of patch, now just a one-line

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-11-29 Thread Tomas Vondra
On 11/29/22 13:49, Simon Riggs wrote: > On Thu, 17 Nov 2022 at 17:29, Simon Riggs > wrote: > >> (yes, the last line shows x10 performance patched, that is not a typo) > > New version of patch, now just a one-line patch! > > Results show it's still a good win for XidInMVCCSnapshot(). > I'm a

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-11-29 Thread Simon Riggs
On Thu, 17 Nov 2022 at 17:29, Simon Riggs wrote: > (yes, the last line shows x10 performance patched, that is not a typo) New version of patch, now just a one-line patch! Results show it's still a good win for XidInMVCCSnapshot(). -- Simon Riggshttp://www.EnterpriseDB.com/

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-11-18 Thread Simon Riggs
On Thu, 17 Nov 2022 at 20:29, Tomas Vondra wrote: > > On 11/17/22 18:29, Simon Riggs wrote: > > On Thu, 17 Nov 2022 at 17:04, Simon Riggs > > wrote: > >> > > 003 includes the idea to not-always do SubTransSetParent() > > > I'm a bit confused by the TransactionIdsAreOnSameXactPage naming. Isn't

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-11-17 Thread Tomas Vondra
On 11/17/22 18:29, Simon Riggs wrote: > On Thu, 17 Nov 2022 at 17:04, Simon Riggs > wrote: >> >> New version with greatly improved comments coming very soon. > >>> Perhaps it would be a good idea to split up the patch. The business >>> about making pg_subtrans flat rather than a tree seems

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-11-17 Thread Simon Riggs
On Wed, 16 Nov 2022 at 15:44, Tom Lane wrote: > > Simon Riggs writes: > > On Wed, 16 Nov 2022 at 00:09, Tom Lane wrote: > >> No, that's not what XidInMVCCSnapshot does. If snapshot->suboverflowed > >> is set (ie, somebody somewhere/somewhen overflowed), then it does > >>

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-11-16 Thread Tom Lane
Simon Riggs writes: > On Wed, 16 Nov 2022 at 00:09, Tom Lane wrote: >> No, that's not what XidInMVCCSnapshot does. If snapshot->suboverflowed >> is set (ie, somebody somewhere/somewhen overflowed), then it does >> SubTransGetTopmostTransaction and searches only the xips with the result. >> This

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-11-15 Thread Dilip Kumar
On Wed, Nov 16, 2022 at 8:41 AM Simon Riggs wrote: > > > No, that's not what XidInMVCCSnapshot does. If snapshot->suboverflowed > > is set (ie, somebody somewhere/somewhen overflowed), then it does > > SubTransGetTopmostTransaction and searches only the xips with the result. > > This behavior

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-11-15 Thread Simon Riggs
On Wed, 16 Nov 2022 at 00:09, Tom Lane wrote: > > Simon Riggs writes: > > On Tue, 15 Nov 2022 at 21:03, Tom Lane wrote: > >> The subxidStatus.overflowed check quoted above has a similar sort > >> of myopia: it's checking whether our current transaction has > >> already suboverflowed. But (a)

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-11-15 Thread Tom Lane
Simon Riggs writes: > On Tue, 15 Nov 2022 at 21:03, Tom Lane wrote: >> The subxidStatus.overflowed check quoted above has a similar sort >> of myopia: it's checking whether our current transaction has >> already suboverflowed. But (a) that doesn't prove it won't suboverflow >> later, and (b)

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-11-15 Thread Simon Riggs
On Tue, 15 Nov 2022 at 21:03, Tom Lane wrote: > > Simon Riggs writes: > > New version attached. > > I looked at this patch and I do not see how it can possibly be safe. I grant you it is complex, so please bear with me. > The most direct counterexample arises from the fact that >

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-11-15 Thread Tom Lane
Simon Riggs writes: > New version attached. I looked at this patch and I do not see how it can possibly be safe. The most direct counterexample arises from the fact that HeapCheckForSerializableConflictOut checks SubTransGetTopmostTransaction in some cases. You haven't tried to analyze when,

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-11-15 Thread Japin Li
On Tue, 15 Nov 2022 at 17:34, Simon Riggs wrote: > On Mon, 7 Nov 2022 at 21:14, Simon Riggs wrote: > >> These results are compelling, thank you. >> >> Setting this to Ready for Committer. > > New version attached. Take a quick look, I think it should be PGPROC instead of PG_PROC, right? +

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-11-15 Thread Simon Riggs
On Mon, 7 Nov 2022 at 21:14, Simon Riggs wrote: > These results are compelling, thank you. > > Setting this to Ready for Committer. New version attached. -- Simon Riggshttp://www.EnterpriseDB.com/ 002_minimize_calls_to_SubTransSetParent.v12.patch Description: Binary data

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-11-07 Thread Simon Riggs
On Tue, 1 Nov 2022 at 08:55, Julien Tachoires wrote: > > > > 4. Test results with transaction 1 > > > > > > TPS vs number of sub-transaction > > > > > > nsubx HEAD patched > > > > > > 0 441109 439474 > > > 8 439045 438103 > > > 16 439123 436993 > > > 24

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-11-01 Thread Julien Tachoires
Hi, Le mar. 1 nov. 2022 à 09:39, Dilip Kumar a écrit : > > On Fri, Oct 28, 2022 at 10:55 PM Julien Tachoires wrote: > > > > Hi, > > > > Le lun. 26 sept. 2022 à 15:57, Simon Riggs > > a écrit : > > > > > > On Fri, 16 Sept 2022 at 13:20, Simon Riggs > > > wrote: > > > > > > > > Thanks for the

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-11-01 Thread Dilip Kumar
On Fri, Oct 28, 2022 at 10:55 PM Julien Tachoires wrote: > > Hi, > > Le lun. 26 sept. 2022 à 15:57, Simon Riggs > a écrit : > > > > On Fri, 16 Sept 2022 at 13:20, Simon Riggs > > wrote: > > > > > > Thanks for the review. > > > > > > v10 attached > > > > v11 attached, corrected for recent

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-09-26 Thread Simon Riggs
On Fri, 16 Sept 2022 at 13:20, Simon Riggs wrote: > > Thanks for the review. > > v10 attached v11 attached, corrected for recent commit 14ff44f80c09718d43d853363941457f5468cc03. -- Simon Riggshttp://www.EnterpriseDB.com/ 002_minimize_calls_to_SubTransSetParent.v11.patch

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-09-16 Thread Simon Riggs
On Thu, 15 Sept 2022 at 12:36, Japin Li wrote: > > > On Thu, 15 Sep 2022 at 18:04, Simon Riggs > wrote: > > On Wed, 14 Sept 2022 at 15:21, Alvaro Herrera > > wrote: > >> > >> On 2022-Aug-30, Simon Riggs wrote: > >> > >> > 001_new_isolation_tests_for_subxids.v3.patch > >> > Adds new test cases

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-09-15 Thread Japin Li
On Thu, 15 Sep 2022 at 18:04, Simon Riggs wrote: > On Wed, 14 Sept 2022 at 15:21, Alvaro Herrera wrote: >> >> On 2022-Aug-30, Simon Riggs wrote: >> >> > 001_new_isolation_tests_for_subxids.v3.patch >> > Adds new test cases to master without adding any new code, specifically >> > addressing the

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-09-15 Thread Simon Riggs
On Wed, 14 Sept 2022 at 15:21, Alvaro Herrera wrote: > > On 2022-Aug-30, Simon Riggs wrote: > > > 001_new_isolation_tests_for_subxids.v3.patch > > Adds new test cases to master without adding any new code, specifically > > addressing the two areas of code that are not tested by existing tests. >

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-09-14 Thread Alvaro Herrera
On 2022-Aug-30, Simon Riggs wrote: > 001_new_isolation_tests_for_subxids.v3.patch > Adds new test cases to master without adding any new code, specifically > addressing the two areas of code that are not tested by existing tests. > This gives us a baseline from which we can do test driven

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-09-13 Thread Simon Riggs
On Tue, 13 Sept 2022 at 11:56, Simon Riggs wrote: > > On Tue, 6 Sept 2022 at 13:14, Simon Riggs > wrote: > > > I will update the patch, thanks for your scrutiny. > > I attach a diff showing what has changed between v8 and v9, and will > reattach a full set of new patches in the next post, so

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-09-13 Thread Simon Riggs
On Tue, 6 Sept 2022 at 13:14, Simon Riggs wrote: > I will update the patch, thanks for your scrutiny. I attach a diff showing what has changed between v8 and v9, and will reattach a full set of new patches in the next post, so patchtester doesn't squeal. -- Simon Riggs

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-09-06 Thread Simon Riggs
On Tue, 6 Sept 2022 at 12:37, Dilip Kumar wrote: > > On Tue, Aug 30, 2022 at 10:16 PM Simon Riggs > wrote: > > > PFA two patches, replacing earlier work > > 001_new_isolation_tests_for_subxids.v3.patch > > 002_minimize_calls_to_SubTransSetParent.v8.patch > > > >

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-09-06 Thread Dilip Kumar
On Tue, Aug 30, 2022 at 10:16 PM Simon Riggs wrote: > PFA two patches, replacing earlier work > 001_new_isolation_tests_for_subxids.v3.patch > 002_minimize_calls_to_SubTransSetParent.v8.patch > > 001_new_isolation_tests_for_subxids.v3.patch > Adds new test cases to master without adding any new

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-08-30 Thread Simon Riggs
On Thu, 11 Aug 2022 at 06:32, Dilip Kumar wrote: > > > So I still think some adjustment is required in XidInMVCCSnapdhot() > > > > That is one way to resolve the issue, but not the only one. I can also > > change AssignTransactionId() to recursively register parent xids for > > all of a subxid's

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-08-10 Thread Dilip Kumar
On Wed, Aug 10, 2022 at 6:31 PM Simon Riggs wrote: > > On Wed, 10 Aug 2022 at 08:34, Dilip Kumar wrote: > > > > Am I still missing something? > > No, you have found a dependency between the patches that I was unaware > of. So there is no bug if you apply both patches. Right > > > So I still

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-08-10 Thread Simon Riggs
On Wed, 10 Aug 2022 at 08:34, Dilip Kumar wrote: > > Am I still missing something? No, you have found a dependency between the patches that I was unaware of. So there is no bug if you apply both patches. Thanks for looking. > So I still think some adjustment is required in XidInMVCCSnapdhot()

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-08-10 Thread Dilip Kumar
On Tue, Aug 9, 2022 at 9:46 PM Simon Riggs wrote: > Those calls are unaffected, i.e. they both still work. > > Right now, we register all subxids in subtrans. But not all xids are > subxids, so in fact, subtrans has many "holes" in it, where if you > look up the parent for an xid it will just

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-08-09 Thread Simon Riggs
On Tue, 9 Aug 2022 at 12:39, Dilip Kumar wrote: > > This short patchset compiles and passes make check-world, with lengthy > > comments. > > Does this patch set work independently or it has dependency on the > patches on the other thread "Smoothing the subtrans performance > catastrophe"?

Re: SUBTRANS: Minimizing calls to SubTransSetParent()

2022-08-09 Thread Dilip Kumar
On Mon, Aug 8, 2022 at 6:41 PM Simon Riggs wrote: > > On Thu, 4 Aug 2022 at 13:11, Simon Riggs wrote: > > > > On Wed, 3 Aug 2022 at 20:18, Andres Freund wrote: > > > > > I think we should consider redesigning subtrans more substantially - even > > > with > > > the changes you propose here,

SUBTRANS: Minimizing calls to SubTransSetParent()

2022-08-08 Thread Simon Riggs
On Thu, 4 Aug 2022 at 13:11, Simon Riggs wrote: > > On Wed, 3 Aug 2022 at 20:18, Andres Freund wrote: > > > I think we should consider redesigning subtrans more substantially - even > > with > > the changes you propose here, there's still plenty ways to hit really bad > > performance. And