-
Notifications
You must be signed in to change notification settings - Fork 667
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the new columns last_seq_scan and last_idx_scan from the pg_sta…
…t_all_tables and pg_stat_all_indexes tables respectively to the Statistics tab. #6728
- Loading branch information
1 parent
c90508c
commit 475e368
Showing
8 changed files
with
221 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ notes for it. | |
:maxdepth: 1 | ||
|
||
|
||
release_notes_8_6 | ||
release_notes_8_5 | ||
release_notes_8_4 | ||
release_notes_8_3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
*********** | ||
Version 8.6 | ||
*********** | ||
|
||
Release date: 2024-05-02 | ||
|
||
This release contains a number of bug fixes and new features since the release of pgAdmin 4 v8.5. | ||
|
||
Supported Database Servers | ||
************************** | ||
**PostgreSQL**: 12, 13, 14, 15, and 16 | ||
|
||
**EDB Advanced Server**: 12, 13, 14, 15, and 16 | ||
|
||
Bundled PostgreSQL Utilities | ||
**************************** | ||
**psql**, **pg_dump**, **pg_dumpall**, **pg_restore**: 16.1 | ||
|
||
|
||
New features | ||
************ | ||
|
||
| `Issue #6728 <https://github.com/pgadmin-org/pgadmin4/issues/6728>`_ - Added the new columns "last_seq_scan" and "last_idx_scan" from the pg_stat_all_tables and pg_stat_all_indexes tables respectively to the Statistics tab. | ||
Housekeeping | ||
************ | ||
|
||
|
||
Bug fixes | ||
********* | ||
|
29 changes: 29 additions & 0 deletions
29
...ups/servers/databases/schemas/tables/templates/exclusion_constraint/sql/16_plus/stats.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
SELECT | ||
idx_scan AS {{ conn|qtIdent(_('Index scans')) }}, | ||
idx_tup_read AS {{ conn|qtIdent(_('Index tuples read')) }}, | ||
idx_tup_fetch AS {{ conn|qtIdent(_('Index tuples fetched')) }}, | ||
idx_blks_read AS {{ conn|qtIdent(_('Index blocks read')) }}, | ||
idx_blks_hit AS {{ conn|qtIdent(_('Index blocks hit')) }}, | ||
pg_catalog.pg_relation_size({{ exid }}::OID) AS {{ conn|qtIdent(_('Index size')) }}, | ||
last_idx_scan AS {{ conn|qtIdent(_('Last index scan')) }} | ||
{#=== Extended stats ===#} | ||
{% if is_pgstattuple %} | ||
,version AS {{ conn|qtIdent(_('Version')) }}, | ||
tree_level AS {{ conn|qtIdent(_('Tree level')) }}, | ||
index_size AS {{ conn|qtIdent(_('Index size')) }}, | ||
root_block_no AS {{ conn|qtIdent(_('Root block no')) }}, | ||
internal_pages AS {{ conn|qtIdent(_('Internal pages')) }}, | ||
leaf_pages AS {{ conn|qtIdent(_('Leaf pages')) }}, | ||
empty_pages AS {{ conn|qtIdent(_('Empty pages')) }}, | ||
deleted_pages AS {{ conn|qtIdent(_('Deleted pages')) }}, | ||
avg_leaf_density AS {{ conn|qtIdent(_('Average leaf density')) }}, | ||
leaf_fragmentation AS {{ conn|qtIdent(_('Leaf fragmentation')) }} | ||
FROM | ||
pgstatindex('{{conn|qtIdent(schema)}}.{{conn|qtIdent(name)}}'), pg_catalog.pg_stat_all_indexes stat | ||
{% else %} | ||
FROM | ||
pg_catalog.pg_stat_all_indexes stat | ||
{% endif %} | ||
JOIN pg_catalog.pg_statio_all_indexes statio ON stat.indexrelid = statio.indexrelid | ||
JOIN pg_catalog.pg_class cl ON cl.oid=stat.indexrelid | ||
WHERE stat.indexrelid = {{ exid }}::OID |
29 changes: 29 additions & 0 deletions
29
..._groups/servers/databases/schemas/tables/templates/index_constraint/sql/16_plus/stats.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
SELECT | ||
idx_scan AS {{ conn|qtIdent(_('Index scans')) }}, | ||
idx_tup_read AS {{ conn|qtIdent(_('Index tuples read')) }}, | ||
idx_tup_fetch AS {{ conn|qtIdent(_('Index tuples fetched')) }}, | ||
idx_blks_read AS {{ conn|qtIdent(_('Index blocks read')) }}, | ||
idx_blks_hit AS {{ conn|qtIdent(_('Index blocks hit')) }}, | ||
pg_catalog.pg_relation_size({{ cid }}::OID) AS {{ conn|qtIdent(_('Index size')) }}, | ||
last_idx_scan AS {{ conn|qtIdent(_('Last index scan')) }} | ||
{#=== Extended stats ===#} | ||
{% if is_pgstattuple %} | ||
,version AS {{ conn|qtIdent(_('Version')) }}, | ||
tree_level AS {{ conn|qtIdent(_('Tree level')) }}, | ||
index_size AS {{ conn|qtIdent(_('Index size')) }}, | ||
root_block_no AS {{ conn|qtIdent(_('Root block no')) }}, | ||
internal_pages AS {{ conn|qtIdent(_('Internal pages')) }}, | ||
leaf_pages AS {{ conn|qtIdent(_('Leaf pages')) }}, | ||
empty_pages AS {{ conn|qtIdent(_('Empty pages')) }}, | ||
deleted_pages AS {{ conn|qtIdent(_('Deleted pages')) }}, | ||
avg_leaf_density AS {{ conn|qtIdent(_('Average leaf density')) }}, | ||
leaf_fragmentation AS {{ conn|qtIdent(_('Leaf fragmentation')) }} | ||
FROM | ||
pgstatindex('{{conn|qtIdent(schema)}}.{{conn|qtIdent(name)}}'), pg_catalog.pg_stat_all_indexes stat | ||
{% else %} | ||
FROM | ||
pg_catalog.pg_stat_all_indexes stat | ||
{% endif %} | ||
JOIN pg_catalog.pg_statio_all_indexes statio ON stat.indexrelid = statio.indexrelid | ||
JOIN pg_catalog.pg_class cl ON cl.oid=stat.indexrelid | ||
WHERE stat.indexrelid = {{ cid }}::OID |
18 changes: 18 additions & 0 deletions
18
...rver_groups/servers/databases/schemas/tables/templates/indexes/sql/16_plus/coll_stats.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
SELECT | ||
indexrelname AS {{ conn|qtIdent(_('Index name')) }}, | ||
pg_catalog.pg_relation_size(indexrelid) AS {{ conn|qtIdent(_('Size')) }}, | ||
idx_scan AS {{ conn|qtIdent(_('Index scans')) }}, | ||
idx_tup_read AS {{ conn|qtIdent(_('Index tuples read')) }}, | ||
idx_tup_fetch AS {{ conn|qtIdent(_('Index tuples fetched')) }}, | ||
last_idx_scan AS {{ conn|qtIdent(_('Last index scan')) }} | ||
FROM | ||
pg_catalog.pg_stat_all_indexes stat | ||
JOIN pg_catalog.pg_class cls ON cls.oid=indexrelid | ||
LEFT JOIN pg_catalog.pg_depend dep ON (dep.classid = cls.tableoid AND dep.objid = cls.oid AND dep.refobjsubid = '0' | ||
AND dep.refclassid=(SELECT oid FROM pg_catalog.pg_class WHERE relname='pg_constraint')) | ||
LEFT OUTER JOIN pg_catalog.pg_constraint con ON (con.tableoid = dep.refclassid AND con.oid = dep.refobjid) | ||
WHERE | ||
schemaname = '{{schema}}' | ||
AND stat.relname = '{{table}}' | ||
AND con.contype IS NULL | ||
ORDER BY indexrelname; |
29 changes: 29 additions & 0 deletions
29
...er/server_groups/servers/databases/schemas/tables/templates/indexes/sql/16_plus/stats.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
SELECT | ||
idx_scan AS {{ conn|qtIdent(_('Index scans')) }}, | ||
idx_tup_read AS {{ conn|qtIdent(_('Index tuples read')) }}, | ||
idx_tup_fetch AS {{ conn|qtIdent(_('Index tuples fetched')) }}, | ||
idx_blks_read AS {{ conn|qtIdent(_('Index blocks read')) }}, | ||
idx_blks_hit AS {{ conn|qtIdent(_('Index blocks hit')) }}, | ||
pg_catalog.pg_relation_size({{ idx }}::OID) AS {{ conn|qtIdent(_('Index size')) }}, | ||
last_idx_scan AS {{ conn|qtIdent(_('Last index scan')) }} | ||
{#=== Extended stats ===#} | ||
{% if is_pgstattuple %} | ||
,version AS {{ conn|qtIdent(_('Version')) }}, | ||
tree_level AS {{ conn|qtIdent(_('Tree level')) }}, | ||
index_size AS {{ conn|qtIdent(_('Index size')) }}, | ||
root_block_no AS {{ conn|qtIdent(_('Root block no')) }}, | ||
internal_pages AS {{ conn|qtIdent(_('Internal pages')) }}, | ||
leaf_pages AS {{ conn|qtIdent(_('Leaf pages')) }}, | ||
empty_pages AS {{ conn|qtIdent(_('Empty pages')) }}, | ||
deleted_pages AS {{ conn|qtIdent(_('Deleted pages')) }}, | ||
avg_leaf_density AS {{ conn|qtIdent(_('Average leaf density')) }}, | ||
leaf_fragmentation AS {{ conn|qtIdent(_('Leaf fragmentation')) }} | ||
FROM | ||
pgstatindex('{{conn|qtIdent(schema)}}.{{conn|qtIdent(index)}}'), pg_catalog.pg_stat_all_indexes stat | ||
{% else %} | ||
FROM | ||
pg_catalog.pg_stat_all_indexes stat | ||
{% endif %} | ||
JOIN pg_catalog.pg_statio_all_indexes statio ON stat.indexrelid = statio.indexrelid | ||
JOIN pg_catalog.pg_class cl ON cl.oid=stat.indexrelid | ||
WHERE stat.indexrelid = {{ idx }}::OID |
30 changes: 30 additions & 0 deletions
30
...groups/servers/databases/schemas/tables/templates/tables/sql/16_plus/coll_table_stats.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
SELECT | ||
st.relname AS {{ conn|qtIdent(_('Table name')) }}, | ||
pg_catalog.pg_relation_size(st.relid) | ||
+ CASE WHEN cl.reltoastrelid = 0 THEN 0 ELSE pg_catalog.pg_relation_size(cl.reltoastrelid) | ||
+ COALESCE((SELECT SUM(pg_catalog.pg_relation_size(indexrelid)) | ||
FROM pg_catalog.pg_index WHERE indrelid=cl.reltoastrelid)::int8, 0) END | ||
+ COALESCE((SELECT SUM(pg_catalog.pg_relation_size(indexrelid)) | ||
FROM pg_catalog.pg_index WHERE indrelid=st.relid)::int8, 0) AS {{ conn|qtIdent(_('Total Size')) }}, | ||
n_tup_ins AS {{ conn|qtIdent(_('Tuples inserted')) }}, | ||
n_tup_upd AS {{ conn|qtIdent(_('Tuples updated')) }}, | ||
n_tup_del AS {{ conn|qtIdent(_('Tuples deleted')) }}, | ||
n_tup_hot_upd AS {{ conn|qtIdent(_('Tuples HOT updated')) }}, | ||
n_live_tup AS {{ conn|qtIdent(_('Live tuples')) }}, | ||
n_dead_tup AS {{ conn|qtIdent(_('Dead tuples')) }}, | ||
last_vacuum AS {{ conn|qtIdent(_('Last vacuum')) }}, | ||
last_autovacuum AS {{ conn|qtIdent(_('Last autovacuum')) }}, | ||
last_analyze AS {{ conn|qtIdent(_('Last analyze')) }}, | ||
last_autoanalyze AS {{ conn|qtIdent(_('Last autoanalyze')) }}, | ||
last_seq_scan AS {{ conn|qtIdent(_('Last sequential scan')) }}, | ||
vacuum_count AS {{ conn|qtIdent(_('Vacuum counter')) }}, | ||
autovacuum_count AS {{ conn|qtIdent(_('Autovacuum counter')) }}, | ||
analyze_count AS {{ conn|qtIdent(_('Analyze counter')) }}, | ||
autoanalyze_count AS {{ conn|qtIdent(_('Autoanalyze counter')) }} | ||
FROM | ||
pg_catalog.pg_stat_all_tables st | ||
JOIN | ||
pg_catalog.pg_class cl on cl.oid=st.relid and cl.relkind IN ('r','s','t','p') | ||
WHERE | ||
schemaname = {{schema_name|qtLiteral(conn)}} | ||
ORDER BY st.relname; |
54 changes: 54 additions & 0 deletions
54
...ser/server_groups/servers/databases/schemas/tables/templates/tables/sql/16_plus/stats.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
SELECT | ||
seq_scan AS {{ conn|qtIdent(_('Sequential scans')) }}, | ||
seq_tup_read AS {{ conn|qtIdent(_('Sequential tuples read')) }}, | ||
idx_scan AS {{ conn|qtIdent(_('Index scans')) }}, | ||
idx_tup_fetch AS {{ conn|qtIdent(_('Index tuples fetched')) }}, | ||
n_tup_ins AS {{ conn|qtIdent(_('Tuples inserted')) }}, | ||
n_tup_upd AS {{ conn|qtIdent(_('Tuples updated')) }}, | ||
n_tup_del AS {{ conn|qtIdent(_('Tuples deleted')) }}, | ||
n_tup_hot_upd AS {{ conn|qtIdent(_('Tuples HOT updated')) }}, | ||
n_live_tup AS {{ conn|qtIdent(_('Live tuples')) }}, | ||
n_dead_tup AS {{ conn|qtIdent(_('Dead tuples')) }}, | ||
heap_blks_read AS {{ conn|qtIdent(_('Heap blocks read')) }}, | ||
heap_blks_hit AS {{ conn|qtIdent(_('Heap blocks hit')) }}, | ||
idx_blks_read AS {{ conn|qtIdent(_('Index blocks read')) }}, | ||
idx_blks_hit AS {{ conn|qtIdent(_('Index blocks hit')) }}, | ||
toast_blks_read AS {{ conn|qtIdent(_('Toast blocks read')) }}, | ||
toast_blks_hit AS {{ conn|qtIdent(_('Toast blocks hit')) }}, | ||
tidx_blks_read AS {{ conn|qtIdent(_('Toast index blocks read')) }}, | ||
tidx_blks_hit AS {{ conn|qtIdent(_('Toast index blocks hit')) }}, | ||
last_vacuum AS {{ conn|qtIdent(_('Last vacuum')) }}, | ||
last_autovacuum AS {{ conn|qtIdent(_('Last autovacuum')) }}, | ||
last_analyze AS {{ conn|qtIdent(_('Last analyze')) }}, | ||
last_autoanalyze AS {{ conn|qtIdent(_('Last autoanalyze')) }}, | ||
last_seq_scan AS {{ conn|qtIdent(_('Last sequential scan')) }}, | ||
pg_catalog.pg_relation_size(stat.relid) AS {{ conn|qtIdent(_('Table size')) }}, | ||
CASE WHEN cl.reltoastrelid = 0 THEN NULL ELSE pg_catalog.pg_size_pretty(pg_catalog.pg_relation_size(cl.reltoastrelid) | ||
+ COALESCE((SELECT SUM(pg_catalog.pg_relation_size(indexrelid)) | ||
FROM pg_catalog.pg_index WHERE indrelid=cl.reltoastrelid)::int8, 0)) | ||
END AS {{ conn|qtIdent(_('Toast table size')) }}, | ||
COALESCE((SELECT SUM(pg_catalog.pg_relation_size(indexrelid)) | ||
FROM pg_catalog.pg_index WHERE indrelid=stat.relid)::int8, 0) | ||
AS {{ conn|qtIdent(_('Indexes size')) }} | ||
{% if is_pgstattuple %} | ||
{#== EXTENDED STATS ==#} | ||
,tuple_count AS {{ conn|qtIdent(_('Tuple count')) }}, | ||
tuple_len AS {{ conn|qtIdent(_('Tuple length')) }}, | ||
tuple_percent AS {{ conn|qtIdent(_('Tuple percent')) }}, | ||
dead_tuple_count AS {{ conn|qtIdent(_('Dead tuple count')) }}, | ||
dead_tuple_len AS {{ conn|qtIdent(_('Dead tuple length')) }}, | ||
dead_tuple_percent AS {{ conn|qtIdent(_('Dead tuple percent')) }}, | ||
free_space AS {{ conn|qtIdent(_('Free space')) }}, | ||
free_percent AS {{ conn|qtIdent(_('Free percent')) }} | ||
FROM | ||
pgstattuple('{{schema_name}}.{{table_name}}'), pg_catalog.pg_stat_all_tables stat | ||
{% else %} | ||
FROM | ||
pg_catalog.pg_stat_all_tables stat | ||
{% endif %} | ||
JOIN | ||
pg_catalog.pg_statio_all_tables statio ON stat.relid = statio.relid | ||
JOIN | ||
pg_catalog.pg_class cl ON cl.oid=stat.relid | ||
WHERE | ||
stat.relid = {{ tid }}::oid |