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.
* Updated the columns for the unique and primary keys while creating a table.
Use the 'editable' option for a Cell instead of 'disabled'.
* Don't need to define the hidden member as fields in GridHeaderSchema
* Updated the columns for the exclusion constraints while creating a
table.
* Signaled the relevant field, when column options have changed, for all
the children of a table.
* Use current snapshot of data for the GrigFormHeadeer
* Fixed the styling for the search input box
* Don't check for the 'colOptions.editable' flag, as it could be
indirect call as well.
* Fix an issue - when the object browser tree is being recreated due to reloading for changes in some of the preferences. Tree object returns object from the previous instance as 'selected', but - it does not have the 'treeNodeInfo' available. In this special case - we would consider that there is no node selected at that particular moment, and pass information accordingly.
* Fixed 'New Connection' dialog issue after connecting a disconnected server.
* Disable the 'Add' button in the GridHeader with form, when 'canAdd'
flag is set to false.
* Convert the access path to string array for correct comparision.
* Check the access path type before comparison.
When language is 'c', set the 'code' block read-only.
* Enabled 'Strict' control for EPAS >= 95
* Show the icon for the 'Reset' button. (Reference #7884)
* Reload the server list after connecting to a server in the 'New
connection' dialog (QueryTool). (Reference: #7884)
* Pass the grid path during the bulk update (click on a radio action)
* Don't assign the cell value to the 'rowValue' variable.
* Don't rely on the 'optionsLoaded' for setting the variable types as it
is loaded asynchronously, and variable types data may not be available
while rendering the 'value' cell. (Fixes#7884)
* Fixed a type while checking for the 'inline-group'. fixes (#7884)
* 'vnameOptions' can be a Promise function too, hence - taken care accrodingly.
* Introduced a parameter 'reloadOnDepChanges' in the BaseSchemaUI field
to force reload the control on value change for one of the
dependencies.
* Reload on the components in case of dependent value changes.
* Introduced 'useSchemaStateSubscriber', which generates a state
subscriber mananager instance. It helps multiple subscribers in a
single control as we could have multiple subscribe within a control.
(For example - value, options, errors, etc).
* Fixed all the issues reported (#7884)
Restructured these modules for ease of maintenance and apply the single
responsibility principle (wherever applicable).
* SchemaView
- Split the code based on the functionality and responsibility.
- Introduced a new View 'InlineView' instead of using the
'nextInline' configuration of the fields to have a better, and
manageable view.
- Using the separate class 'SchemaState' for managing the data and
states of the SchemaView (separated from the 'useSchemaState'
custom hook).
- Introduced three new custom hooks 'useFieldValue',
'useFieldOptions', 'useFieldError' for the individual control to
use for each Schema Field.
- Don't pass value as the parameter props, and let the
'useFieldValue' and other custom hooks to decide, whether to
rerender the control itself or the whole dialog/view. (single
responsibility principle)
- Introduced a new data store with a subscription facility.
- Moving the field metadata (option) evaluation to a separate place
for better management, and each option can be defined for a
particular kind of field (for example - collection, row, cell,
general, etc).
- Allow to provide custom control for all kind of Schema field.
* DataGridView
- Same as SchemaView, split the DataGridView call into smaller,
manageable chunks. (For example - grid, row, mappedCell, etc).
- Use context based approach for providing the row and table data
instead of passing them as parameters to every component
separately.
- Have a facility to extend this feature separately in future.
(for example - selectable cell, column grouping, etc.)
- Separated the features like deletable, editable, reorder,
expandable etc. cells using the above feature support.
- Added ability to provide the CustomHeader, and CustomRow through the
Schema field, which will extend the ability to customize better.
- Removed the 'DataGridViewWithHeaderForm' as it has been achieved
through providing 'CustomHeader', and also introduced
'DataGridFormHeader' (a custom header) to achieve the same feature
as 'DataGridViewWithHeaderForm'.
The new implementation will store the master password in the keyring instead of storing each and every server password separately. The master password will be used to encrypt/decrypt server password when storing in the pgAdmin config DB.
1) Do not use the Array index in keys.
2) Import from the same module should be merged.
3) Mutable variables should not be exported.
4) Variables should not be initialized to undefined.
5) startswith or endswith method should be used.
6) Unwrap this unnecessarily grouped subpattern.
Additionally, addressed many other SonarQube rules.
1) Use the "RegExp.exec()" method instead.
2) Remove parameter form or provide default value.
3) Extract this nested ternary operation into an independent statement.
4) Replace this character class by the character itself.
5) Unnecessary use of conditional expression for default assignment.
6) Prefer using an optional chain expression instead, as it's more concise and easier to read.
1) String literals should not be duplicated.
2) Prefer using an optional chain expression instead, as it's more concise and easier to read.
3) Expected the Promise rejection reason to be an Error.
2. Disable Debugger for system catalogs. #6060
3. Fixed an issue where the keyboard shortcut for launching the debugger from Object Explorer was not working.