1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-17 15:40:59 -05:00

query tuning. more userid denorm support

This commit is contained in:
Kyle Spearrin
2017-04-14 12:49:35 -04:00
parent f9ef519ec0
commit c6dcac96d3
5 changed files with 22 additions and 6 deletions

View File

@ -20,7 +20,12 @@ BEGIN
WHERE
C.Id = @Id
AND (
(C.[UserId] IS NOT NULL AND C.[UserId] = @UserId)
OR (OU.[UserId] = @UserId AND OU.[Status] = 2 AND O.[Enabled] = 1) -- 2 = Confirmed
C.[UserId] = @UserId
OR (
C.[UserId] IS NULL
AND OU.[UserId] = @UserId
AND OU.[Status] = 2 -- 2 = Confirmed
AND O.[Enabled] = 1
)
)
END

View File

@ -20,7 +20,12 @@ BEGIN
WHERE
C.[Type] = @Type
AND (
(C.[UserId] IS NOT NULL AND C.[UserId] = @UserId)
OR (OU.[UserId] = @UserId AND OU.[Status] = 2 AND O.[Enabled] = 1) -- 2 = Confirmed
C.[UserId] = @UserId
OR (
C.[UserId] IS NULL
AND OU.[UserId] = @UserId
AND OU.[Status] = 2 -- 2 = Confirmed
AND O.[Enabled] = 1
)
)
END