Skip to content

MODINVSTOR-1528 Add indexes for instance note fields#1316

Open
mweaver-ebsco wants to merge 1 commit intomasterfrom
MODINVSTOR-1528-instance-note-indexes
Open

MODINVSTOR-1528 Add indexes for instance note fields#1316
mweaver-ebsco wants to merge 1 commit intomasterfrom
MODINVSTOR-1528-instance-note-indexes

Conversation

@mweaver-ebsco
Copy link
Contributor

Similar to #1309, this commit adds new indexes for the sub-fields within instance notes and for instance administrative notes. These indexes will be used for querying by FQM (MODFQMMGR-1057).

Purpose

This PR adds indexes for several instance fields. This will enable FQM to efficiently run queries based on these fields. They were identified as commonly used fields in FQM, but none of them have (useful) indexes available right now.

Approach

FQM works by accessing live data via DB views. This means that indexes in the source schema can be used directly by FQM to improve its query performance.

Changes Checklist

  • Database Schema Changes: This adds several DB functions and indexes via SQL scripts. In an upgrade, sysops will probably want to manually run these scripts. If they don't, then the DB objects will still be created, but the upgrade process will hang for a potentially very long time as the indexes are created.
  • Manual Testing: This has been tested in the Corsair eperf rancher environment. I'll be doing further testing before merging, too.
  • NEWS: Confirm that the NEWS file is updated with relevant information about the changes made in this pull request.

Related Issues

MODINVSTOR-1528
MODFQMMGR-1057

Copy link
Collaborator

@psmagin psmagin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @mweaver-ebsco , How many more indexes do you plan to create? I understand that this improves fetch performance, but it also decreases insert/update performance.

@psmagin psmagin self-requested a review February 26, 2026 08:21
@mweaver-ebsco mweaver-ebsco force-pushed the MODINVSTOR-1528-instance-note-indexes branch from adae30a to ada3aac Compare February 27, 2026 17:25
@@ -0,0 +1,6 @@
CREATE INDEX IF NOT EXISTS instance_notes_staffonly_idx ON ${myuniversity}_${mymodule}.instance
USING gin (
${myuniversity}_${mymodule}.normalize_jsonb_array(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, this doesn't need to be normalized, since this is actually stored as a true boolean in the JSONB, but it ends up being easier to work with as a normalized string, and there's basically no overhead in the index

@mweaver-ebsco
Copy link
Contributor Author

@psmagin I'm not entirely sure. These are coming from our PO(s), targeting the most heavily used fields with poor read performance. Looking through our backlog, it looks like there are probably 5 more instance indexes to go (2 for electronic access fields, 2 for contributor fields, and one for series). Fortunately, these indexes are pretty targeted, so they shouldn't put a huge load on the DB (e.g., these notes indexes only affect instances with notes) during writes/updates.

This commit adds new indexes for the sub-fields within instance notes and for instance administrative notes. These
indexes will be used for querying by FQM (MODFQMMGR-1057).
@mweaver-ebsco mweaver-ebsco force-pushed the MODINVSTOR-1528-instance-note-indexes branch from ada3aac to ada4867 Compare March 2, 2026 16:24
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 2, 2026

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.

3 participants