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 #1087

Conversation

WalterMoar
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.

@WalterMoar WalterMoar changed the base branch from master to fix/database-view-performance October 17, 2023 20:48
@WalterMoar WalterMoar marked this pull request as ready for review October 17, 2023 20:48
@bcgov-citz-ccft bcgov-citz-ccft merged commit 8f9528a into bcgov:fix/database-view-performance Oct 17, 2023
8 checks passed
WalterMoar added a commit that referenced this pull request Oct 19, 2023
* fix: simplification of user form access view (#1087)

* fix: database view performance (#1090)

* fix: simplification of user form access view

* fix: remove the sorting in user_form_access_vw

---------

Co-authored-by: Walter Moar <[email protected]>
timisenco2015 added a commit that referenced this pull request Oct 20, 2023
* fix: FORMS-891 vuetify traditional chinese support (#1072)

Co-authored-by: Walter Moar <[email protected]>

* fix: filter out draft submissions on the submission page search

* fix: remove boolean check for filterformSubmissionStatusCode props

* fix: urgent timeout increase to fix outage (#1084)

* Fix/urgent timeout increase (#1085)

* fix: urgent timeout increase to fix outage

* fix: database view performance (#1091)

* fix: simplification of user form access view (#1087)

* fix: database view performance (#1090)

* fix: simplification of user form access view

* fix: remove the sorting in user_form_access_vw

---------

Co-authored-by: Walter Moar <[email protected]>

* fix: FORMS-893 semver vuln and endpoint bug (#1094)

* FORMS-881 - Not allow to save drafts if form validation fails (#1048)

* fix: not allow to save drafts if form validation fails

* fix: make validation run on render for drafts. remove disable save draft button on validation fails

* update: add countdown timer to token expiration warning dialog

- add a countdown timer to the token expiration warning dialog
- wrote unit tests for the frontend changes
- added multi lang to the new components created

* feat: FORMS-882 add submissionId to exports

Co-authored-by: Walter Moar <[email protected]>

* fix: FORMS-899 revert timeout and simplify views (#1093)

* fix: FORMS-899 remove sorting in views

* fix: FORMS-899 revert frontend timeout change

---------

Co-authored-by: Walter Moar <[email protected]>

---------

Co-authored-by: bcgov-citz-ccft <[email protected]>
Co-authored-by: Walter Moar <[email protected]>
Co-authored-by: bcvesalink <[email protected]>
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