SQL
Updated at:
This topic describes the views available in PolarDB for PostgreSQL (Compatible with Oracle). You can query these views to obtain SQL information and identify performance issues.
SQL
You can query the views described in this topic to obtain SQL information.
- pg_stat_statementsNote The pg_stat_statements view depends on the
pg_stat_statementsextension. You must create this extension by running the create extension pg_stat_statements command.Parameter Type Description useridoid The OID of the user who executed the statement. dbidoid The OID of the database in which the statement was executed. queryidbigint The internal hash code calculated from the parse tree of the statement. querytext The text of the statement. callsbigint The number of times the statement was executed. total_timedouble precision The total time spent in the statement, in milliseconds. min_timedouble precision The minimum time spent in the statement, in milliseconds. max_timedouble precision The maximum time spent in the statement, in milliseconds. mean_timedouble precision The average time spent in the statement, in milliseconds. stddev_timedouble precision The population standard deviation of the time spent in the statement, in milliseconds. rowsbigint The total number of rows retrieved or affected by the statement. shared_blks_hitbigint The total number of shared block cache hits by the statement. shared_blks_readbigint The total number of shared blocks read by the statement. shared_blks_dirtiedbigint The total number of shared blocks dirtied by the statement. shared_blks_writtenbigint The total number of shared blocks written by the statement. local_blks_hitbigint The total number of local block cache hits by the statement. local_blks_readbigint The total number of local blocks read by the statement. local_blks_dirtiedbigint The total number of local blocks dirtied by the statement. local_blks_writtenbigint The total number of local blocks written by the statement. temp_blks_readbigint The total number of temporary blocks read by the statement. temp_blks_writtenbigint The total number of temporary blocks written by the statement. blk_read_timedouble precision The total time the statement spent reading blocks, in milliseconds. This value is 0 if track_io_timing is disabled. blk_write_timedouble precision The total time the statement spent writing blocks, in milliseconds. This value is 0 if track_io_timing is disabled. - polar_stat_sqlNote The `polar_stat_sql` view depends on the
polar_stat_sqlextension. You can submit a ticket to create this extension, which also serves as an extension topg_stat_statements.Parameter Type Description queryidbigint The query ID. datnamename The database name. rolnamename The username. user_timedouble The time spent in user mode. system_timedouble The time spent in system mode. minfltsbigint The number of page reclaims (soft page faults). majfltsbigint The number of page faults (hard page faults). nswapsbigint The number of swaps. readsbigint The number of bytes read from the disk. reads_blksbigint The number of blocks read from the disk. writesbigint The number of bytes written to the disk. writes_blksbigint The number of blocks written to the disk. msgsndsbigint The number of Inter-Process Communication (IPC) messages sent. msgrcvsbigint The number of IPC messages received. nsignalsbigint The number of semaphore acquisitions. nvcswsbigint The number of voluntary context switches. nivcswsbigint The number of involuntary context switches. scan_rowsdouble The number of rows read by the scan node. scan_timedouble The running time of the scan node. scan_countbigint The number of executions of the scan node. join_rowsdouble The number of rows read by the join node. join_timedouble The running time of the join node. join_countbigint The number of executions of the join node. sort_rowsdouble The number of rows read by the sort node. sort_timedouble The running time of the sort node. sort_countbigint The number of executions of the sort node. group_rowsdouble The number of rows read by the group node. group_timedouble The running time of the group node. group_countbigint The number of executions of the group node. hash_rowsdouble The number of rows read by the hash node. hash_memorybigint The memory used by the hash node, in bytes. hash_countbigint The number of executions of the hash node. parse_timedouble The parsing time. analyze_timedouble The analysis time. rewrite_timedouble The rewrite time. plan_timedouble The time to generate the execution plan. execute_timedouble The running time. lwlock_waitdouble The lwlock wait time. rel_lock_waitdouble The table lock wait time. xact_lock_waitdouble The transaction lock wait time. page_lock_waitdouble The page lock wait time. tuple_lock_waitdouble The row lock wait time. shared_read_ps bigint The read IOPS. shared_write_ps bigint The write IOPS. shared_read_throughput bigint The read throughput, in bytes. shared_write_throughput bigint The write throughput, in bytes. shared_read_latency double The read latency, in microseconds. shared_write_latency double The write latency, in microseconds. io_open_num bigint The number of file open operations. io_seek_count bigint The number of file seek operations. io_open_time double The time spent on file open operations, in microseconds. io_seek_time double The time spent on file seek operations, in microseconds. - polar_stat_query_countThe following table describes the parameters.Note The polar_stat_query_count view depends on the
polar_stat_sqlplugin. You can submit a ticket to create this plugin.Parameter Type Description sqltypetext SQL Type: DQLDMLDDLDCL cmdtypetext SQL command type: SELECTINSERTUPDATE, ... countbigint The total number of executions.
Is this page helpful?