Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: simplification of user form access view #1088

Closed
wants to merge 2 commits into from

Conversation

bcgov-citz-ccft
Copy link
Collaborator

Description

Very slow performance of the database indicates that the view user_form_access_vw is running very slowly. This view is composed of multiple other views, two of which combine every form versus every user. The EXPLAIN plan shows that the problem appears to be with the role table, which for some reason is taking up a lot of time. In this example it was 1.6s of the 1.8s query time (although when the problem is happening the queries are more like 30-60s):

image
  1. Analysis of the view showed that in two sub-views, the role table is joined but the joins are not necessary.
  2. The sub-views both also have EXISTS clauses where the SELECT has multiple columns - these columns are not needed, something simple like SELECT 1 FROM... is good enough.

Types of changes

Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have read the CONTRIBUTING doc
  • I have checked that unit tests pass locally with my changes
  • I have run the npm script lint on the frontend and backend
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • I have approval from the product owner for the contribution in this pull request

Further comments

Note that user_form_access_vw has to be dropped and recreated because it depends on the other views. There is no change to user_form_access_vw.

@github-actions
Copy link

Coverage Report (Application)

Totals Coverage
Statements: 41.89% ( 2636 / 6292 )
Methods: 36.84% ( 326 / 885 )
Lines: 47.43% ( 1759 / 3709 )
Branches: 32.45% ( 551 / 1698 )

@github-actions
Copy link

Coverage Report (Frontend)

Totals Coverage
Statements: 68.33% ( 1107 / 1620 )
Methods: 66.11% ( 199 / 301 )
Lines: 72.44% ( 778 / 1074 )
Branches: 53.06% ( 130 / 245 )

* fix: simplification of user form access view

* fix: remove the sorting in user_form_access_vw
@github-actions
Copy link

@WalterMoar WalterMoar deleted the fix/database-view-performance branch October 19, 2023 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants