Help Center > > Developer Guide> SQL Reference> Functions and Operators> Other Functions

Other Functions

Updated at: Jul 15, 2020 GMT+08:00
  • pgxc_pool_check()

    Description: Checks whether the connection data buffered in the pool is consistent with pgxc_node.

    Return type: Boolean

  • pgxc_pool_reload()

    Description: Updates the connection information buffered in the pool.

    Return type: Boolean

  • pgxc_lock_for_backup()

    Description: Locks the cluster before backup. Backup is performed to restore data on new nodes.

    Return type: Boolean

    pgxc_lock_for_backup locks a cluster before gs_dump or gs_dumpall is used to back up the cluster. After a cluster is locked, operations changing the system structure are not allowed. This function does not affect DML statements.

  • pg_pool_validate(clear boolean, co_node_name cstring)

    Description: Clears invalid backend threads on a CN. (These backend threads hold invalid pooler connections to standby DNs.)

    Return type: record

  • pg_nodes_memory()

    Description: Queries for the memory usage of all nodes.

    Return type: record

  • table_skewness(text)

    Description: Queries for the percentage of table data among all nodes.

    Parameter: Indicates that the type of the name of the to-be-queried table is text.

    Return type: record

  • table_distribution(schemaname text, tablename text)

    Description: Queries for the storage space occupied by a specified table on each node.

    Parameter: Indicates that the types of the schema name and table name for the table to be queried are both text.

    Return type: record

    • To query for the storage distribution of a specified table by using this function, you must have the SELECT permission for the table.
    • The performance of table_distribution is better than that of table_skewness. Especially in a large cluster with a large amount of data, table_distribution is recommended.
    • When you use table_distribution and want to view the space usage, you can use dnsize or (sum(dnsize) over ()) to view the percentage.
  • table_distribution()

    Description: Queries for the storage distribution of all tables in the current database.

    Return type: record

    • This function involves the query for information about all tables in the database. To execute this function, you must have the administrator rights.
    • Based on the table_distribution() function, DWS provides the PGXC_GET_TABLE_SKEWNESS view as an alternative way to query for data skew. You are advised to use this view when the number of tables in the database is less than 10000.
  • plan_seed

    Description: Obtains the seed value of the previous query statement (internal use).

    Return type: int

  • pg_stat_get_env

    Description: Obtains the environment variable information about the current node.

    Return type: record

  • pg_stat_get_thread

    Description: Provides information about the status of all threads under the current node.

    Return type: record

  • pgxc_get_os_threads

    Description: Provides information about the status of threads under all normal nodes in a cluster.

    Return type: record

  • pg_stat_get_sql_count

    Description: Provides statistics on the number of SELECT/UPDATE/INSERT/DELETE/MERGE INTO statements executed by all users on the current node, response time, and the number of DDL, DML, and DCL statements.

    Return type: record

  • pgxc_get_sql_count

    Description: Provides statistics on the number of SELECT/UPDATE/INSERT/DELETE/MERGE INTO statements executed by all users on all nodes of the current cluster, response time, and the number of DDL, DML, and DCL statements.

    Return type: record

  • pgxc_get_workload_sql_count

    Description: Provides statistics on the number of SELECT/UPDATE/INSERT/DELETE statements executed in all workload Cgroup on all CNs of the current cluster and the number of DDL, DML, and DCL statements.

    Return type: record

  • pgxc_get_workload_sql_elapse_time

    Description: Provides statistics on response time of SELECT/UPDATE/INSERT/DELETE statements executed in all workload Cgroup on all CNs of the current cluster.

    Return type: record

  • get_instr_unique_sql

    Description: Provides information about Unique SQL statistics collected on the current node. If the node is a CN, the system returns the complete information about the Unique SQL statistics collected on the CN. That is, the system collects and summarizes the information about the Unique SQL statistics on other CNs and DNs. If the node is a DN, the Unique SQL statistics on the DN is returned. For details, see GS_INSTR_UNIQUE_SQL.

    Return type: record

  • reset_instr_unique_sql(cstring, cstring, INT8)

    Description: Clears collected Unique SQL statistics. The input parameters are described as follows:

    • GLOBAL/LOCAL: Data is cleared from all nodes or the current node.
    • ALL/BY_USERID/BY_CNID/BY_GUC: ALL indicates that all data is cleared. BY_USERID/BY_CNID indicates that data is cleared by USERID or CNID. BY_GUC indicates that the clearance operation is caused by the decrease of the value of the GUC parameter instr_unique_sql_count.
    • The third parameter corresponds to the second parameter. The parameter is invalid for ALL/BY_GUC.

    Return type: bool

  • pgxc_get_instr_unique_sql

    Description: Provides complete information about Unique SQL statistics collected on all CNs in a cluster.

    Return type: record

  • pgxc_get_node_env

    Description: Provides the environment variable information about all nodes in a cluster.

    Return type: record

  • gs_switch_relfilenode

    Description: Exchanges meta information of two tables or partitions. (This is only used for the redistribution tool. An error message is displayed when the function is directly used by users).

    Return type: int

  • copy_error_log_create()

    Description: Creates the error table (public.pgxc_copy_error_log) required for creating the COPY FROM error tolerance mechanism.

    Return type: Boolean

    • This function attempts to create the public.pgxc_copy_error_log table. For details about the table, see Table 1.
    • Create the B-tree index on the relname column and execute REVOKE ALL on public.pgxc_copy_error_log FROM public to manage permissions for the error table (the permissions are the same as those of the COPY statement).
    • public.pgxc_copy_error_log is a row-store table. Therefore, this function can be executed and COPY FROM error tolerance is available only when row-store tables can be created in the cluster. Row-store tables cannot be created in the cluster if enable_hadoop_env is set to on ().
    • Same as the error table and the COPY statement, the function requires sysadmin or higher permissions.
    • If the public.pgxc_copy_error_log table or the copy_error_log_relname_idx index already exists before the function creates it, the function will report an error and roll back.
    Table 1 Error table public.pgxc_copy_error_log

    Column

    Type

    Description

    relname

    varchar

    Table name in the form of Schema name.Table name

    begintime

    timestamp with time zone

    Time when a data format error was reported

    filename

    character varying

    Name of the source data file where a data format error occurs

    rownum

    bigint

    Number of the row where a data format error occurs in a source data file

    rawrecord

    text

    Raw record of a data format error in the source data file To prevent a field from being too long, the length of the field cannot exceed 1024 bytes.

    detail

    text

    Error details

  • pv_compute_pool_workload()

    Description: Provides the current load information about computing Node Groups on cloud.

    Return type: record

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel