mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-23 18:03:11 +00:00
Add indexes to foreign key columns to avoid database contention
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2651 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -136,6 +136,8 @@ CREATE TABLE FileExtension
|
|||||||
extension VARCHAR(16)
|
extension VARCHAR(16)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX fe_bitstream_fk_idx ON FileExtension(bitstream_format_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Bitstream table
|
-- Bitstream table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -156,6 +158,8 @@ CREATE TABLE Bitstream
|
|||||||
sequence_id INTEGER
|
sequence_id INTEGER
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX bit_bitstream_fk_idx ON Bitstream(bitstream_format_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- EPerson table
|
-- EPerson table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -201,6 +205,9 @@ CREATE TABLE Group2Group
|
|||||||
child_id INTEGER REFERENCES EPersonGroup(eperson_group_id)
|
child_id INTEGER REFERENCES EPersonGroup(eperson_group_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX g2g_parent_fk_idx ON Group2Group(parent_id);
|
||||||
|
CREATE INDEX g2g_child_fk_idx ON Group2Group(child_id);
|
||||||
|
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
-- Group2GroupCache table, is the 'unwound' hierarchy in
|
-- Group2GroupCache table, is the 'unwound' hierarchy in
|
||||||
-- Group2Group. It explicitly names every parent child
|
-- Group2Group. It explicitly names every parent child
|
||||||
@@ -217,6 +224,9 @@ CREATE TABLE Group2GroupCache
|
|||||||
child_id INTEGER REFERENCES EPersonGroup(eperson_group_id)
|
child_id INTEGER REFERENCES EPersonGroup(eperson_group_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX g2gc_parent_fk_idx ON Group2Group(parent_id);
|
||||||
|
CREATE INDEX g2gc_child_fk_idx ON Group2Group(child_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Item table
|
-- Item table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -230,6 +240,8 @@ CREATE TABLE Item
|
|||||||
owning_collection INTEGER
|
owning_collection INTEGER
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX item_submitter_fk_idx ON Item(submitter_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Bundle table
|
-- Bundle table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -240,6 +252,8 @@ CREATE TABLE Bundle
|
|||||||
primary_bitstream_id INTEGER REFERENCES Bitstream(bitstream_id)
|
primary_bitstream_id INTEGER REFERENCES Bitstream(bitstream_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX bundle_primary_fk_idx ON Bundle(primary_bitstream_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Item2Bundle table
|
-- Item2Bundle table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -253,6 +267,8 @@ CREATE TABLE Item2Bundle
|
|||||||
-- index by item_id
|
-- index by item_id
|
||||||
CREATE INDEX item2bundle_item_idx on Item2Bundle(item_id);
|
CREATE INDEX item2bundle_item_idx on Item2Bundle(item_id);
|
||||||
|
|
||||||
|
CREATE INDEX item2bundle_bundle_fk_idx ON Item2Bundle(bundle_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Bundle2Bitstream table
|
-- Bundle2Bitstream table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -266,6 +282,8 @@ CREATE TABLE Bundle2Bitstream
|
|||||||
-- index by bundle_id
|
-- index by bundle_id
|
||||||
CREATE INDEX bundle2bitstream_bundle_idx ON Bundle2Bitstream(bundle_id);
|
CREATE INDEX bundle2bitstream_bundle_idx ON Bundle2Bitstream(bundle_id);
|
||||||
|
|
||||||
|
CREATE INDEX bundle2bitstream_bitstream_fk_idx ON Bundle2Bitstream(bitstream_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Metadata Tables and Sequences
|
-- Metadata Tables and Sequences
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -309,6 +327,7 @@ CREATE VIEW dcvalue AS
|
|||||||
-- related to that item
|
-- related to that item
|
||||||
CREATE INDEX metadatavalue_item_idx ON MetadataValue(item_id);
|
CREATE INDEX metadatavalue_item_idx ON MetadataValue(item_id);
|
||||||
CREATE INDEX metadatavalue_item_idx2 ON MetadataValue(item_id,metadata_field_id);
|
CREATE INDEX metadatavalue_item_idx2 ON MetadataValue(item_id,metadata_field_id);
|
||||||
|
CREATE INDEX metadatavalue_field_fk_idx ON MetadataValue(metadata_field_id);
|
||||||
CREATE INDEX metadatafield_schema_idx ON MetadataFieldRegistry(metadata_schema_id);
|
CREATE INDEX metadatafield_schema_idx ON MetadataFieldRegistry(metadata_schema_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -325,6 +344,8 @@ CREATE TABLE Community
|
|||||||
side_bar_text TEXT
|
side_bar_text TEXT
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX community_logo_fk_idx ON Community(logo_bitstream_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Collection table
|
-- Collection table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -347,6 +368,14 @@ CREATE TABLE Collection
|
|||||||
admin INTEGER REFERENCES EPersonGroup( eperson_group_id)
|
admin INTEGER REFERENCES EPersonGroup( eperson_group_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX collection_logo_fk_idx ON Collection(logo_bitstream_id);
|
||||||
|
CREATE INDEX collection_template_fk_idx ON Collection(template_item_id);
|
||||||
|
CREATE INDEX collection_workflow1_fk_idx ON Collection(workflow_step_1);
|
||||||
|
CREATE INDEX collection_workflow2_fk_idx ON Collection(workflow_step_2);
|
||||||
|
CREATE INDEX collection_workflow3_fk_idx ON Collection(workflow_step_3);
|
||||||
|
CREATE INDEX collection_submitter_fk_idx ON Collection(submitter);
|
||||||
|
CREATE INDEX collection_admin_fk_idx ON Collection(admin);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Community2Community table
|
-- Community2Community table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -357,6 +386,9 @@ CREATE TABLE Community2Community
|
|||||||
child_comm_id INTEGER REFERENCES Community(community_id)
|
child_comm_id INTEGER REFERENCES Community(community_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX com2com_parent_fk_idx ON Community2Community(parent_comm_id);
|
||||||
|
CREATE INDEX com2com_child_fk_idx ON Community2Community(child_comm_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Community2Collection table
|
-- Community2Collection table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -406,6 +438,9 @@ CREATE TABLE ResourcePolicy
|
|||||||
-- authorization manager are select type=x, id=y, action=z
|
-- authorization manager are select type=x, id=y, action=z
|
||||||
CREATE INDEX resourcepolicy_type_id_idx ON ResourcePolicy(resource_type_id,resource_id);
|
CREATE INDEX resourcepolicy_type_id_idx ON ResourcePolicy(resource_type_id,resource_id);
|
||||||
|
|
||||||
|
CREATE INDEX rp_eperson_fk_idx ON ResourcePolicy(eperson_id);
|
||||||
|
CREATE INDEX rp_epersongroup_fk_idx ON ResourcePolicy(epersongroup_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- EPersonGroup2EPerson table
|
-- EPersonGroup2EPerson table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -419,6 +454,7 @@ CREATE TABLE EPersonGroup2EPerson
|
|||||||
-- Index by group ID (used heavily by AuthorizeManager)
|
-- Index by group ID (used heavily by AuthorizeManager)
|
||||||
CREATE INDEX epersongroup2eperson_group_idx on EPersonGroup2EPerson(eperson_group_id);
|
CREATE INDEX epersongroup2eperson_group_idx on EPersonGroup2EPerson(eperson_group_id);
|
||||||
|
|
||||||
|
CREATE INDEX epg2ep_eperson_fk_idx ON EPersonGroup2EPerson(eperson_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Handle table
|
-- Handle table
|
||||||
@@ -453,6 +489,9 @@ CREATE TABLE WorkspaceItem
|
|||||||
page_reached INTEGER
|
page_reached INTEGER
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX workspace_item_fk_idx ON WorkspaceItem(item_id);
|
||||||
|
CREATE INDEX workspace_coll_fk_idx ON WorkspaceItem(collection_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- WorkflowItem table
|
-- WorkflowItem table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -473,6 +512,10 @@ CREATE TABLE WorkflowItem
|
|||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX workflow_item_fk_idx ON WorkflowItem(item_id);
|
||||||
|
CREATE INDEX workflow_coll_fk_idx ON WorkflowItem(collection_id);
|
||||||
|
CREATE INDEX workflow_owner_fk_idx ON WorkflowItem(owner);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- TasklistItem table
|
-- TasklistItem table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -483,6 +526,8 @@ CREATE TABLE TasklistItem
|
|||||||
workflow_id INTEGER REFERENCES WorkflowItem(workflow_id)
|
workflow_id INTEGER REFERENCES WorkflowItem(workflow_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX tasklist_eperson_fk_idx ON TasklistItem(eperson_id);
|
||||||
|
CREATE INDEX tasklist_workflow_fk_idx ON TasklistItem(workflow_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- RegistrationData table
|
-- RegistrationData table
|
||||||
@@ -506,6 +551,8 @@ CREATE TABLE Subscription
|
|||||||
collection_id INTEGER REFERENCES Collection(collection_id)
|
collection_id INTEGER REFERENCES Collection(collection_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX subs_eperson_fk_idx ON Subscription(eperson_id);
|
||||||
|
CREATE INDEX subs_collection_fk_idx ON Subscription(collection_id);
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -520,6 +567,8 @@ CREATE TABLE epersongroup2workspaceitem
|
|||||||
CONSTRAINT epersongroup2item_pkey PRIMARY KEY (id)
|
CONSTRAINT epersongroup2item_pkey PRIMARY KEY (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX epg2wi_group_fk_idx ON epersongroup2workspaceitem(eperson_group_id);
|
||||||
|
CREATE INDEX epg2wi_workspace_fk_idx ON epersongroup2workspaceitem(workspace_item_id);
|
||||||
|
|
||||||
------------------------------------------------------------
|
------------------------------------------------------------
|
||||||
-- Browse subsystem tables and views
|
-- Browse subsystem tables and views
|
||||||
@@ -538,6 +587,8 @@ CREATE TABLE Communities2Item
|
|||||||
-- Index by item_id for update/re-index
|
-- Index by item_id for update/re-index
|
||||||
CREATE INDEX Communities2Item_item_id_idx ON Communities2Item( item_id );
|
CREATE INDEX Communities2Item_item_id_idx ON Communities2Item( item_id );
|
||||||
|
|
||||||
|
CREATE INDEX Comm2Item_community_fk_idx ON Communities2Item( community_id );
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Community2Item view
|
-- Community2Item view
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
@@ -602,6 +653,8 @@ CREATE TABLE most_recent_checksum
|
|||||||
result VARCHAR REFERENCES checksum_results(result_code)
|
result VARCHAR REFERENCES checksum_results(result_code)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX mrc_result_fk_idx ON most_recent_checksum( result );
|
||||||
|
|
||||||
-- A row will be inserted into this table every
|
-- A row will be inserted into this table every
|
||||||
-- time a checksum is re-calculated.
|
-- time a checksum is re-calculated.
|
||||||
|
|
||||||
@@ -616,6 +669,8 @@ CREATE TABLE checksum_history
|
|||||||
result VARCHAR REFERENCES checksum_results(result_code)
|
result VARCHAR REFERENCES checksum_results(result_code)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX ch_result_fk_idx ON checksum_history( result );
|
||||||
|
|
||||||
|
|
||||||
-- this will insert into the result code
|
-- this will insert into the result code
|
||||||
-- the initial results that should be
|
-- the initial results that should be
|
||||||
|
@@ -1,96 +1,161 @@
|
|||||||
--
|
--
|
||||||
-- database_schema_14-15.sql
|
-- database_schema_14-15.sql
|
||||||
--
|
--
|
||||||
-- Version: $$
|
-- Version: $$
|
||||||
--
|
--
|
||||||
-- Date: $Date:$
|
-- Date: $Date:$
|
||||||
--
|
--
|
||||||
-- Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
|
-- Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
|
||||||
-- Institute of Technology. All rights reserved.
|
-- Institute of Technology. All rights reserved.
|
||||||
--
|
--
|
||||||
-- Redistribution and use in source and binary forms, with or without
|
-- Redistribution and use in source and binary forms, with or without
|
||||||
-- modification, are permitted provided that the following conditions are
|
-- modification, are permitted provided that the following conditions are
|
||||||
-- met:
|
-- met:
|
||||||
--
|
--
|
||||||
-- - Redistributions of source code must retain the above copyright
|
-- - Redistributions of source code must retain the above copyright
|
||||||
-- notice, this list of conditions and the following disclaimer.
|
-- notice, this list of conditions and the following disclaimer.
|
||||||
--
|
--
|
||||||
-- - Redistributions in binary form must reproduce the above copyright
|
-- - Redistributions in binary form must reproduce the above copyright
|
||||||
-- notice, this list of conditions and the following disclaimer in the
|
-- notice, this list of conditions and the following disclaimer in the
|
||||||
-- documentation and/or other materials provided with the distribution.
|
-- documentation and/or other materials provided with the distribution.
|
||||||
--
|
--
|
||||||
-- - Neither the name of the Hewlett-Packard Company nor the name of the
|
-- - Neither the name of the Hewlett-Packard Company nor the name of the
|
||||||
-- Massachusetts Institute of Technology nor the names of their
|
-- Massachusetts Institute of Technology nor the names of their
|
||||||
-- contributors may be used to endorse or promote products derived from
|
-- contributors may be used to endorse or promote products derived from
|
||||||
-- this software without specific prior written permission.
|
-- this software without specific prior written permission.
|
||||||
--
|
--
|
||||||
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
-- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
-- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
-- HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
-- HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
-- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
-- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
-- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
-- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
-- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
-- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||||
-- TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
-- TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||||
-- USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
-- USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
-- DAMAGE.
|
-- DAMAGE.
|
||||||
|
|
||||||
--
|
--
|
||||||
-- SQL commands to upgrade the database schema of a live DSpace 1.3 or 1.3.x
|
-- SQL commands to upgrade the database schema of a live DSpace 1.3 or 1.3.x
|
||||||
-- to the DSpace 1.4 database schema
|
-- to the DSpace 1.4 database schema
|
||||||
--
|
--
|
||||||
-- DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST.
|
-- DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST.
|
||||||
-- DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST.
|
-- DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST.
|
||||||
-- DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST.
|
-- DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST. DUMP YOUR DATABASE FIRST.
|
||||||
|
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
-- New Column language language in EPerson
|
-- New Column language language in EPerson
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
|
|
||||||
alter table eperson add column language VARCHAR(64);
|
alter table eperson add column language VARCHAR(64);
|
||||||
update eperson set language = 'en';
|
update eperson set language = 'en';
|
||||||
|
|
||||||
alter table bundle drop column mets_bitstream_id; -- totally unused column
|
alter table bundle drop column mets_bitstream_id; -- totally unused column
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
-- Necessary for Configurable Submission functionality:
|
-- Necessary for Configurable Submission functionality:
|
||||||
-- Modification to workspaceitem table to support keeping track
|
-- Modification to workspaceitem table to support keeping track
|
||||||
-- of the last page reached within a step in the Configurable Submission Process
|
-- of the last page reached within a step in the Configurable Submission Process
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
ALTER TABLE workspaceitem ADD page_reached INTEGER;
|
ALTER TABLE workspaceitem ADD page_reached INTEGER;
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
-- Tables to manage cache of item counts for communities and collections
|
-- Tables to manage cache of item counts for communities and collections
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
|
|
||||||
CREATE TABLE collection_item_count (
|
CREATE TABLE collection_item_count (
|
||||||
collection_id INTEGER PRIMARY KEY REFERENCES collection(collection_id),
|
collection_id INTEGER PRIMARY KEY REFERENCES collection(collection_id),
|
||||||
count INTEGER
|
count INTEGER
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE community_item_count (
|
CREATE TABLE community_item_count (
|
||||||
community_id INTEGER PRIMARY KEY REFERENCES community(community_id),
|
community_id INTEGER PRIMARY KEY REFERENCES community(community_id),
|
||||||
count INTEGER
|
count INTEGER
|
||||||
);
|
);
|
||||||
|
|
||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
-- Remove sequences and tables of the old browse system
|
-- Remove sequences and tables of the old browse system
|
||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
|
|
||||||
DROP SEQUENCE itemsbyauthor_seq;
|
DROP SEQUENCE itemsbyauthor_seq;
|
||||||
DROP SEQUENCE itemsbytitle_seq;
|
DROP SEQUENCE itemsbytitle_seq;
|
||||||
DROP SEQUENCE itemsbydate_seq;
|
DROP SEQUENCE itemsbydate_seq;
|
||||||
DROP SEQUENCE itemsbydateaccessioned_seq;
|
DROP SEQUENCE itemsbydateaccessioned_seq;
|
||||||
DROP SEQUENCE itemsbysubject_seq;
|
DROP SEQUENCE itemsbysubject_seq;
|
||||||
|
|
||||||
DROP TABLE ItemsByAuthor CASCADE;
|
DROP TABLE ItemsByAuthor CASCADE;
|
||||||
DROP TABLE ItemsByTitle CASCADE;
|
DROP TABLE ItemsByTitle CASCADE;
|
||||||
DROP TABLE ItemsByDate CASCADE;
|
DROP TABLE ItemsByDate CASCADE;
|
||||||
DROP TABLE ItemsByDateAccessioned CASCADE;
|
DROP TABLE ItemsByDateAccessioned CASCADE;
|
||||||
DROP TABLE ItemsBySubject CASCADE;
|
DROP TABLE ItemsBySubject CASCADE;
|
||||||
|
|
||||||
DROP TABLE History CASCADE;
|
DROP TABLE History CASCADE;
|
||||||
DROP TABLE HistoryState CASCADE;
|
DROP TABLE HistoryState CASCADE;
|
||||||
|
|
||||||
|
----------------------------------------------------------------
|
||||||
|
-- Add indexes for foreign key columns
|
||||||
|
----------------------------------------------------------------
|
||||||
|
|
||||||
|
CREATE INDEX fe_bitstream_fk_idx ON FileExtension(bitstream_format_id);
|
||||||
|
|
||||||
|
CREATE INDEX bit_bitstream_fk_idx ON Bitstream(bitstream_format_id);
|
||||||
|
|
||||||
|
CREATE INDEX g2g_parent_fk_idx ON Group2Group(parent_id);
|
||||||
|
CREATE INDEX g2g_child_fk_idx ON Group2Group(child_id);
|
||||||
|
|
||||||
|
CREATE INDEX g2gc_parent_fk_idx ON Group2Group(parent_id);
|
||||||
|
CREATE INDEX g2gc_child_fk_idx ON Group2Group(child_id);
|
||||||
|
|
||||||
|
CREATE INDEX item_submitter_fk_idx ON Item(submitter_id);
|
||||||
|
|
||||||
|
CREATE INDEX bundle_primary_fk_idx ON Bundle(primary_bitstream_id);
|
||||||
|
|
||||||
|
CREATE INDEX item2bundle_bundle_fk_idx ON Item2Bundle(bundle_id);
|
||||||
|
|
||||||
|
CREATE INDEX bundle2bitstream_bitstream_fk_idx ON Bundle2Bitstream(bitstream_id);
|
||||||
|
|
||||||
|
CREATE INDEX metadatavalue_field_fk_idx ON MetadataValue(metadata_field_id);
|
||||||
|
|
||||||
|
CREATE INDEX community_logo_fk_idx ON Community(logo_bitstream_id);
|
||||||
|
|
||||||
|
CREATE INDEX collection_logo_fk_idx ON Collection(logo_bitstream_id);
|
||||||
|
CREATE INDEX collection_template_fk_idx ON Collection(template_item_id);
|
||||||
|
CREATE INDEX collection_workflow1_fk_idx ON Collection(workflow_step_1);
|
||||||
|
CREATE INDEX collection_workflow2_fk_idx ON Collection(workflow_step_2);
|
||||||
|
CREATE INDEX collection_workflow3_fk_idx ON Collection(workflow_step_3);
|
||||||
|
CREATE INDEX collection_submitter_fk_idx ON Collection(submitter);
|
||||||
|
CREATE INDEX collection_admin_fk_idx ON Collection(admin);
|
||||||
|
|
||||||
|
CREATE INDEX com2com_parent_fk_idx ON Community2Community(parent_comm_id);
|
||||||
|
CREATE INDEX com2com_child_fk_idx ON Community2Community(child_comm_id);
|
||||||
|
|
||||||
|
CREATE INDEX rp_eperson_fk_idx ON ResourcePolicy(eperson_id);
|
||||||
|
CREATE INDEX rp_epersongroup_fk_idx ON ResourcePolicy(epersongroup_id);
|
||||||
|
|
||||||
|
CREATE INDEX epg2ep_eperson_fk_idx ON EPersonGroup2EPerson(eperson_id);
|
||||||
|
|
||||||
|
CREATE INDEX workspace_item_fk_idx ON WorkspaceItem(item_id);
|
||||||
|
CREATE INDEX workspace_coll_fk_idx ON WorkspaceItem(collection_id);
|
||||||
|
|
||||||
|
CREATE INDEX workflow_item_fk_idx ON WorkflowItem(item_id);
|
||||||
|
CREATE INDEX workflow_coll_fk_idx ON WorkflowItem(collection_id);
|
||||||
|
CREATE INDEX workflow_owner_fk_idx ON WorkflowItem(owner);
|
||||||
|
|
||||||
|
CREATE INDEX tasklist_eperson_fk_idx ON TasklistItem(eperson_id);
|
||||||
|
CREATE INDEX tasklist_workflow_fk_idx ON TasklistItem(workflow_id);
|
||||||
|
|
||||||
|
CREATE INDEX subs_eperson_fk_idx ON Subscription(eperson_id);
|
||||||
|
CREATE INDEX subs_collection_fk_idx ON Subscription(collection_id);
|
||||||
|
|
||||||
|
CREATE INDEX epg2wi_group_fk_idx ON epersongroup2workspaceitem(eperson_group_id);
|
||||||
|
CREATE INDEX epg2wi_workspace_fk_idx ON epersongroup2workspaceitem(workspace_item_id);
|
||||||
|
|
||||||
|
CREATE INDEX Comm2Item_community_fk_idx ON Communities2Item( community_id );
|
||||||
|
|
||||||
|
CREATE INDEX mrc_result_fk_idx ON most_recent_checksum( result );
|
||||||
|
|
||||||
|
CREATE INDEX ch_result_fk_idx ON checksum_history( result );
|
||||||
|
|
||||||
|
@@ -97,6 +97,8 @@ CREATE TABLE FileExtension
|
|||||||
extension VARCHAR2(16)
|
extension VARCHAR2(16)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX fe_bitstream_fk_idx ON FileExtension(bitstream_format_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Bitstream table
|
-- Bitstream table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -117,6 +119,8 @@ CREATE TABLE Bitstream
|
|||||||
sequence_id INTEGER
|
sequence_id INTEGER
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX bit_bitstream_fk_idx ON Bitstream(bitstream_format_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- EPerson table
|
-- EPerson table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -137,6 +141,11 @@ CREATE TABLE EPerson
|
|||||||
language VARCHAR2(64)
|
language VARCHAR2(64)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
-- index by email
|
||||||
|
CREATE INDEX eperson_email_idx ON EPerson(email);
|
||||||
|
|
||||||
|
-- index by netid
|
||||||
|
CREATE INDEX eperson_netid_idx ON EPerson(netid);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- EPersonGroup table
|
-- EPersonGroup table
|
||||||
@@ -157,6 +166,9 @@ CREATE TABLE Group2Group
|
|||||||
child_id INTEGER REFERENCES EPersonGroup(eperson_group_id)
|
child_id INTEGER REFERENCES EPersonGroup(eperson_group_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX g2g_parent_fk_idx ON Group2Group(parent_id);
|
||||||
|
CREATE INDEX g2g_child_fk_idx ON Group2Group(child_id);
|
||||||
|
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
-- Group2GroupCache table, is the 'unwound' hierarchy in
|
-- Group2GroupCache table, is the 'unwound' hierarchy in
|
||||||
-- Group2Group. It explicitly names every parent child
|
-- Group2Group. It explicitly names every parent child
|
||||||
@@ -173,6 +185,9 @@ CREATE TABLE Group2GroupCache
|
|||||||
child_id INTEGER REFERENCES EPersonGroup(eperson_group_id)
|
child_id INTEGER REFERENCES EPersonGroup(eperson_group_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX g2gc_parent_fk_idx ON Group2Group(parent_id);
|
||||||
|
CREATE INDEX g2gc_child_fk_idx ON Group2Group(child_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Item table
|
-- Item table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -186,6 +201,8 @@ CREATE TABLE Item
|
|||||||
owning_collection INTEGER
|
owning_collection INTEGER
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX item_submitter_fk_idx ON Item(submitter_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Bundle table
|
-- Bundle table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -197,6 +214,8 @@ CREATE TABLE Bundle
|
|||||||
primary_bitstream_id INTEGER REFERENCES Bitstream(bitstream_id)
|
primary_bitstream_id INTEGER REFERENCES Bitstream(bitstream_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX bundle_primary_fk_idx ON Bundle(primary_bitstream_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Item2Bundle table
|
-- Item2Bundle table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -210,6 +229,8 @@ CREATE TABLE Item2Bundle
|
|||||||
-- index by item_id
|
-- index by item_id
|
||||||
CREATE INDEX item2bundle_item_idx on Item2Bundle(item_id);
|
CREATE INDEX item2bundle_item_idx on Item2Bundle(item_id);
|
||||||
|
|
||||||
|
CREATE INDEX item2bundle_bundle_fk_idx ON Item2Bundle(bundle_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Bundle2Bitstream table
|
-- Bundle2Bitstream table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -223,6 +244,8 @@ CREATE TABLE Bundle2Bitstream
|
|||||||
-- index by bundle_id
|
-- index by bundle_id
|
||||||
CREATE INDEX bundle2bitstream_bundle_idx ON Bundle2Bitstream(bundle_id);
|
CREATE INDEX bundle2bitstream_bundle_idx ON Bundle2Bitstream(bundle_id);
|
||||||
|
|
||||||
|
CREATE INDEX bundle2bits_bitstream_fk_idx ON Bundle2Bitstream(bitstream_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Metadata Tables and Sequences
|
-- Metadata Tables and Sequences
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -269,6 +292,7 @@ CREATE VIEW dcvalue AS
|
|||||||
-- related to that item
|
-- related to that item
|
||||||
CREATE INDEX metadatavalue_item_idx ON MetadataValue(item_id);
|
CREATE INDEX metadatavalue_item_idx ON MetadataValue(item_id);
|
||||||
CREATE INDEX metadatavalue_item_idx2 ON MetadataValue(item_id,metadata_field_id);
|
CREATE INDEX metadatavalue_item_idx2 ON MetadataValue(item_id,metadata_field_id);
|
||||||
|
CREATE INDEX metadatavalue_field_fk_idx ON MetadataValue(metadata_field_id);
|
||||||
CREATE INDEX metadatafield_schema_idx ON MetadataFieldRegistry(metadata_schema_id);
|
CREATE INDEX metadatafield_schema_idx ON MetadataFieldRegistry(metadata_schema_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -285,6 +309,8 @@ CREATE TABLE Community
|
|||||||
side_bar_text VARCHAR2(2000)
|
side_bar_text VARCHAR2(2000)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX community_logo_fk_idx ON Community(logo_bitstream_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Collection table
|
-- Collection table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -307,6 +333,14 @@ CREATE TABLE Collection
|
|||||||
admin INTEGER REFERENCES EPersonGroup( eperson_group_id )
|
admin INTEGER REFERENCES EPersonGroup( eperson_group_id )
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX collection_logo_fk_idx ON Collection(logo_bitstream_id);
|
||||||
|
CREATE INDEX collection_template_fk_idx ON Collection(template_item_id);
|
||||||
|
CREATE INDEX collection_workflow1_fk_idx ON Collection(workflow_step_1);
|
||||||
|
CREATE INDEX collection_workflow2_fk_idx ON Collection(workflow_step_2);
|
||||||
|
CREATE INDEX collection_workflow3_fk_idx ON Collection(workflow_step_3);
|
||||||
|
CREATE INDEX collection_submitter_fk_idx ON Collection(submitter);
|
||||||
|
CREATE INDEX collection_admin_fk_idx ON Collection(admin);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Community2Community table
|
-- Community2Community table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -317,6 +351,9 @@ CREATE TABLE Community2Community
|
|||||||
child_comm_id INTEGER REFERENCES Community(community_id)
|
child_comm_id INTEGER REFERENCES Community(community_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX com2com_parent_fk_idx ON Community2Community(parent_comm_id);
|
||||||
|
CREATE INDEX com2com_child_fk_idx ON Community2Community(child_comm_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Community2Collection table
|
-- Community2Collection table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -366,6 +403,9 @@ CREATE TABLE ResourcePolicy
|
|||||||
-- authorization manager are select type=x, id=y, action=z
|
-- authorization manager are select type=x, id=y, action=z
|
||||||
CREATE INDEX resourcepolicy_type_id_idx ON ResourcePolicy(resource_type_id,resource_id);
|
CREATE INDEX resourcepolicy_type_id_idx ON ResourcePolicy(resource_type_id,resource_id);
|
||||||
|
|
||||||
|
CREATE INDEX rp_eperson_fk_idx ON ResourcePolicy(eperson_id);
|
||||||
|
CREATE INDEX rp_epersongroup_fk_idx ON ResourcePolicy(epersongroup_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- EPersonGroup2EPerson table
|
-- EPersonGroup2EPerson table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -379,6 +419,8 @@ CREATE TABLE EPersonGroup2EPerson
|
|||||||
-- Index by group ID (used heavily by AuthorizeManager)
|
-- Index by group ID (used heavily by AuthorizeManager)
|
||||||
CREATE INDEX epersongroup2eperson_group_idx on EPersonGroup2EPerson(eperson_group_id);
|
CREATE INDEX epersongroup2eperson_group_idx on EPersonGroup2EPerson(eperson_group_id);
|
||||||
|
|
||||||
|
CREATE INDEX epg2ep_eperson_fk_idx ON EPersonGroup2EPerson(eperson_id);
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Handle table
|
-- Handle table
|
||||||
@@ -411,6 +453,9 @@ CREATE TABLE WorkspaceItem
|
|||||||
page_reached INTEGER
|
page_reached INTEGER
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX workspace_item_fk_idx ON WorkspaceItem(item_id);
|
||||||
|
CREATE INDEX workspace_coll_fk_idx ON WorkspaceItem(collection_id);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- WorkflowItem table
|
-- WorkflowItem table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -431,6 +476,10 @@ CREATE TABLE WorkflowItem
|
|||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX workflow_item_fk_idx ON WorkflowItem(item_id);
|
||||||
|
CREATE INDEX workflow_coll_fk_idx ON WorkflowItem(collection_id);
|
||||||
|
CREATE INDEX workflow_owner_fk_idx ON WorkflowItem(owner);
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- TasklistItem table
|
-- TasklistItem table
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
@@ -441,6 +490,9 @@ CREATE TABLE TasklistItem
|
|||||||
workflow_id INTEGER REFERENCES WorkflowItem(workflow_id)
|
workflow_id INTEGER REFERENCES WorkflowItem(workflow_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX tasklist_eperson_fk_idx ON TasklistItem(eperson_id);
|
||||||
|
CREATE INDEX tasklist_workflow_fk_idx ON TasklistItem(workflow_id);
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- RegistrationData table
|
-- RegistrationData table
|
||||||
@@ -464,6 +516,9 @@ CREATE TABLE Subscription
|
|||||||
collection_id INTEGER REFERENCES Collection(collection_id)
|
collection_id INTEGER REFERENCES Collection(collection_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX subs_eperson_fk_idx ON Subscription(eperson_id);
|
||||||
|
CREATE INDEX subs_collection_fk_idx ON Subscription(collection_id);
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- History table
|
-- History table
|
||||||
@@ -497,6 +552,9 @@ CREATE TABLE EPersonGroup2WorkspaceItem
|
|||||||
workspace_item_id INTEGER REFERENCES WorkspaceItem(workspace_item_id)
|
workspace_item_id INTEGER REFERENCES WorkspaceItem(workspace_item_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX epg2wi_group_fk_idx ON epersongroup2workspaceitem(eperson_group_id);
|
||||||
|
CREATE INDEX epg2wi_workspace_fk_idx ON epersongroup2workspaceitem(workspace_item_id);
|
||||||
|
|
||||||
------------------------------------------------------------
|
------------------------------------------------------------
|
||||||
-- Browse subsystem tables and views
|
-- Browse subsystem tables and views
|
||||||
------------------------------------------------------------
|
------------------------------------------------------------
|
||||||
@@ -511,6 +569,10 @@ CREATE TABLE Communities2Item
|
|||||||
item_id INTEGER REFERENCES Item(item_id)
|
item_id INTEGER REFERENCES Item(item_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
-- Indexing browse tables update/re-index performance
|
||||||
|
CREATE INDEX Communities2Item_item_id_idx ON Communities2Item( item_id );
|
||||||
|
CREATE INDEX Comm2Item_community_fk_idx ON Communities2Item( community_id );
|
||||||
|
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
-- Community2Item view
|
-- Community2Item view
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
@@ -520,9 +582,6 @@ FROM Community2Collection, Collection2Item
|
|||||||
WHERE Collection2Item.collection_id = Community2Collection.collection_id
|
WHERE Collection2Item.collection_id = Community2Collection.collection_id
|
||||||
;
|
;
|
||||||
|
|
||||||
-- Indexing browse tables update/re-index performance
|
|
||||||
CREATE INDEX Communities2Item_item_id_idx ON Communities2Item( item_id );
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
-- Tables to manage cache of item counts for communities and collections
|
-- Tables to manage cache of item counts for communities and collections
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
@@ -578,6 +637,8 @@ CREATE TABLE most_recent_checksum
|
|||||||
result VARCHAR(64) REFERENCES checksum_results(result_code)
|
result VARCHAR(64) REFERENCES checksum_results(result_code)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX mrc_result_fk_idx ON most_recent_checksum( result );
|
||||||
|
|
||||||
-- A row will be inserted into this table every
|
-- A row will be inserted into this table every
|
||||||
-- time a checksum is re-calculated.
|
-- time a checksum is re-calculated.
|
||||||
|
|
||||||
@@ -594,6 +655,8 @@ CREATE TABLE checksum_history
|
|||||||
result VARCHAR(64) REFERENCES checksum_results(result_code)
|
result VARCHAR(64) REFERENCES checksum_results(result_code)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX ch_result_fk_idx ON checksum_history( result );
|
||||||
|
|
||||||
|
|
||||||
-- this will insert into the result code
|
-- this will insert into the result code
|
||||||
-- the initial results that should be
|
-- the initial results that should be
|
||||||
|
@@ -94,3 +94,68 @@ DROP TABLE ItemsByTitle CASCADE;
|
|||||||
DROP TABLE ItemsByDate CASCADE;
|
DROP TABLE ItemsByDate CASCADE;
|
||||||
DROP TABLE ItemsByDateAccessioned CASCADE;
|
DROP TABLE ItemsByDateAccessioned CASCADE;
|
||||||
DROP TABLE ItemsBySubject CASCADE;
|
DROP TABLE ItemsBySubject CASCADE;
|
||||||
|
|
||||||
|
----------------------------------------------------------------
|
||||||
|
-- Add indexes for foreign key columns
|
||||||
|
----------------------------------------------------------------
|
||||||
|
|
||||||
|
CREATE INDEX fe_bitstream_fk_idx ON FileExtension(bitstream_format_id);
|
||||||
|
|
||||||
|
CREATE INDEX bit_bitstream_fk_idx ON Bitstream(bitstream_format_id);
|
||||||
|
|
||||||
|
CREATE INDEX g2g_parent_fk_idx ON Group2Group(parent_id);
|
||||||
|
CREATE INDEX g2g_child_fk_idx ON Group2Group(child_id);
|
||||||
|
|
||||||
|
CREATE INDEX g2gc_parent_fk_idx ON Group2Group(parent_id);
|
||||||
|
CREATE INDEX g2gc_child_fk_idx ON Group2Group(child_id);
|
||||||
|
|
||||||
|
CREATE INDEX item_submitter_fk_idx ON Item(submitter_id);
|
||||||
|
|
||||||
|
CREATE INDEX bundle_primary_fk_idx ON Bundle(primary_bitstream_id);
|
||||||
|
|
||||||
|
CREATE INDEX item2bundle_bundle_fk_idx ON Item2Bundle(bundle_id);
|
||||||
|
|
||||||
|
CREATE INDEX bundle2bits_bitstream_fk_idx ON Bundle2Bitstream(bitstream_id);
|
||||||
|
|
||||||
|
CREATE INDEX metadatavalue_field_fk_idx ON MetadataValue(metadata_field_id);
|
||||||
|
|
||||||
|
CREATE INDEX community_logo_fk_idx ON Community(logo_bitstream_id);
|
||||||
|
|
||||||
|
CREATE INDEX collection_logo_fk_idx ON Collection(logo_bitstream_id);
|
||||||
|
CREATE INDEX collection_template_fk_idx ON Collection(template_item_id);
|
||||||
|
CREATE INDEX collection_workflow1_fk_idx ON Collection(workflow_step_1);
|
||||||
|
CREATE INDEX collection_workflow2_fk_idx ON Collection(workflow_step_2);
|
||||||
|
CREATE INDEX collection_workflow3_fk_idx ON Collection(workflow_step_3);
|
||||||
|
CREATE INDEX collection_submitter_fk_idx ON Collection(submitter);
|
||||||
|
CREATE INDEX collection_admin_fk_idx ON Collection(admin);
|
||||||
|
|
||||||
|
CREATE INDEX com2com_parent_fk_idx ON Community2Community(parent_comm_id);
|
||||||
|
CREATE INDEX com2com_child_fk_idx ON Community2Community(child_comm_id);
|
||||||
|
|
||||||
|
CREATE INDEX rp_eperson_fk_idx ON ResourcePolicy(eperson_id);
|
||||||
|
CREATE INDEX rp_epersongroup_fk_idx ON ResourcePolicy(epersongroup_id);
|
||||||
|
|
||||||
|
CREATE INDEX epg2ep_eperson_fk_idx ON EPersonGroup2EPerson(eperson_id);
|
||||||
|
|
||||||
|
CREATE INDEX workspace_item_fk_idx ON WorkspaceItem(item_id);
|
||||||
|
CREATE INDEX workspace_coll_fk_idx ON WorkspaceItem(collection_id);
|
||||||
|
|
||||||
|
CREATE INDEX workflow_item_fk_idx ON WorkflowItem(item_id);
|
||||||
|
CREATE INDEX workflow_coll_fk_idx ON WorkflowItem(collection_id);
|
||||||
|
CREATE INDEX workflow_owner_fk_idx ON WorkflowItem(owner);
|
||||||
|
|
||||||
|
CREATE INDEX tasklist_eperson_fk_idx ON TasklistItem(eperson_id);
|
||||||
|
CREATE INDEX tasklist_workflow_fk_idx ON TasklistItem(workflow_id);
|
||||||
|
|
||||||
|
CREATE INDEX subs_eperson_fk_idx ON Subscription(eperson_id);
|
||||||
|
CREATE INDEX subs_collection_fk_idx ON Subscription(collection_id);
|
||||||
|
|
||||||
|
CREATE INDEX epg2wi_group_fk_idx ON epersongroup2workspaceitem(eperson_group_id);
|
||||||
|
CREATE INDEX epg2wi_workspace_fk_idx ON epersongroup2workspaceitem(workspace_item_id);
|
||||||
|
|
||||||
|
CREATE INDEX Comm2Item_community_fk_idx ON Communities2Item( community_id );
|
||||||
|
|
||||||
|
CREATE INDEX mrc_result_fk_idx ON most_recent_checksum( result );
|
||||||
|
|
||||||
|
CREATE INDEX ch_result_fk_idx ON checksum_history( result );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user