Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUACAMOLE-1573: Slow selection of users on scale on Postgres #711

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,13 @@
email_address,
organization,
organizational_role,
MAX(start_date) AS last_active
(SELECT start_date
FROM guacamole_user_history
WHERE user_id = guacamole_user.user_id
ORDER BY start_date desc
LIMIT 1) AS last_active
FROM guacamole_user
JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id
LEFT JOIN guacamole_user_history ON guacamole_user_history.user_id = guacamole_user.user_id
WHERE guacamole_entity.name IN
<foreach collection="identifiers" item="identifier"
open="(" separator="," close=")">
Expand Down Expand Up @@ -176,10 +179,13 @@
email_address,
organization,
organizational_role,
MAX(start_date) AS last_active
(SELECT start_date
FROM guacamole_user_history
WHERE user_id = guacamole_user.user_id
ORDER BY start_date desc
LIMIT 1) AS last_active
FROM guacamole_user
JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id
LEFT JOIN guacamole_user_history ON guacamole_user_history.user_id = guacamole_user.user_id
WHERE guacamole_entity.name IN
<foreach collection="identifiers" item="identifier"
open="(" separator="," close=")">
Expand Down Expand Up @@ -238,10 +244,13 @@
email_address,
organization,
organizational_role,
MAX(start_date) AS last_active
(SELECT start_date
FROM guacamole_user_history
WHERE user_id = guacamole_user.user_id
ORDER BY start_date desc
LIMIT 1) AS last_active
FROM guacamole_user
JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id
LEFT JOIN guacamole_user_history ON guacamole_user_history.user_id = guacamole_user.user_id
WHERE
guacamole_entity.name = #{username,jdbcType=VARCHAR}
AND guacamole_entity.type = 'USER'::guacamole_entity_type
Expand Down