cache OPAC-visibility of copies and bibs
authorgmc <gmc@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 12 Jul 2010 16:08:14 +0000 (16:08 +0000)
committergmc <gmc@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 12 Jul 2010 16:08:14 +0000 (16:08 +0000)
commitc1155bee540027de270580a6a6c1d6078bbd478f
tree821115f5c98aad7c32430101db302bd01cd66c41
parentfa369137b18e4daa18be31ae0175f75cc3780e56
cache OPAC-visibility of copies and bibs

Create a new "materialized view" table, asset.opac_visible_copies,
for use during the copy visibility check during OPAC searches.  This
is used by search.query_parser_fts(), replacing a check of a five-table
join for each bib in the search results that proved to be far
too slow on some large databases.

This table is maintained by triggers on inserts and updates to the
following tables:

actor.org_unit
biblio.record_entry
config.copy_status
asset.call_number
asset.copy
asset.copy_location
serial.unit

During a migration or large global change operation, it is recommended
that those triggers be disabled.  To (re)populate the materialized
view, do

SELECT asset.refresh_opac_visible_copies_mat_view();

Thanks to Mike Ryladner for his help with this.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16909 dcc99617-32d9-48b4-a31d-7c20da2025e4
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/040.schema.asset.sql
Open-ILS/src/sql/Pg/300.schema.staged_search.sql
Open-ILS/src/sql/Pg/999.functions.global.sql
Open-ILS/src/sql/Pg/upgrade/0332.schema.opac_visible_copies.sql [new file with mode: 0644]