pt-stat-snapshot¶
Summary¶
Get a snapshot of statistical information, save, and manage.
Usage¶
pt-stat-snapshot [option...] install
pt-stat-snapshot [option...] uninstall
pt-stat-snapshot [option...] create [level]
pt-stat-snapshot [option...] list
pt-stat-snapshot [option...] delete [sid]
pt-stat-snapshot [option...] export [file]
pt-stat-snapshot [option...] import [file]
Commands¶
install |
Creates a schema and tables and functions of the package. |
uninstall |
Drops a schema and tables and functions of the package. |
create [level] |
Takes a snapshot of the database statistics. [level] can be 1 or 2 or 4 . |
list |
Shows a list of stored snapshots. |
delete [sid] |
Deletes a snapshot specified by snapshot id. Multiple snapshot ids can be specified by range as M:N . |
export [file] |
Exports all snapshot data into the specified file. |
import [file] |
Imports snapshot data from the specified file. |
Options¶
-h, --host=HOSTNAME
-p, --port=PORT
-U, --username=USERNAME
-d, --dbname=DBNAME
--help
-h
, --host
Specifies the connecting the PostgreSQL database server name or its IP address. or its IP address. If not specified, to set the value of PGHOST. localhost
will be used if no other value has been defined in PGHOST.
-p
, --port
Specifies the port number of the connecting PostgreSQL database. If not specified, to set the value of PGPORT. 5432
will be used if no value has been defined in PGPORT.
-U
, --username
Specifies the username of the PostgreSQL database. If not specified, to set the value of PGUSER. The value of USER will be used If no other value has been defined in PGUSER.
-d
, --dbname
Specifies the connecting database name. If not specified, to set the value of PGDATABASE. Database name as database username will be used if no other value has been defined in PGDATABASE.
Output Items¶
list
command shows following items.
SID |
Snapshot ID (Assigned to every snapshot. Monotonic increase.) |
TIMESTAMP |
Timestamp of the snapshot taken. |
LEVEL |
Snapshot level. |
Examples¶
It installs a schema, tables and functions of the package to testdb
database.
$ pt-stat-snapshot -h 127.0.0.1 -U postgres -d testdb install
[2015-03-31 17:21:37] INFO: Succeeded to install pgperf snapshot.
$
It takes a snapshot with the snapshot level 4.
$ pt-stat-snapshot -h 127.0.0.1 -U postgres -d testdb create 4
[2015-03-31 17:21:47] INFO: Succeeded to take a snapshot.
$
It shows a list of the snapshots.
$ pt-stat-snapshot -h 127.0.0.1 -U postgres -d testdb list
+-----+---------------------+-------+
| SID | TIMESTAMP | LEVEL |
+-----+---------------------+-------+
| 0 | 2015-03-31 17:21:47 | 1 |
+-----+---------------------+-------+
$
It uninstalls the schema, tables and functions of the package from testdb
database.
$ pt-stat-snapshot -h 127.0.0.1 -U postgres -d testdb uninstall
[2015-03-31 17:21:59] INFO: Succeeded to uninstall pgperf snapshot.
$
About pgperf-snapshot Module¶
pt-stat-snapshot
command depends on another module internally, previously known as the pgperf-snapshot.
For more details about the pgperf-snapshot module, please refer to the following documents.
- PgPerf Package Overview
- Introduction to PgPerf package
- Snapshot Functions
- Snapshot Tables
- Snapshot Table List
- pgperf.snapshot Table
- pgperf.snapshot_pg_stat_database Table
- pgperf.snapshot_pg_database_size Table
- pgperf.snapshot_pg_stat_user_tables Table
- pgperf.snapshot_pg_statio_user_tables Table
- pgperf.snapshot_pg_stat_user_indexes Table
- pgperf.snapshot_pg_statio_user_indexes Table
- pgperf.snapshot_pg_statio_user_sequences Table
- pgperf.snapshot_pg_stat_user_functions Table
- pgperf.snapshot_pg_relation_size Table
- pgperf.snapshot_pg_current_xlog Table
- pgperf.snapshot_pg_stat_bgwriter Table
- pgperf.snapshot_pg_stat_activity Table
- pgperf.snapshot_pg_locks Table
- pgperf.snapshot_pg_statistic Table
- pgperf.snapshot_pg_stat_statements Table
- pgperf.snapshot_pgstattuple Table
- pgperf.snapshot_pgstatindex Table