HomeMogDBMogDB StackUqbar
v3.1

Documentation:v3.1

Supported Versions:

Other Versions:

Statistics Information Functions(3)

  • DBE_PERF.get_summary_statio_user_tables()

    Description: Displays the I/O status information about all user relationship tables in namespaces in MogDB. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_stat_db_cu()

    Description: Queries CU hits in a database and in each node in MogDB. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_stat_all_indexes()

    Description: Displays statistics of each index in databases on all nodes. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_summary_stat_all_indexes()

    Description: Collects statistics of each index in all databases on all nodes. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_stat_sys_tables()

    Description: Displays statistics about the system catalogs of all the namespaces in pg_catalog and information_schema schemas on each node. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_summary_stat_sys_tables()

    Description: Collects statistics about the system catalogs of all the namespaces in pg_catalog and information_schema schemas on each node. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_stat_sys_indexes()

    Description: Displays index status information about all the system catalogs in the pg_catalog and information_schema schemas on each node. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_summary_stat_sys_indexes()

    Description: Collects statistics about index status information about all the system catalogs in the pg_catalog and information_schema schemas on each node. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_stat_user_tables()

    Description: Displays the status information about customized ordinary tables in all namespaces. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_summary_stat_user_tables()

    Description: Collects statistics about the status information about customized ordinary tables in all namespaces. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_stat_user_indexes()

    Description: Displays the status information about the index of customized ordinary tables in all databases. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_summary_stat_user_indexes()

    Description: Collects statistics about the status information about the index of customized ordinary tables in all databases. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_stat_database()

    Description: Displays database statistics of all nodes. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_stat_database_conflicts()

    Description: Collects statistics on the database of all nodes. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_stat_xact_all_tables()

    Description: Displays transaction status information about all ordinary tables and TOAST tables in all namespaces. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_summary_stat_xact_all_tables()

    Description: Collects statistics about transaction status information about all ordinary tables and TOAST tables in all namespaces. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_stat_xact_sys_tables()

    Description: Displays transaction status information about all system catalogs in namespaces on all nodes. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_summary_stat_xact_sys_tables()

    Description: Collects statistics about transaction status information about all system catalogs in namespaces on all nodes. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_stat_xact_user_tables()

    Description: Displays the transaction status information of the user tables in the namespaces on all nodes. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_summary_stat_xact_user_tables()

    Description: Collects statistics about the transaction status information of the user tables in the namespaces on all nodes. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_stat_user_functions()

    Description: Displays the transaction status information of customized functions in the namespaces on all nodes. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_stat_xact_user_functions()

    Description: Collects statistics about the transaction status information of customized functions in the namespaces on all nodes. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_stat_bad_block()

    Description: Displays information about table and index read failures on all nodes. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_file_redo_iostat()

    Description: Collects statistics on information about table and index read failures on all nodes. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_file_iostat()

    Description: Displays statistics about data file I/Os on all nodes. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_locks()

    Description: Displays lock information of all nodes. To query this function, you must have the sysadmin or monadmin permission.

    Return type: record

  • DBE_PERF.get_global_replication_slots()

    Description: Displays logical replication information on all nodes. To query this function, you must have the sysadmin or monadmin permission.

    Return type: record

  • DBE_PERF.get_global_bgwriter_stat()

    Description: Displays statistics about the background writer process's activities on all nodes. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_replication_stat()

    Description: Displays information about log synchronization status on each node, such as the locations where the sender sends logs and where the receiver receives logs. To query this function, you must have the sysadmin or monadmin permission.

    Return type: record

  • DBE_PERF.get_global_transactions_running_xacts()

    Description: Displays information about running transactions on each node. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_summary_transactions_running_xacts()

    Description: Collects statistics of information about running transactions on each node. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_transactions_prepared_xacts()

    Description: Displays information about transactions that are currently prepared for two-phase commit on each node. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_summary_transactions_prepared_xacts()

    Description: Collects statistics information about transactions that are currently prepared for two-phase commit on each node. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_summary_statement()

    Description: Displays the status information of the historically-executed statements on each node. To query this function, you must have the sysadmin and monitor admin permissions.

    Return type: record

  • DBE_PERF.get_global_statement_count()

    Description: Displays the number of SELECT, UPDATE, INSERT, and DELETE statements and response time information (TOTAL, AVG, MIN, and MAX) on each node. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_config_settings()

    Description: Displays GUC parameter configuration information on each node. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_wait_events()

    Description: Displays the wait event status information on each node. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_statement_responsetime_percentile()

    Description: Obtains the response time distribution for 80% and 95% SQL statements of MogDB. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_summary_user_login()

    Description: Collects statistics about number of user login and logout times on each node in MogDB. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.get_global_record_reset_time()

    Description: Displays the statistics about reset (restart, primary/standby switchover, and database deletion) time of MogDB. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.track_memory_context(context_list text)

    Description: Sets the memory context whose memory application details need to be collected. The input parameter is the memory context names, which are separated by commas (,), for example, ThreadTopMemoryContext, SessionCacheMemoryContext. Note that the memory context names are context-sensitive. In addition, the length of a single memory context is 63, and the excess part is truncated. The maximum number of memory contexts that can be collected at a time is 16. If the number of memory contexts exceeds 16, the setting fails. Each time this function is called, the previous statistics result is cleared. When the input parameter is set to ””, the statistics function is disabled. Only the initial user (super user) or a user with the monadmin permission can execute this function.

    Return type: Boolean

  • DBE_PERF.track_memory_context_detail()

    Description: Obtains the memory application details of the memory context specified by the DBE_PERF.track_memory_context function. For details, see the DBE_PERF.track_memory_context_detail view. Only the initial user (super user) or a user with the monadmin permission can execute this function.

    Return type: record

  • pg_stat_get_mem_mbytes_reserved(tid)

    Description: Collects statistics on variables related to resource management, which is used only for fault locating.

    Parameter: thread ID

    Return type: text

  • gs_wlm_user_resource_info(name text)

    Description: Queries a user's resource quota and resource usage.

    Return type: record

  • pg_stat_get_file_stat()

    Description: Rrecords statistics about data file I/Os to indicate I/O performance and detect performance problems such as abnormal I/O operations.

    Return type: record

  • pg_stat_get_redo_stat()

    Description: Displays statistics on the replay of session thread logs.

    Return type: record

  • pg_stat_get_status(int8)

    Description: Tests the block waiting status about the backend thread and auxiliary thread of the current instance.

    Return type: record

  • get_local_rel_iostat()

    Description: Queries the accumulated I/O status of data files on the current node.

    Return type: record

  • DBE_PERF.get_global_rel_iostat()

    Description: Displays statistics about data file I/Os on all nodes. To query this function, you must have the sysadmin permission.

    Return type: record

  • DBE_PERF.global_threadpool_status()

    Description: Displays the status of worker threads and sessions in thread pools on all nodes. For details about the columns returned by the function, see GLOBAL_THREADPOOL_STATUS.

    Return type: record

  • remote_bgwriter_stat()

    Description: Displays the information about pages flushed by the bgwriter threads of all instances in the database, number of pages in the candidate buffer chain, and buffer elimination information (except for the local node and not available on the DN).

    Return type: record

  • pv_os_run_info

    Description: Displays the running status of the current OS. For details about the columns, see GS_OS_RUN_INFO.

    Parameter: nan

    Return type: SETOF record

  • pv_session_stat

    Description: Collects session status information by session thread or AutoVacuum thread. For details about the columns, see GS_SESSION_STAT.

    Parameter: nan

    Return type: SETOF record

  • pv_session_time

    Description: Collects statistics on the running time of session threads and the time consumed in each execution phase. For details about the columns, see GS_SESSION_TIME.

    Parameter: nan

    Return type: SETOF record

  • pg_stat_get_db_temp_bytes

    Description: Collects statistics on the total amount of data written to temporary files through database query. All temporary files are counted, regardless of why the temporary file was created, and regardless of the log_temp_files setting.

    Parameter: oid

    Return type: bigint

  • pg_stat_get_db_temp_files

    Description: Queries the number of temporary files created in the database. All temporary files are counted, regardless of why the temporary file was created (for example, sorting or hashing), and regardless of the log_temp_files setting.

    Parameter: oid

    Return type: bigint

  • remote_candidate_stat()

    Description: Displays the checkpoint information and log flushing information about all instances in the database (except the current node). Centralized systems are not supported.

    Return type: record

  • dbe_perf.gs_stat_activity_timeout(int)

    Description: Obtains information about query jobs whose execution time exceeds the timeout threshold on the current node. The correct result can be returned only when the GUC parameter track_activities is set to on. The timeout threshold ranges from 0 to 2147483.

    Return type: SETOF record

    Name Type Description
    database name Name of the database to which a user session is connected
    pid bigint Backend thread ID
    sessionid bigint Session ID
    usesysid oid OID of the user logged in to the backend
    application_name text Name of the application connected to the backend
    query text Query that is being executed on the backend
    xact_start timestamptz Time when the current transaction is started
    query_start timestamptz Time when the current query starts
    query_id bigint Query statement ID
  • gs_wlm_user_resource_info(name text)

    Description: Queries a user's resource quota and resource usage. Common users can query only their own information. Administrators can query information about all users.

    Return type: record

  • create_wlm_instance_statistics_info

    Description: Saves the historical monitoring data of the current instance persistently.

    Parameter: nan

    Return type: integer

  • gs_session_memory

    Description: Collects statistics about memory usage at the session level in the unit of MB, including all the memory allocated to Postgres and Stream threads on DNs for tasks currently executed by users.

    img NOTE: If enable_memory_limit is set to off, this function cannot be used.

    Return type: record

    Table 8 Return value description

    Name Type Description
    sessid text Thread start time and ID
    init_mem integer Memory allocated to the currently executed jobs before they enter the executor, in MB
    used_mem integer Memory allocated to the currently executed jobs, in MB
    peak_mem integer Peak memory allocated to the currently executed jobs, in MB
  • gs_wlm_persistent_user_resource_info()

    Description: Archives all user resource usage statistics to the gs_wlm_user_resource_history system catalog. To query this function, you must have the sysadmin permission.

    Return type: record

  • create_wlm_operator_info(int flag)

    Description: Clears top SQL operator-level statistics recorded in the current memory. If the input parameter is greater than 0, the information is archived to gs_wlm_operator_info and gs_wlm_ec_operator_info. Otherwise, the information is not archived. Only users with the sysadmin permission can execute this function.

    Return type: int

  • GS_ALL_NODEGROUP_CONTROL_GROUP_INFO(text)

    Description: Provides Cgroup information for all logical database instances. Before calling this function, you need to specify the name of the logical database instance to be queried. For example, to query the Cgroup information for the installation logical database instance, run the following command:

    SELECT * FROM GS_ALL_NODEGROUP_CONTROL_GROUP_INFO('installation')

    Return type: record

    The following table describes return columns.

    Name Type Description
    name text Cgroup name.
    type text Cgroup type.
    gid bigint Cgroup ID.
    classgid bigint ID of the Class cgroup where a Workload cgroup belongs.
    class text Class cgroup.
    workload text Workload cgroup.
    shares bigint CPU quota allocated to the cgroup.
    limits bigint Limit of CPUs allocated to a cgroup.
    wdlevel bigint Workload cgroup level.
    cpucores text Usage of CPU cores in a cgroup.
  • gs_total_nodegroup_memory_detail

    Description: Returns information about the memory used by the current logical database, in MB.

    Return type: SETOF record

  • local_redo_time_count()

    Description: Returns the time consumption statistics on each process of each playback thread on the current node (valid data exists only on the standby node).

    The return values are as follows:

    local_redo_time_count parameters

    Column Description
    thread_name Thread name
    step1_total Total duration of step 1. The process of each thread is as follows:
    Ultimate RTO
    - batch redo: obtains a log from a queue.
    - redo manager: obtains a log from a queue.
    - redo worker: obtains a log from a queue.
    - trxn manager: reads a log from a queue.
    - trxn worker: reads a log from a queue.
    - read worker: reads an Xlog page (overall) from a file.
    - read page worker: obtains a log from a queue.
    - startup: obtains a log from a queue.
    Parallel replay:
    - page redo: obtains a log from a queue.
    - startup: reads a log.
    step1_count Number of accumulated execution times of step 1.
    step2_total Total duration of step 2. The process of each thread is as follows:
    Ultimate RTO
    - batch redo: processes logs (overall).
    - redo manager: processes logs (overall).
    - redo worker: processes logs (overall).
    - trxn manager: processes logs (overall).
    - trxn worker: processes logs (overall).
    - redo worker: specifies the time required for reading the Xlog page.
    - read page worker: generates and sends LSN forwarders.
    - startup: checks whether to replay to the specified position.
    Parallel replay:
    - page redo: processes logs (overall).
    - startup: checks whether to replay to the specified position.
    step2_count Number of accumulated execution times of step 2.
    step3_total Total duration of step 3. The process of each thread is as follows:
    Ultimate RTO
    - batch redo: updates the standby state.
    - redo manager: processes data logs.
    - redo worker: replays page logs (overall).
    - trxn manager: updates the flush LSN.
    - trxn worker: replays logs.
    - redo worker: pushes the Xlog segment.
    - read page worker: obtains a new item.
    - startup: collects statistics on the wait time of delayed replay feature.
    Parallel replay:
    - page redo: updates the standby state.
    - startup: collects statistics on the wait time of delayed replay feature.
    step3_count Number of accumulated execution times of step 3.
    step4_total Total duration of step 4. The process of each thread is as follows:
    Ultimate RTO:
    - batch redo: parses Xlogs.
    - redo manager: processes DDL.
    - redo worker: reads data pages.
    - trxn manager: synchronizes the wait time.
    - trxn worker: updates the LSN of the current thread.
    - read page worker: stores logs in the distribution thread.
    - startup: distributes logs (overall).
    Parallel replay:
    - page redo: replays undo logs.
    - startup: distributes logs (overall).
    step4_count Number of accumulated execution times of step 4.
    step5_total Total duration of step 5. The process of each thread is as follows:
    Ultimate RTO:
    - batch redo: distributes logs to the redo manager.
    - redo manager: distributes logs to redo workers.
    - redo worker: replays data page logs.
    - trxn manager: distributes data to the trxn worker.
    - trxn worker: forcibly synchronizes the wait time.
    - read page worker: updates the LSN of the current thread.
    - startup: decodes logs.
    Parallel replay:
    - page redo: replays sharetrxn logs.
    - startup: replays logs.
    step5_count Number of accumulated execution times of step 5.
    step6_total Total duration of step 6. The process of each thread is as follows:
    Ultimate RTO:
    - redo worker: replays non-data page logs.
    - trxn manager: updates global LSNs.
    - read page worker: performs log CRC check.
    Parallel replay:
    - page redo: replays synctrxn logs.
    - startup: forcibly synchronizes the wait time.
    step6_count Number of accumulated execution times of step 6.
    step7_total Total duration of step 7. The process of each thread is as follows:
    Ultimate RTO:
    - redo worker: updates FSM.
    Parallel replay:
    - page redo: replays a single log.
    step7_count Number of accumulated execution times of step 7.
    step8_total Total duration of step 8. The process of each thread is as follows:
    Ultimate RTO:
    - redo worker: forcibly synchronizes the wait time.
    Parallel replay:
    - page redo: replays all workers do log.
    step8_count Number of accumulated execution times of step 8.
    step9_total Total duration of step 9. The process of each thread is as follows:
    Ultimate RTO:
    - None
    Parallel replay:
    - page redo: replays muliti workers do log.
    step9_count Number of accumulated execution times of step 9.
  • local_xlog_redo_statics()

    Description: Returns the statistics oneach type of logs that have been replayed on the current node (valid data exists only on the standby node).

    The return values are as follows:

    Table 9 local_xlog_redo_statics parameters

    Column Description
    xlog_type Log types.
    rmid resource manager id
    info xlog operation
    num Number of logs.
    extra Valid values are available for page replay logs and xact logs. The page replay log indicates the number of pages read from the disk. The xact log indicates the number of deleted files.
  • gs_get_shared_memctx_detail(text)

    Description: Returns the memory application details of the specified memory context, including the file, line number, and size of each memory application (the size of the same line in the same file is accumulated). Only the memory context queried through the pg_shared_memory_detail view can be queried. The input parameter is the memory context name (that is, the contextname column in the result returned by the pg_shared_memory_detail view). To query the function, you must have the SYSADMIN or MONITOR ADMIN permission.

    Return type: SETOF record

    Name Type Description
    file text Name of the file where the memory is applied for.
    line int8 Line number of the code in the file where the requested memory is located.
    size int8 Size of the applied memory. The value is accumulated if the memory is applied for multiple times in the same line of the same file.

    img NOTE: This view is not supported in the Lite release version.

  • gs_get_session_memctx_detail(text)

    Description: Returns the memory application details of the specified memory context, including the file, line number, and size of each memory application (the size of the same line in the same file is accumulated). This parameter is valid only in thread pool mode. Only the memory context queried through the pv_session_memory_context view can be queried. The input parameter is the memory context name (that is, the contextname column in the result returned by the pv_session_memory_context view). To query the function, you must have the sysadmin or monitor admin permission.

    Return type: SETOF record

    Name Type Description
    file text Name of the file where the memory is applied for.
    line int8 Line number of the code in the file where the requested memory is located.
    size int8 Size of the applied memory. The value is accumulated if the memory is applied for multiple times in the same line of the same file.

    img NOTE: This view takes effect only in thread pool mode and is not supported in the Lite release version.

  • gs_get_thread_memctx_detail(tid,text)

    Description: Returns the memory application details of the specified memory context, including the file, line number, and size of each memory application (the size of the same line in the same file is accumulated). Only the memory context queried through the pv_thread_memory_context view can be queried. The first input parameter is the thread ID (the tid column of the data returned by the pv_thread_memory_context), and the second parameter is the memory context name (the contextname column of the data returned by pv_thread_memory_context). To query the function, you must have the sysadmin or monitor admin permission.

    Return type: SETOF record

    Name Type Description
    file text Name of the file where the memory is applied for.
    line int8 Line number of the code in the file where the requested memory is located.
    size int8 Size of the applied memory. The value is accumulated if the memory is applied for multiple times in the same line of the same file.

    img NOTE: This view is not supported in the Lite release version.

  • DBE_PERF.standby_statement_history(bool [, time1, time2])

    Parameters:

    • bool only_slow: determines whether to query only slow SQL statements. The value true indicates yes, and the value false or NULL indicates that all SQL statements are queried.
    • VARIADIC timestamptz finish_time: Optional. You can enter a maximum of time1 and time2, indicating the time segment to which finish_time of the queried SQL statement belongs.

    Description: Queries full SQL statements on the standby node. The primary node queries full SQL statements using the statement_history table, while the standby node queries using this function. Only the initial user or a user with the monadmin permission can execute this function.

    Return type: record, which is the same as that in the statement_history table.

    img NOTE:

    • The value true of the first bool parameter indicates that only slow SQL statements are queried, which is equivalent to select. where is_slow_sql = true;. The value false or NULL indicates that all SQL statements are queried, that is, is_slow_sql is not filtered.

    • The two time parameters time1 and time2 indicate the time segment to which finish_time of the queried SQL statement belongs. They indicate the start time and end time respectively. If NULL or no value is entered, there is no limit. The function of time1 and time2 is the same as that of select .. where finish_time between time1 and time2.

    • Data on the standby node is not stored in the table, and the index of the start_time column does not exist. You are advised to use parameters to search for finish_time. The performance is optimized internally. However, if the system time is changed, this function may be inaccurate.

    • The query results are automatically sorted in descending order (from new to old) based on finish_time.

    • In addition to the calculation process of the FunctionScan operator, data scanning occupies 16 MB or 32 MB memory as a temporary buffer.

    • The stability level of this function is 'v'.

    • Full SQL statements on the standby node are written to disks asynchronously. Therefore, the storage of user SQL information may be delayed. You are advised to query this API to expand the query time range.

Copyright © 2011-2024 www.enmotech.com All rights reserved.