(Tim DiLauro et al)

- Added indices recommended by John Hopkins University


git-svn-id: http://scm.dspace.org/svn/repo/trunk@1192 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Robert Tansley
2005-04-21 17:03:54 +00:00
parent fe16bbb369
commit 629d50dfff
2 changed files with 41 additions and 2 deletions

View File

@@ -325,6 +325,11 @@ CREATE TABLE Community2Collection
collection_id INTEGER REFERENCES Collection(collection_id) collection_id INTEGER REFERENCES Collection(collection_id)
); );
-- Index on community ID
CREATE INDEX Community2Collection_community_id_idx ON Community2Collection(community_id);
-- Index on collection ID
CREATE INDEX Community2Collection_collection_id_idx ON Community2Collection(collection_id);
------------------------------------------------------- -------------------------------------------------------
-- Collection2Item table -- Collection2Item table
------------------------------------------------------- -------------------------------------------------------
@@ -337,6 +342,8 @@ CREATE TABLE Collection2Item
-- index by collection_id -- index by collection_id
CREATE INDEX collection2item_collection_idx ON Collection2Item(collection_id); CREATE INDEX collection2item_collection_idx ON Collection2Item(collection_id);
-- and item_id
CREATE INDEX Collection2Item_item_id_idx ON Collection2Item( item_id );
------------------------------------------------------- -------------------------------------------------------
-- ResourcePolicy table -- ResourcePolicy table
@@ -384,6 +391,8 @@ CREATE TABLE Handle
-- index by handle, commonly looked up -- index by handle, commonly looked up
CREATE INDEX handle_handle_idx ON Handle(handle); CREATE INDEX handle_handle_idx ON Handle(handle);
-- index by resource id and resource type id
CREATE INDEX handle_resource_id_and_type_idx ON handle(resource_id, resource_type_id);
------------------------------------------------------- -------------------------------------------------------
-- WorkspaceItem table -- WorkspaceItem table
@@ -503,6 +512,9 @@ CREATE TABLE Communities2Item
item_id INTEGER REFERENCES Item(item_id) item_id INTEGER REFERENCES Item(item_id)
); );
-- Index by item_id for update/re-index
CREATE INDEX Communities2Item_item_id_idx ON Communities2Item( item_id );
------------------------------------------------------- -------------------------------------------------------
-- Community2Item view -- Community2Item view
------------------------------------------------------ ------------------------------------------------------
@@ -525,6 +537,8 @@ CREATE TABLE ItemsByAuthor
-- index by sort_author, of course! -- index by sort_author, of course!
CREATE INDEX sort_author_idx on ItemsByAuthor(sort_author); CREATE INDEX sort_author_idx on ItemsByAuthor(sort_author);
-- And by item ID for updates/re-indexing
CREATE INDEX ItemsByAuthor_item_id_idx ON ItemsByAuthor(item_id);
------------------------------------------------------- -------------------------------------------------------
-- CollectionItemsByAuthor view -- CollectionItemsByAuthor view
@@ -557,7 +571,8 @@ CREATE TABLE ItemsByTitle
-- index by the sort_title -- index by the sort_title
CREATE INDEX sort_title_idx on ItemsByTitle(sort_title); CREATE INDEX sort_title_idx on ItemsByTitle(sort_title);
-- And by item ID for updates/re-indexing
CREATE INDEX ItemsByTitle_item_id_idx ON ItemsByTitle(item_id);
------------------------------------------------------- -------------------------------------------------------
-- CollectionItemsByTitle view -- CollectionItemsByTitle view
@@ -589,6 +604,8 @@ CREATE TABLE ItemsByDate
-- sort by date -- sort by date
CREATE INDEX date_issued_idx on ItemsByDate(date_issued); CREATE INDEX date_issued_idx on ItemsByDate(date_issued);
-- And by item ID for updates/re-indexing
CREATE INDEX ItemsByDate_item_id_idx ON ItemsByDate(item_id);
------------------------------------------------------- -------------------------------------------------------
-- CollectionItemsByDate view -- CollectionItemsByDate view
@@ -618,6 +635,9 @@ CREATE TABLE ItemsByDateAccessioned
date_accessioned TEXT date_accessioned TEXT
); );
-- Index on item_id for update/re-indexing
CREATE INDEX ItemsByDateAccessioned_item_id_idx ON ItemsByDateAccessioned(item_id);
------------------------------------------------------- -------------------------------------------------------
-- CollectionItemsByDateAccession view -- CollectionItemsByDateAccession view
------------------------------------------------------- -------------------------------------------------------

View File

@@ -67,4 +67,23 @@ ALTER TABLE collection ADD submitter INTEGER REFERENCES EPersonGroup( eperson_gr
ALTER TABLE collection ADD admin INTEGER REFERENCES EPersonGroup( eperson_group_id ); ALTER TABLE collection ADD admin INTEGER REFERENCES EPersonGroup( eperson_group_id );
ALTER TABLE eperson ADD netid varchar(64) UNIQUE; ALTER TABLE eperson ADD netid varchar(64) UNIQUE;
-------------------------------------------------------------------------------
-- Additional indices for performance
-------------------------------------------------------------------------------
-- index by resource id and resource type id
CREATE INDEX handle_resource_id_and_type_idx ON handle(resource_id, resource_type_id);
-- Indexing browse tables update/re-index performance
CREATE INDEX Communities2Item_item_id_idx ON Communities2Item( item_id );
CREATE INDEX ItemsByAuthor_item_id_idx ON ItemsByAuthor(item_id);
CREATE INDEX ItemsByTitle_item_id_idx ON ItemsByTitle(item_id);
CREATE INDEX ItemsByDate_item_id_idx ON ItemsByDate(item_id);
CREATE INDEX ItemsByDateAccessioned_item_id_idx ON ItemsByDateAccessioned(item_id);
-- Improve mapping tables
CREATE INDEX Community2Collection_community_id_idx ON Community2Collection(community_id);
CREATE INDEX Community2Collection_collection_id_idx ON Community2Collection(collection_id);
CREATE INDEX Collection2Item_item_id_idx ON Collection2Item( item_id );