Skip to content

Commit e4cbed6

Browse files
committed
Eliminate redundant indices
1 parent 69436e3 commit e4cbed6

9 files changed

Lines changed: 174 additions & 3 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
-- This index overlaps with pk_luminex_runexclusion
2+
DROP INDEX luminex.idx_luminexrunexclusion_runid;
3+
-- This index overlaps with uq_analyte_lsid
4+
DROP INDEX luminex.ix_luminexdatarow_lsid;
5+
-- This index overlaps with pk_luminex_analytetitration
6+
DROP INDEX luminex.idx_luminexanalytetitration_analyteid;
7+
-- This index overlaps with uq_curvefit
8+
DROP INDEX luminex.idx_luminexcurvefit_analyteidtitrationid;
9+
-- This index overlaps with pk_analytesinglepointcontrol
10+
DROP INDEX luminex.idx_analytesinglepointcontrol_analyteid;
11+
-- This index overlaps with pk_luminexwellexclusionanalyte
12+
DROP INDEX luminex.idx_luminexwellexclusionanalyte_analyteid;
13+
-- This index overlaps with pk_luminexrunexclusionanalyte
14+
DROP INDEX luminex.idx_luminexrunexclusionanalyte_analyteid;
15+
16+
-- Previous index seems to be incorrect... this is the SQL Server version
17+
CREATE INDEX IX_LuminexDataRow_LSID ON luminex.DataRow (LSID);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
-- This index overlaps with PK_Luminex_RunExclusion
2+
DROP INDEX IDX_LuminexRunExclusion_RunId ON luminex.RunExclusion;
3+
-- This index overlaps with PK_LuminexWellExclusionAnalyte
4+
DROP INDEX IDX_LuminexWellExclusionAnalyte_AnalyteId ON luminex.WellExclusionAnalyte;
5+
-- This index overlaps with PK_Luminex_AnalyteTitration
6+
DROP INDEX IDX_LuminexAnalyteTitration_AnalyteId ON luminex.AnalyteTitration;
7+
-- This index overlaps with PK_AnalyteSinglePointControl
8+
DROP INDEX IDX_AnalyteSinglePointControl_AnalyteId ON luminex.AnalyteSinglePointControl;
9+
-- This index overlaps with UQ_CurveFit
10+
DROP INDEX IDX_LuminexCurveFit_AnalyteIdTitrationId ON luminex.CurveFit;
11+
-- This index overlaps with PK_LuminexRunExclusionAnalyte
12+
DROP INDEX IDX_LuminexRunExclusionAnalyte_AnalyteId ON luminex.RunExclusionAnalyte;

luminex/src/org/labkey/luminex/LuminexModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public String getName()
4545
@Override
4646
public @Nullable Double getSchemaVersion()
4747
{
48-
return 25.000;
48+
return 25.001;
4949
}
5050

5151
@Override
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- This index overlaps with pk_proteinquantitation
2+
DROP INDEX ms2.ix_proteinquantitation_proteingroupid;
3+
-- This index overlaps with pk_ms2peptidememberships
4+
DROP INDEX ms2.ix_peptidemembership_proteingroupid;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- This index overlaps with PK_ProteinQuantitation
2+
DROP INDEX IX_ProteinQuantitation_ProteinGroupId ON ms2.ProteinQuantitation;
3+
-- This index overlaps with pk_ms2peptidememberships
4+
DROP INDEX IX_Peptidemembership_ProteingroupId ON ms2.PeptideMemberships;

ms2/src/org/labkey/ms2/MS2Module.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public String getName()
117117
@Override
118118
public @Nullable Double getSchemaVersion()
119119
{
120-
return 25.000;
120+
return 25.001;
121121
}
122122

