The superuser permissions in RDS PPAS are not released, so you cannot use the superuser account in the same way as offline usage of PPAS to manage database objects. Therefore, we provide a set of common management functions, allowing you to use various PPAS features.
Rules for using management functions
Various management functions on the cloud must be run by an RDS root account. The RDS root account is a management account specified upon instance allocation, and has the permissions such as createdb, createrole, and logon.
- Plugin management function: rds_manage_extension
This function enables you to manage plugins on the cloud. You can use this function to create and delete the plugins that are currently supported by PPAS.
rds_manage_extension(operation text, pname text, schema text default NULL,logging bool default false) operation: create or drop pname: the name of the supported plugin schema: the target mode to which the plugin is created logging: the log information obtained upon creating the plugin The plugins that are currently supported include: pg_stat_statements btree_gin btree_gist chkpass citext cube dblink dict_int earthdistance hstore intagg intarray isn ltree pgcrypto pgrowlocks pg_prewarm pg_trgm postgres_fdw sslinfo tablefunc tsearch2 unaccent postgis postgis_topology fuzzystrmatch postgis_tiger_geocoder plperl pltcl plv8 "uuid-ossp" plpgsql oss_fdw For example: 1. Create the plugin named dblink. select rds_manage_extension('create','dblink'); 2. Delete the plugin named dblink. select rds_manage_extension('drop','dblink');
- Currently connected session: rds_pg_stat_activity()
This function is similar to the pg_stat_activity view, and returns all information about the connected sessions related to the account.
- Check slow SQL: rds_pg_stat_statements()
This function is the encapsulation of the pg_stat_statements view. It allows you to check the slow SQL statements within your range of permission.
- Performance analysis functions
This group of functions is similar to the Oracle AWR report. It enables you to analyze the real-time performance of the current PPAS instance.
1 rds_truncsnap（） NOTE: Delete all currently stored snapshots. 2 rds_get_snaps() NOTE: Get the information of all currently stored snapshots. 3 rds_snap() NOTE: Generate a real-time snapshot. 4 rds_report(beginsnap bigint, endsnap bigint) Produce a starting snapshot change and an ending snapshot change to generate a snapshot based performance analysis report. Example: The process of generating a performance analysis report through the production of snapshots is described as follows. SELECT * FROM rds_truncsnap(); // Delete the previously stored snapshots. SELECT * from rds_snap(); // Produce a snapshot. SELECT * from rds_snap(); // Produce a snapshot. SELECT * from rds_snap(); // Produce a snapshot. SELECT * FROM rds_get_snaps(); // Get the currently produced snapshots ID, namely, 1, 2, and 3. SELECT * FROM edbreport(1, 3); // Generate a performance analysis report based on the snapshots.
- Session termination function.
rds_pg_terminate_backend(upid int) rds_pg_cancel_backend(upid int) These two functions are the native pg_terminate_backend and pg_cancel_backend. The only difference between the two functions is that they cannot run the connections created by the superuser. Example: Terminate the session with process ID 123456. select rds_pg_cancel_backend(123456);
- VPD function
VPD is short for Virtual Private Database. It is an encapsulation compatible with Package DBMS_RLS because their parameters are the same.
1 rds_drop_policy corresponding to DBMS_RLS.DROP_POLICY 2 rds_enable_policy corresponding to DBMS_RLS.ENABLE_POLICY 3 rds_add_policy corresponding to DBMS_RLS.ADD_POLICY