The execution speed of an ordinary user is slower than that of the dbadmin user in the following scenarios:
Ordinary users queuing: waiting in queue/waiting in global queue/waiting in ccn queue
You can increase the value of this parameter or clear some statements to avoid queuing.
Change the value of max_active_statements on the management console.
The OR conditions in the execution plans contain permission-related checks. This scenario usually occurs when the system view is used. For example, in the following SQL statement:
1 2 3 4 5 6 7 8 | SELECT distinct(dtp.table_name), ta.table_catalog, ta.table_schema, ta.table_name, ta.table_type from information_schema.tables ta left outer join DBA_TAB_PARTITIONS dtp on (dtp.schema = ta.table_schema and dtp.table_name = ta.table_name) where ta.table_schema = 'public'; |
Part of the execution plan is as follows:
In the system view, the OR condition is used for permission check.
1 | pg_has_role(c.relowner, 'USAGE'::text) OR has_table_privilege(c.oid, 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER'::text) OR has_any_column_privilege(c.oid, 'SELECT, INSERT, UPDATE, REFERENCES'::text) |
true is always returned for pg_has_role of the dbadmin use. Therefore, the conditions after OR do not need to be checked.
While the OR conditions of an ordinary user need to be checked one by one. If there are a large number of tables in the database, the execution time of the ordinary user is longer than that of the dbadmin user.
In this scenario, if the number of output result sets is small, you can set set enable_hashjoin and enable_seqscan to off, to use the index+nestloop plan.
Run the following command to check whether the resource pools corresponding to an ordinary user are the same as that of the administrator user. If they are different, check whether the tenant resources allocated to the two users are different.
1 | SELECt * FROM pg_user; |