123123
@Override
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
-- This index overlaps with ix_annotations_annotident
2+
DROP INDEX prot.ix_annotations_identid;
3+
-- This index overlaps with uq_customannotationset
4+
DROP INDEX prot.ix_customannotationset_container;
5+
-- This index overlaps with ix_gographpath_term1_2_id and IX_GoGraphPath_t1_distance
6+
DROP INDEX prot.ix_gographpath_term1id;
7+
-- This index overlaps with uq_goterm2term_1_2_r
8+
DROP INDEX prot.ix_goterm2term_term1_2_id;
9+
-- This index overlaps with uq_goterm2term_1_2_r
10+
DROP INDEX prot.ix_goterm2term_term1id;
11+
-- This index overlaps with uq_gotermsynonym_termid_termsynonym
12+
DROP INDEX prot.ix_gotermsynonym_termid;
13+
14+
-- Create functions to drop & create all GO indexes. This helps with load performance.
15+
CREATE OR REPLACE FUNCTION prot.create_go_indexes() RETURNS void AS $$
16+
BEGIN
17+
ALTER TABLE prot.goterm ADD CONSTRAINT pk_goterm PRIMARY KEY (id);
18+
CREATE INDEX IX_GoTerm_Name ON prot.GoTerm(name);
19+
CREATE INDEX IX_GoTerm_TermType ON prot.GoTerm(termtype);
20+
CREATE UNIQUE INDEX UQ_GoTerm_Acc ON prot.GoTerm(acc);
21+
22+
ALTER TABLE prot.goterm2term ADD CONSTRAINT pk_goterm2term PRIMARY KEY (id);
23+
CREATE INDEX IX_GoTerm2Term_term2Id ON prot.GoTerm2Term(term2Id);
24+
CREATE INDEX IX_GoTerm2Term_relationshipTypeId ON prot.GoTerm2Term(relationshipTypeId);
25+
CREATE UNIQUE INDEX UQ_GoTerm2Term_1_2_R ON prot.GoTerm2Term(term1Id,term2Id,relationshipTypeId);
26+
27+
ALTER TABLE prot.gographpath ADD CONSTRAINT pk_gographpath PRIMARY KEY (id);
28+
CREATE INDEX IX_GoGraphPath_term2Id ON prot.GoGraphPath(term2Id);
29+
CREATE INDEX IX_GoGraphPath_term1_2_Id ON prot.GoGraphPath(term1Id,term2Id);
30+
CREATE INDEX IX_GoGraphPath_t1_distance ON prot.GoGraphPath(term1Id,distance);
31+
32+
CREATE INDEX IX_GoTermDefinition_dbXrefId ON prot.GoTermDefinition(dbXrefId);
33+
CREATE UNIQUE INDEX UQ_GoTermDefinition_termId ON prot.GoTermDefinition(termId);
34+
35+
CREATE INDEX IX_GoTermSynonym_SynonymTypeId ON prot.GoTermSynonym(synonymTypeId);
36+
CREATE INDEX IX_GoTermSynonym_termSynonym ON prot.GoTermSynonym(termSynonym);
37+
CREATE UNIQUE INDEX UQ_GoTermSynonym_termId_termSynonym ON prot.GoTermSynonym(termId,termSynonym);
38+
END;
39+
$$ LANGUAGE plpgsql;
40+
41+
-- Use fn_dropifexists to increase reliability
42+
CREATE OR REPLACE FUNCTION prot.drop_go_indexes() RETURNS void AS $$
43+
BEGIN
44+
PERFORM core.fn_dropifexists('goterm', 'prot', 'Constraint', 'pk_goterm');
45+
PERFORM core.fn_dropifexists('goterm', 'prot', 'Index', 'IX_GoTerm_Name');
46+
PERFORM core.fn_dropifexists('goterm', 'prot', 'Index', 'IX_GoTerm_TermType');
47+
PERFORM core.fn_dropifexists('goterm', 'prot', 'Index', 'UQ_GoTerm_Acc');
48+
49+
PERFORM core.fn_dropifexists('goterm2term', 'prot', 'Constraint', 'pk_goterm2term');
50+
PERFORM core.fn_dropifexists('goterm2term', 'prot', 'Index', 'IX_GoTerm2Term_term2Id');
51+
PERFORM core.fn_dropifexists('goterm2term', 'prot', 'Index', 'IX_GoTerm2Term_relationshipTypeId');
52+
PERFORM core.fn_dropifexists('goterm2term', 'prot', 'Index', 'UQ_GoTerm2Term_1_2_R');
53+
54+
PERFORM core.fn_dropifexists('gographpath', 'prot', 'Constraint', 'pk_gographpath');
55+
PERFORM core.fn_dropifexists('gographpath', 'prot', 'Index', 'IX_GoGraphPath_term2Id');
56+
PERFORM core.fn_dropifexists('gographpath', 'prot', 'Index', 'IX_GoGraphPath_term1_2_Id');
57+
PERFORM core.fn_dropifexists('gographpath', 'prot', 'Index', 'IX_GoGraphPath_t1_distance');
58+
59+
PERFORM core.fn_dropifexists('gotermdefinition', 'prot', 'Index', 'IX_GoTermDefinition_dbXrefId');
60+
PERFORM core.fn_dropifexists('gotermdefinition', 'prot', 'Index', 'UQ_GoTermDefinition_termId');
61+
62+
PERFORM core.fn_dropifexists('gotermsynonym', 'prot', 'Index', 'IX_GoTermSynonym_SynonymTypeId');
63+
PERFORM core.fn_dropifexists('gotermsynonym', 'prot', 'Index', 'IX_GoTermSynonym_termSynonym');
64+
PERFORM core.fn_dropifexists('gotermsynonym', 'prot', 'Index', 'UQ_GoTermSynonym_termId_termSynonym');
65+
END;
66+
$$ LANGUAGE plpgsql;
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
-- This index overlaps with IX_Annotations_AnnotIdent
2+
DROP INDEX IX_Annotations_IdentId ON prot.Annotations;
3+
-- This index overlaps with IX_GoGraphPath_term1_2_Id and IX_GoGraphPath_t1_distance
4+
DROP INDEX IX_GoGraphPath_term1Id ON prot.GoGraphPath;
5+
-- This index overlaps with UQ_CustomAnnotationSet
6+
DROP INDEX IX_CustomAnnotationSet_Container ON prot.CustomAnnotationSet;
7+
-- This index overlaps with UQ_GoTerm2Term_1_2_R
8+
DROP INDEX IX_GoTerm2Term_term1Id ON prot.GoTerm2Term;
9+
-- This index overlaps with UQ_GoTerm2Term_1_2_R
10+
DROP INDEX IX_GoTerm2Term_term1_2_Id ON prot.GoTerm2Term;
11+
-- This index overlaps with UQ_GoTermSynonym_termId_termSynonym
12+
DROP INDEX IX_GoTermSynonym_TermId ON prot.GoTermSynonym;
13+
14+
GO
15+
16+
ALTER PROCEDURE prot.create_go_indexes AS
17+
BEGIN
18+
ALTER TABLE prot.goterm ADD CONSTRAINT pk_goterm PRIMARY KEY (id)
19+
CREATE INDEX IX_GoTerm_Name ON prot.GoTerm(name)
20+
CREATE INDEX IX_GoTerm_TermType ON prot.GoTerm(termtype)
21+
CREATE UNIQUE INDEX UQ_GoTerm_Acc ON prot.GoTerm(acc)
22+
23+
ALTER TABLE prot.goterm2term ADD CONSTRAINT pk_goterm2term PRIMARY KEY (id)
24+
CREATE INDEX IX_GoTerm2Term_term2Id ON prot.GoTerm2Term(term2Id)
25+
CREATE INDEX IX_GoTerm2Term_relationshipTypeId ON prot.GoTerm2Term(relationshipTypeId)
26+
CREATE UNIQUE INDEX UQ_GoTerm2Term_1_2_R ON prot.GoTerm2Term(term1Id,term2Id,relationshipTypeId)
27+
28+
ALTER TABLE prot.gographpath ADD CONSTRAINT pk_gographpath PRIMARY KEY (id)
29+
CREATE INDEX IX_GoGraphPath_term2Id ON prot.GoGraphPath(term2Id)
30+
CREATE INDEX IX_GoGraphPath_term1_2_Id ON prot.GoGraphPath(term1Id,term2Id)
31+
CREATE INDEX IX_GoGraphPath_t1_distance ON prot.GoGraphPath(term1Id,distance)
32+
33+
CREATE INDEX IX_GoTermDefinition_dbXrefId ON prot.GoTermDefinition(dbXrefId)
34+
CREATE UNIQUE INDEX UQ_GoTermDefinition_termId ON prot.GoTermDefinition(termId)
35+
36+
CREATE INDEX IX_GoTermSynonym_SynonymTypeId ON prot.GoTermSynonym(synonymTypeId)
37+
CREATE INDEX IX_GoTermSynonym_termSynonym ON prot.GoTermSynonym(termSynonym)
38+
CREATE UNIQUE INDEX UQ_GoTermSynonym_termId_termSynonym ON prot.GoTermSynonym(termId,termSynonym);
39+
END
40+
41+
GO
42+
43+
ALTER PROCEDURE prot.drop_go_indexes AS
44+
BEGIN
45+
EXEC core.fn_dropifexists 'goterm', 'prot', 'Constraint', 'PK_GoTerm'
46+
EXEC core.fn_dropifexists 'goterm', 'prot', 'Index', 'IX_GoTerm_Name'
47+
EXEC core.fn_dropifexists 'goterm', 'prot', 'Index', 'IX_GoTerm_TermType'
48+
EXEC core.fn_dropifexists 'goterm', 'prot', 'Index', 'UQ_GoTerm_Acc'
49+
50+
EXEC core.fn_dropifexists 'goterm2term', 'prot', 'Constraint', 'PK_GoTerm2Term'
51+
EXEC core.fn_dropifexists 'goterm2term', 'prot', 'Index', 'IX_GoTerm2Term_term2Id'
52+
EXEC core.fn_dropifexists 'goterm2term', 'prot', 'Index', 'IX_GoTerm2Term_relationshipTypeId'
53+
EXEC core.fn_dropifexists 'goterm2term', 'prot', 'Index', 'UQ_GoTerm2Term_1_2_R'
54+
55+
EXEC core.fn_dropifexists 'gographpath', 'prot', 'Constraint', 'PK_GoGraphPath'
56+
EXEC core.fn_dropifexists 'gographpath', 'prot', 'Index', 'IX_GoGraphPath_term2Id'
57+
EXEC core.fn_dropifexists 'gographpath', 'prot', 'Index', 'IX_GoGraphPath_term1_2_Id'
58+
EXEC core.fn_dropifexists 'gographpath', 'prot', 'Index', 'IX_GoGraphPath_t1_distance'
59+
60+
EXEC core.fn_dropifexists 'gotermdefinition', 'prot', 'Index', 'IX_GoTermDefinition_dbXrefId'
61+
EXEC core.fn_dropifexists 'gotermdefinition', 'prot', 'Index', 'UQ_GoTermDefinition_termId'
62+
63+
EXEC core.fn_dropifexists 'gotermsynonym', 'prot', 'Index', 'IX_GoTermSynonym_SynonymTypeId'
64+
EXEC core.fn_dropifexists 'gotermsynonym', 'prot', 'Index', 'IX_GoTermSynonym_termSynonym'
65+
EXEC core.fn_dropifexists 'gotermsynonym', 'prot', 'Index', 'UQ_GoTermSynonym_termId_termSynonym';
66+
END
67+
68+
GO

protein/src/org/labkey/protein/ProteinModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public String getName()
6868
@Override
6969
public @Nullable Double getSchemaVersion()
7070
{
71-
return 25.002;
71+
return 25.003;
7272
}
7373

7474
@Override

0 commit comments

Comments
 (0)