From 604013848c64cb16e9d06ab28eca5995ab77042d Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 25 Jul 2024 09:42:18 +0200 Subject: [PATCH] improve documentation --- doc/rbac-performance-analysis.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/rbac-performance-analysis.md b/doc/rbac-performance-analysis.md index 3747eb29..b3a578b7 100644 --- a/doc/rbac-performance-analysis.md +++ b/doc/rbac-performance-analysis.md @@ -245,9 +245,9 @@ create index on RbacPermission (objectUuid, op); create index on RbacPermission (opTableName, op); ``` -### +### LAZY loading for Relation.anchorPerson/.holderPerson/ -The import took 21mins with these statistics: +At this point, the import took 21mins with these statistics: | query | calls | total_m | mean_ms | |-------|-------|---------|---------| @@ -268,8 +268,6 @@ The import took 21mins with these statistics: | insert into hs_booking_item (resources, version, projectuuid, type, parentitemuuid, validity, uuid, caption) values (new.resources, new. version, new. projectuuid, new. type, new. parentitemuuid, new. validity, new. uuid, new. caption) returning * | 926 | 0 | 7 | -### LAZY loading for Relation.anchorPerson/.holderPerson/ - The slowest query now was fetching Relations joined with Contact, Anchor-Person and Holder-Person, for all tables using the restricted (RBAC) views (_rv). We changed these mappings from `EAGER` (default) to `LAZY` to `@ManyToOne(fetch = FetchType.LAZY)` and got this result: @@ -292,6 +290,12 @@ We changed these mappings from `EAGER` (default) to `LAZY` to `@ManyToOne(fetch | insert into hs_booking_item (resources, version, projectuuid, type, parentitemuuid, validity, uuid, caption) values (new.resources, new. version, new. projectuuid, new. type, new. parentitemuuid, new. validity, new. uuid, new. caption) returning * | 926 | 0 | 7 | insert into RbacGrants (grantedByTriggerOf, ascendantuuid, descendantUuid, assumed) values (currentTriggerObjectUuid(), superRoleId, subRoleId, doAssume) on conflict do nothing | 40472 | 0 | 0 | +Now, finally, the total runtime of the import was down to 12 minutes. This is repeatable, where originally, the import took about 25mins in most cases and just rarely - and for unknown reasons - 10min. +## Summary -Now, finally, the total runtime of the import was down to 12 minutes. +That the import runtime is down to about 12min is repeatable, where originally, the import took about 25mins in most cases and just rarely - and for unknown reasons - just 10min. + +Merging the recursive CTE query to determine the RBAC SELECT-permission, made it more clear which business-queries take the time. + +Avoiding EAGER-loading where not neccessary, reduced the total runtime of the import to about the half.