Lists: | pgsql-bugspgsql-general |
---|
From: | 許耀彰 <kpm906(at)gmail(dot)com> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | postgresql table data control |
Date: | 2015-10-16 23:26:45 |
Message-ID: | CAD_D-c8K69YzYzG94DAknapsqTfFq7OREP2c5PpP--tb3Yn4ZQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs pgsql-general |
Dear Support Team,
How can we know each table data increase day by day? It mean how do we get
how many data produce today,included which data? Thank you.
From: | "Shulgin, Oleksandr" <oleksandr(dot)shulgin(at)zalando(dot)de> |
---|---|
To: | 許耀彰 <kpm906(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: [BUGS] postgresql table data control |
Date: | 2015-10-19 08:29:33 |
Message-ID: | CACACo5S8hhEPqH3YCkKXGVdqYrMUyyf-rArmftyT6Fs=NNUYHw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs pgsql-general |
On Sat, Oct 17, 2015 at 1:26 AM, 許耀彰 <kpm906(at)gmail(dot)com> wrote:
> Dear Support Team,
> How can we know each table data increase day by day? It mean how do we get
> how many data produce today,included which data? Thank you.
>
[moving from bugs(at)]
Please refer to these SQL-level functions:
pg_relation_size()
pg_total_relation_size()
pg_size_pretty()
http://www.postgresql.org/docs/current/static/functions-admin.html
From: | Scott Mead <scottm(at)openscg(dot)com> |
---|---|
To: | "Shulgin, Oleksandr" <oleksandr(dot)shulgin(at)zalando(dot)de> |
Cc: | 許耀彰 <kpm906(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: [BUGS] postgresql table data control |
Date: | 2015-10-19 22:26:35 |
Message-ID: | B5F8D346-60B8-4E6C-87B4-ACC06D15D993@openscg.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs Postg윈 토토SQL : |
> On Oct 19, 2015, at 04:29, Shulgin, Oleksandr <oleksandr(dot)shulgin(at)zalando(dot)de> wrote:
>
>> On Sat, Oct 17, 2015 at 1:26 AM, 許耀彰 <kpm906(at)gmail(dot)com> wrote:
>> Dear Support Team,
>> How can we know each table data increase day by day? It mean how do we get how many data produce today,included which data? Thank you.
>
>
> [moving from bugs(at)]
>
> Please refer to these SQL-level functions:
>
> pg_relation_size()
> pg_total_relation_size()
> pg_size_pretty()
If you are looking to track this over time, you'll need to use a tool that is capturing this in snapshots and do some reporting over it.
I've written a script that I use frequently as part of my OpenWatch tool (https://bitbucket.org/scott_mead/openwatch/src/d024185b1b5585f7b4c8a5ad6b926eafed2e249e/bindings/java/sql/OpenWatch-Snapshots.sql?at=master&fileviewer=file-view-default) Run this script in the database, then run snapshots periodically:
Select snapshots.save_snap();
To see a size report between snapshots, list the available snapshots:
select * from list_snaps();
To get the size report, get the snap_id numbers you want to report between and run:
select * from snapshots.report_tables(<startsnapid>, <endsnapid>)
If you download the full OpenWatch tool (https://bitbucket.org/scott_mead/openwatch/downloads) and run it from the shell script, you an add cpu, disk/io and memory to the report as well.
>
> http://www.postgresql.org/docs/current/static/functions-admin.html
>