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
|
FROM
|
||||||
[dbo].[CipherDetails](@UserId) C
|
[dbo].[CipherDetails](@UserId) C
|
||||||
LEFT JOIN
|
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
|
LEFT JOIN
|
||||||
[dbo].[SubvaultUser] SU ON SU.[SubvaultId] = SC.[SubvaultId]
|
[dbo].[SubvaultUser] SU ON SU.[SubvaultId] = SC.[SubvaultId]
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
|
@ -24,7 +24,12 @@ BEGIN
|
|||||||
WHERE
|
WHERE
|
||||||
C.Id = @Id
|
C.Id = @Id
|
||||||
AND (
|
AND (
|
||||||
(C.[UserId] IS NOT NULL AND C.[UserId] = @UserId)
|
C.[UserId] = @UserId
|
||||||
OR (OU.[UserId] = @UserId AND OU.[Status] = 2 AND O.[Enabled] = 1) -- 2 = Confirmed
|
OR (
|
||||||
|
C.[UserId] IS NULL
|
||||||
|
AND OU.[UserId] = @UserId
|
||||||
|
AND OU.[Status] = 2 -- 2 = Confirmed
|
||||||
|
AND O.[Enabled] = 1
|
||||||
|
)
|
||||||
)
|
)
|
||||||
END
|
END
|
Loading…
Reference in New Issue
Block a user