mirror of
https://github.com/bitwarden/server.git
synced 2024-11-22 12:15:36 +01:00
join optimizations
This commit is contained in:
parent
c6dcac96d3
commit
8e193dfc62
@ -9,7 +9,7 @@ BEGIN
|
||||
FROM
|
||||
[dbo].[CipherDetails](@UserId) C
|
||||
LEFT JOIN
|
||||
[dbo].[SubvaultCipher] SC ON SC.[CipherId] = C.[Id]
|
||||
[dbo].[SubvaultCipher] SC ON C.[UserId] IS NULL AND SC.[CipherId] = C.[Id]
|
||||
LEFT JOIN
|
||||
[dbo].[SubvaultUser] SU ON SU.[SubvaultId] = SC.[SubvaultId]
|
||||
LEFT JOIN
|
||||
|
@ -24,7 +24,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
|
Loading…
Reference in New Issue
Block a user