Skip to content

Commit

Permalink
MODORDSTOR-409. Indexes to speedup performance of filtering in Receiv…
Browse files Browse the repository at this point in the history
…ing (#422)

* MODORDSTOR-409. Add titles receivingStatus btree+ft, po_line orderFormat ft, purchase_order orderType & workflowStatus ft
  • Loading branch information
SerhiiNosko authored Jul 3, 2024
1 parent 577f0ab commit eb23c19
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/resources/templates/db_scripts/po_line_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ CREATE INDEX IF NOT EXISTS po_line_customfields_recordservice_idx_gin ON ${myuni
USING GIN ((jsonb->'customFields'));

CREATE INDEX IF NOT EXISTS po_line_updated_date_sort ON ${myuniversity}_${mymodule}.po_line
(left(lower(f_unaccent(jsonb->'metadata'->>'updatedDate')),600) DESC,
lower(f_unaccent(jsonb->'metadata'->>'updatedDate')) DESC);
(left(lower(f_unaccent(jsonb->'metadata'->>'updatedDate')),600),
lower(f_unaccent(jsonb->'metadata'->>'updatedDate')));

CREATE INDEX IF NOT EXISTS po_line_title_or_package_sort ON ${myuniversity}_${mymodule}.po_line
(left(lower(f_unaccent(jsonb->>'titleOrPackage')),600) DESC, lower(f_unaccent(po_line.jsonb->>'titleOrPackage')) DESC);
(left(lower(f_unaccent(jsonb->>'titleOrPackage')),600), lower(f_unaccent(po_line.jsonb->>'titleOrPackage')));

CREATE INDEX IF NOT EXISTS po_line_po_line_number_sort ON ${myuniversity}_${mymodule}.po_line
(left(lower(f_unaccent(jsonb->>'poLineNumber')),600) DESC, lower(f_unaccent(po_line.jsonb->>'poLineNumber')) DESC);
(left(lower(f_unaccent(jsonb->>'poLineNumber')),600), lower(f_unaccent(po_line.jsonb->>'poLineNumber')));
19 changes: 19 additions & 0 deletions src/main/resources/templates/db_scripts/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@
"run": "after",
"snippetPath": "purchase_order_table.sql",
"fromModuleVersion": "mod-orders-storage-13.8.0"
},
{
"run": "after",
"snippetPath": "title_table.sql",
"fromModuleVersion": "mod-orders-storage-13.8.0"
}
],
"tables": [
Expand Down Expand Up @@ -238,6 +243,12 @@
},
{
"fieldName": "acqUnitIds"
},
{
"fieldName": "orderType"
},
{
"fieldName": "workflowStatus"
}
],
"ginIndex": [
Expand Down Expand Up @@ -387,6 +398,11 @@
"removeAccents": false,
"arraySubfield": "fundId",
"arrayModifiers": ["fundId"]
},
{
"fieldName": "orderFormat",
"caseSensitive": false,
"removeAccents": true
}
],
"ginIndex": [
Expand Down Expand Up @@ -559,6 +575,9 @@
"fullTextIndex": [
{
"fieldName": "comment"
},
{
"fieldName": "receivingStatus"
}
],
"ginIndex": [
Expand Down
11 changes: 11 additions & 0 deletions src/main/resources/templates/db_scripts/title_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE INDEX IF NOT EXISTS titles_title_sort ON ${myuniversity}_${mymodule}.titles
(left(lower(f_unaccent(titles.jsonb->>'title')), 600), lower(f_unaccent(titles.jsonb->>'title')));

CREATE INDEX IF NOT EXISTS titles_po_line_number_sort ON ${myuniversity}_${mymodule}.titles
(left(lower(f_unaccent(titles.jsonb->>'poLineNumber')), 600), lower(f_unaccent(titles.jsonb->>'poLineNumber')));

CREATE INDEX IF NOT EXISTS titles_receiving_note_sort ON ${myuniversity}_${mymodule}.titles
(left(lower(f_unaccent(titles.jsonb->'poLine'->>'receivingNote')), 600), lower(f_unaccent(titles.jsonb->'poLine'->>'receivingNote')));

CREATE INDEX IF NOT EXISTS titles_package_sort ON ${myuniversity}_${mymodule}.titles
(left(lower(f_unaccent(titles.jsonb->'poLine'->>'titleOrPackage')), 600), lower(f_unaccent(titles.jsonb->'poLine'->>'titleOrPackage')));

0 comments on commit eb23c19

Please sign in to comment.