LP#1904244: schema: add two indexes
authorGalen Charlton <gmc@equinoxOLI.org>
Thu, 3 Jun 2021 15:39:13 +0000 (11:39 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 12 Aug 2021 19:29:26 +0000 (15:29 -0400)
These two indexes support retrieving transactions that account
for a given fund debit.

Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Signed-off-by: Ruth Frasur <rfrasur@library.in.gov>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/sql/Pg/200.schema.acq.sql
Open-ILS/src/sql/Pg/upgrade/WWWW.schema.add_indexes.sql [new file with mode: 0644]

index 0cfb608..2d8678a 100644 (file)
@@ -916,6 +916,7 @@ CREATE TABLE acq.po_item (
 );
 
 CREATE INDEX poi_po_idx ON acq.po_item (purchase_order);
+CREATE INDEX poi_fund_debit_idx ON acq.po_item (fund_debit);
 
 CREATE TABLE acq.invoice_item ( -- for invoice-only debits: taxes/fees/non-bib items/etc
     id              SERIAL      PRIMARY KEY,
@@ -939,6 +940,7 @@ CREATE TABLE acq.invoice_item ( -- for invoice-only debits: taxes/fees/non-bib i
 CREATE INDEX ii_inv_idx on acq.invoice_item (invoice);
 CREATE INDEX ii_po_idx on acq.invoice_item (purchase_order);
 CREATE INDEX ii_poi_idx on acq.invoice_item (po_item);
+CREATE INDEX ii_fund_debit_idx ON acq.invoice_item (fund_debit);
 
 -- Patron requests
 CREATE TABLE acq.user_request_type (
diff --git a/Open-ILS/src/sql/Pg/upgrade/WWWW.schema.add_indexes.sql b/Open-ILS/src/sql/Pg/upgrade/WWWW.schema.add_indexes.sql
new file mode 100644 (file)
index 0000000..30296c0
--- /dev/null
@@ -0,0 +1,6 @@
+BEGIN;
+
+CREATE INDEX poi_fund_debit_idx ON acq.po_item (fund_debit);
+CREATE INDEX ii_fund_debit_idx ON acq.invoice_item (fund_debit);
+
+COMMIT;