Difference between revisions of "Pg stat user tables"
Jump to navigation
Jump to search
(12 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {{lowercase}} | |
− | SELECT | + | SELECT |
− | + | relname, | |
− | + | 100 * idx_scan / (seq_scan + idx_scan) percent_of_times_index_used, | |
− | + | n_live_tup rows_in_table | |
− | FROM | + | FROM |
− | + | [[pg_stat]]_user_tables | |
− | WHERE | + | WHERE |
− | + | seq_scan + idx_scan > 0 | |
− | ORDER BY | + | ORDER BY |
− | + | n_live_tup DESC; | |
</pre> | </pre> | ||
− | [[pg_statio_user_tables]] | + | |
+ | == [[PostgreSQL VACUUM]] == | ||
+ | SELECT | ||
+ | schemaname, relname, | ||
+ | last_vacuum, last_autovacuum, | ||
+ | vacuum_count, autovacuum_count | ||
+ | FROM pg_stat_user_tables; | ||
+ | |||
+ | |||
+ | == Related terms == | ||
+ | * <code>[[pg_statio_user_tables]]</code> | ||
+ | * [[Cache hit ratio]]: <code>[[pg_statio_user_tables]]</code> | ||
+ | * [[VACUUM FULL]] | ||
== See also == | == See also == | ||
+ | * {{pg_stat}} | ||
+ | * {{VACUUM}} | ||
* {{SQL}} | * {{SQL}} | ||
* {{PostgreSQL}} | * {{PostgreSQL}} | ||
+ | |||
+ | |||
+ | [[Category:PostgreSQL]] |
Latest revision as of 13:37, 14 April 2022
SELECT relname, 100 * idx_scan / (seq_scan + idx_scan) percent_of_times_index_used, n_live_tup rows_in_table FROM pg_stat_user_tables WHERE seq_scan + idx_scan > 0 ORDER BY n_live_tup DESC;
PostgreSQL VACUUM[edit]
SELECT schemaname, relname, last_vacuum, last_autovacuum, vacuum_count, autovacuum_count FROM pg_stat_user_tables;
Related terms[edit]
See also[edit]
pg_stat, pg_stat_activity, pg_stat_statements, pg_stat_replication, pg_stat_io
- VACUUM: PostgreSQL VACUUM, Autovacuum,
pg_database, pg_stat_activity
, Redshift VACUUM - SQL, NewSQL, RDMS: GraphQL (2015), SQLite,
select, insert
,select count
, Distributed SQL, TablePlus, Cache hit ratio,pg_stat_user_tables
,EXPLAIN
, Index (PostgreSQL), DDL, SQL/MED, Group by, List users, SQL Injection, SQLAlchemy,CREATE USER, CREATE ROLE, EXPLAIN, ALTER DATABASE, REVOKE, NOLOCK, NOWAIT, EXISTS
, Unique constraint,.sql
- PostgreSQL:
pg_dump, pg_restore
,pgAdmin, pg_config, psql, pg_ctl, pg_isready, initdb
, Role, Schema, DBeaver, Navicat, DataGrip, OmniDB,Adminer
, docker-compose.xml PostgreSQL, PostgreSQL version, PostgreSQL logs,postgresql.conf
,pg_hba.conf, $HOME/.pg_service.conf
, Create database (PostgreSQL), Create user,createdb
,GRANT
,pg_stat
, PostgreSQL VACUUM, EXPLAIN,pg stat activity
, Autovacuum, ALTER DATABASE, PostgreSQL statistics collector, Shared buffers, EXPLAIN (PostgreSQL),EXPLAIN ANALYZE
, Bitmap scan,EXPLAIN VERBOSE
,EXPLAIN VERBOSE (PostgresSQL)
,WAL
,ALTER USER
,CREATE ROLE, CREATE USER
,\du
,show users
,\l
, The Statistics Collector, pganalyze,cron.schedule
, Master,pg_tables
, PostgreSQL replication,CREATE, SET
, TOAST, PgBouncer, Restore DB, Index, meta-commands, Table, foreign table, Schema, Sequence, Views, materialized view, Table Partitioning, monitoring, PostgreSQL System Administration Functions, PostgreSQL extension, privileges, logging, PGTune, PostgreSQL parameter tunning, PostgreSQL modules, pgbench, PostgreSQL users, catalogs
Advertising: