mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 02:54:20 +00:00
* perf(query): increase speed of user queries
This commit is contained in:
parent
cc2dd8b20b
commit
a8b8c89f73
@ -23,8 +23,6 @@ WITH login_names AS (SELECT
|
|||||||
(p.is_default IS TRUE AND p.instance_id = $2)
|
(p.is_default IS TRUE AND p.instance_id = $2)
|
||||||
OR (p.instance_id = $2 AND p.resource_owner = u.resource_owner)
|
OR (p.instance_id = $2 AND p.resource_owner = u.resource_owner)
|
||||||
)
|
)
|
||||||
AND
|
|
||||||
u.id = $1
|
|
||||||
ORDER BY is_default
|
ORDER BY is_default
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
) p ON TRUE
|
) p ON TRUE
|
||||||
@ -33,6 +31,9 @@ WITH login_names AS (SELECT
|
|||||||
ON
|
ON
|
||||||
u.instance_id = d.instance_id
|
u.instance_id = d.instance_id
|
||||||
AND u.resource_owner = d.resource_owner
|
AND u.resource_owner = d.resource_owner
|
||||||
|
WHERE
|
||||||
|
u.instance_id = $2
|
||||||
|
AND u.id = $1
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
u.id
|
u.id
|
||||||
|
@ -30,6 +30,12 @@ WITH found_users AS (
|
|||||||
u.instance_id = d.instance_id
|
u.instance_id = d.instance_id
|
||||||
AND u.resource_owner = d.resource_owner
|
AND u.resource_owner = d.resource_owner
|
||||||
AND CASE WHEN p.must_be_domain THEN d.name_lower = $2 ELSE TRUE END
|
AND CASE WHEN p.must_be_domain THEN d.name_lower = $2 ELSE TRUE END
|
||||||
|
WHERE
|
||||||
|
u.instance_id = $4
|
||||||
|
AND u.user_name_lower IN (
|
||||||
|
$1,
|
||||||
|
$3
|
||||||
|
)
|
||||||
),
|
),
|
||||||
login_names AS (SELECT
|
login_names AS (SELECT
|
||||||
fu.id user_id
|
fu.id user_id
|
||||||
|
@ -24,8 +24,6 @@ WITH login_names AS (
|
|||||||
(p.is_default IS TRUE AND p.instance_id = $2)
|
(p.is_default IS TRUE AND p.instance_id = $2)
|
||||||
OR (p.instance_id = $2 AND p.resource_owner = u.resource_owner)
|
OR (p.instance_id = $2 AND p.resource_owner = u.resource_owner)
|
||||||
)
|
)
|
||||||
AND
|
|
||||||
u.id = $1
|
|
||||||
ORDER BY is_default
|
ORDER BY is_default
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
) p ON TRUE
|
) p ON TRUE
|
||||||
@ -34,6 +32,9 @@ WITH login_names AS (
|
|||||||
ON
|
ON
|
||||||
u.instance_id = d.instance_id
|
u.instance_id = d.instance_id
|
||||||
AND u.resource_owner = d.resource_owner
|
AND u.resource_owner = d.resource_owner
|
||||||
|
WHERE
|
||||||
|
u.instance_id = $2
|
||||||
|
AND u.id = $1
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
u.id
|
u.id
|
||||||
|
@ -30,6 +30,12 @@ WITH found_users AS (
|
|||||||
u.instance_id = d.instance_id
|
u.instance_id = d.instance_id
|
||||||
AND u.resource_owner = d.resource_owner
|
AND u.resource_owner = d.resource_owner
|
||||||
AND CASE WHEN p.must_be_domain THEN d.name_lower = $2 ELSE TRUE END
|
AND CASE WHEN p.must_be_domain THEN d.name_lower = $2 ELSE TRUE END
|
||||||
|
WHERE
|
||||||
|
u.instance_id = $4
|
||||||
|
AND u.user_name_lower IN (
|
||||||
|
$1,
|
||||||
|
$3
|
||||||
|
)
|
||||||
),
|
),
|
||||||
login_names AS (SELECT
|
login_names AS (SELECT
|
||||||
fu.id user_id
|
fu.id user_id
|
||||||
|
Loading…
Reference in New Issue
Block a user