diff --git a/src/Sql/dbo/Tables/Cipher.sql b/src/Sql/dbo/Tables/Cipher.sql index f08f542691..35bb26c337 100644 --- a/src/Sql/dbo/Tables/Cipher.sql +++ b/src/Sql/dbo/Tables/Cipher.sql @@ -20,3 +20,8 @@ CREATE NONCLUSTERED INDEX [IX_Cipher_UserId_OrganizationId_IncludeAll] ON [dbo].[Cipher]([UserId] ASC, [OrganizationId] ASC) INCLUDE ([Type], [Data], [Favorites], [Folders], [Attachments], [CreationDate], [RevisionDate]); + +GO +CREATE NONCLUSTERED INDEX [IX_Cipher_OrganizationId] + ON [dbo].[Cipher]([OrganizationId] ASC); + diff --git a/util/Setup/DbScripts/2018-04-24_00_CipherQueryTuning.sql b/util/Setup/DbScripts/2018-04-24_00_CipherQueryTuning.sql index fe5aaa7eb3..d37fa258ed 100644 --- a/util/Setup/DbScripts/2018-04-24_00_CipherQueryTuning.sql +++ b/util/Setup/DbScripts/2018-04-24_00_CipherQueryTuning.sql @@ -134,6 +134,16 @@ BEGIN END GO +IF NOT EXISTS ( + SELECT * FROM sys.indexes WHERE [Name]='IX_Cipher_OrganizationId' + AND object_id = OBJECT_ID('[dbo].[Cipher]') +) +BEGIN + CREATE NONCLUSTERED INDEX [IX_Cipher_OrganizationId] + ON [dbo].[Cipher]([OrganizationId] ASC) +END +GO + IF NOT EXISTS ( SELECT * FROM sys.indexes WHERE [Name]='IX_GroupUser_OrganizationUserId' AND object_id = OBJECT_ID('[dbo].[GroupUser]')