mirror of
https://github.com/bitwarden/server.git
synced 2025-04-06 21:48:12 -05:00
index tuning script
This commit is contained in:
parent
aa045f7775
commit
39baf2a9be
@ -15,3 +15,9 @@
|
|||||||
CONSTRAINT [FK_OrganizationUser_User] FOREIGN KEY ([UserId]) REFERENCES [dbo].[User] ([Id])
|
CONSTRAINT [FK_OrganizationUser_User] FOREIGN KEY ([UserId]) REFERENCES [dbo].[User] ([Id])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
GO
|
||||||
|
CREATE NONCLUSTERED INDEX [IX_OrganizationUser_UserIdOrganizationIdStatus]
|
||||||
|
ON [dbo].[OrganizationUser]([UserId] ASC, [OrganizationId] ASC, [Status] ASC)
|
||||||
|
INCLUDE ([AccessAll]);
|
||||||
|
|
||||||
|
42
util/Setup/DbScripts/2017-11-13_IndexTuning.sql
Normal file
42
util/Setup/DbScripts/2017-11-13_IndexTuning.sql
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
IF EXISTS (
|
||||||
|
SELECT * FROM sys.indexes WHERE [Name]='IX_Cipher_UserId_Type'
|
||||||
|
AND object_id = OBJECT_ID('[dbo].[Cipher]')
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
DROP INDEX [IX_Cipher_UserId_Type] ON [dbo].[Cipher]
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF NOT EXISTS (
|
||||||
|
SELECT * FROM sys.indexes WHERE [Name]='IX_Cipher_UserId_Type_IncludeAll'
|
||||||
|
AND object_id = OBJECT_ID('[dbo].[Cipher]')
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
CREATE NONCLUSTERED INDEX [IX_Cipher_UserId_Type_IncludeAll]
|
||||||
|
ON [dbo].[Cipher]([UserId] ASC, [Type] ASC)
|
||||||
|
INCLUDE ([OrganizationId], [Data], [Favorites], [Folders], [Attachments], [CreationDate], [RevisionDate])
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF NOT EXISTS (
|
||||||
|
SELECT * FROM sys.indexes WHERE [Name] = 'IX_Folder_UserId_IncludeAll'
|
||||||
|
AND object_id = OBJECT_ID('[dbo].[Folder]')
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
CREATE NONCLUSTERED INDEX [IX_Folder_UserId_IncludeAll]
|
||||||
|
ON [dbo].[Folder]([UserId] ASC)
|
||||||
|
INCLUDE ([Name], [CreationDate], [RevisionDate])
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF NOT EXISTS (
|
||||||
|
SELECT * FROM sys.indexes WHERE [Name] = 'IX_OrganizationUser_UserIdOrganizationIdStatus'
|
||||||
|
AND object_id = OBJECT_ID('[dbo].[OrganizationUser]')
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
CREATE NONCLUSTERED INDEX [IX_OrganizationUser_UserIdOrganizationIdStatus]
|
||||||
|
ON [dbo].[OrganizationUser]([UserId] ASC,[OrganizationId] ASC,[Status] ASC)
|
||||||
|
INCLUDE ([AccessAll])
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
@ -8,6 +8,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="DbScripts\2017-11-13_IndexTuning.sql" />
|
||||||
<EmbeddedResource Include="DbScripts\2017-11-06_00_FamilyPlanAdjustments.sql" />
|
<EmbeddedResource Include="DbScripts\2017-11-06_00_FamilyPlanAdjustments.sql" />
|
||||||
<EmbeddedResource Include="DbScripts\2017-10-25_00_OrgUserUpdates.sql" />
|
<EmbeddedResource Include="DbScripts\2017-10-25_00_OrgUserUpdates.sql" />
|
||||||
<EmbeddedResource Include="DbScripts\2017-09-08_00_OrgUserCounts.sql" />
|
<EmbeddedResource Include="DbScripts\2017-09-08_00_OrgUserCounts.sql" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user