pgadmin4/web/pgadmin
Michal Charemza 83ade5dcc2
Update the query that fetches roles to be faster with many roles.
This changes the query that fetches roles from using the
pg_catalog.shobj_description function to using an explicit join on
pg_catalog.pg_shdescription. In my specific case, in a production system with
over 20k roles, this reduces the query time down from 8 minutes(!) down to
~40ms. Just in case it was a locking issue, I did use pg_activity to
investigate locks, and nothing was being blocked during the 8 minutes.

This fixes a problem that exists only for certain users, and specifically in my
case where the user that runs the query is themselves a member (directly and
indirectly) of a high number of roles. Running the existing query as a user
that has a low number of roles (and specifically, the master user in an AWS RDS
database), the existing query is fairly performant.

My best explanation as to the performance difference comes from the definition
of shobj_description
2a8a00674e/src/backend/catalog/system_functions.sql (L303-L312).
Each time it's called it runs a query against pg_shdescription and pg_class,
and so in my case runs 20k times, compared to the equivalent of once when doing
the explicit join on pg_shdescription. It should also be noted that in my case
pg_class is quite big - currently about 500k rows (although it has grown to ~5
million in the past, but that was borderline a mistake).

See https://github.com/pgadmin-org/pgadmin4/pull/8457#issue-2853052114 for
EXPLAIN ANALYZE results of the existing query and the updated query.
2025-02-17 17:20:28 +05:30
..
about Only the python version should be shown in the about dialog. #8249 2025-01-03 20:49:56 +05:30
authenticate Add support for OAuth2 profile array response, which also takes care of the GitHub Private Email ID issue. #8391 2025-01-28 16:53:56 +05:30
browser Update the query that fetches roles to be faster with many roles. 2025-02-17 17:20:28 +05:30
dashboard 1) Fixed an issue where loadingText message is not shown in SchemaView. 2025-01-24 13:58:21 +05:30
help Copyright updated for 2025 2025-01-01 11:26:42 +05:30
misc Workspace Layout Update - Enhanced Query Tool and PSQL Behaviour: 2025-02-11 15:36:03 +05:30
model Copyright updated for 2025 2025-01-01 11:26:42 +05:30
preferences Workspace Layout Update - Enhanced Query Tool and PSQL Behaviour: 2025-02-11 15:36:03 +05:30
redirects Copyright updated for 2025 2025-01-01 11:26:42 +05:30
settings Copyright updated for 2025 2025-01-01 11:26:42 +05:30
setup Copyright updated for 2025 2025-01-01 11:26:42 +05:30
static Fix the following SonarQube issues: 2025-02-13 11:56:10 +05:30
templates Fix the Jinja2 error for python 3.8. 2024-10-18 19:30:42 +05:30
tools Fix the following SonarQube issues: 2025-02-13 11:56:10 +05:30
translations Czech translation for version 9.0 2025-02-03 10:31:31 +05:30
utils Fixed an issue where pgAdmin does not support pg_vector column length/precision. #8181 2025-02-12 16:14:31 +05:30
__init__.py 1) Fixed an issue where User Language is not getting changed. 2025-01-07 13:55:02 +05:30
evaluate_config.py Copyright updated for 2025 2025-01-01 11:26:42 +05:30
messages.pot 1) Update version for v9.0 2025-01-30 18:16:05 +05:30
submodules.py Added support for viewing PGD Clusters. #7215 2024-05-20 16:54:49 +05:30
user_login_check.py Copyright updated for 2025 2025-01-01 11:26:42 +05:30