pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedpg_dump - how to force to show timestamps in client log
9+ messages / 6 participants
[nested] [flat]
* pg_dump - how to force to show timestamps in client log
@ 2020-11-20 18:01 Durumdara <durumdara@gmail.com>
2020-11-20 20:32 ` Re: pg_dump - how to force to show timestamps in client log Joshua Drake <jd@commandprompt.com>
2020-11-20 20:56 ` Re: pg_dump - how to force to show timestamps in client log Adrian Klaver <adrian.klaver@aklaver.com>
2020-11-21 11:07 ` Re: pg_dump - how to force to show timestamps in client log Peter J. Holzer <hjp-pgsql@hjp.at>
0 siblings, 3 replies; 9+ messages in thread
From: Durumdara @ 2020-11-20 18:01 UTC (permalink / raw)
To: pgsql-general
Hello!
We need to log the pg_dump's state.
What objects are in copy, and what are the starting and ending times.
But when I try to redirect the output, the result doesn't have timestamps.
PG 11, on Windows.
As I see the -v option isn't enough to see the starting times.
For example:
2020-11-19 12:00:01.084 Dump table content table1
2020-11-19 12:03:12.932 Dump table content table2
...
etc.
Thank you for any information you can provide!
dd
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pg_dump - how to force to show timestamps in client log
2020-11-20 18:01 pg_dump - how to force to show timestamps in client log Durumdara <durumdara@gmail.com>
@ 2020-11-20 20:32 ` Joshua Drake <jd@commandprompt.com>
2 siblings, 0 replies; 9+ messages in thread
From: Joshua Drake @ 2020-11-20 20:32 UTC (permalink / raw)
To: Durumdara <durumdara@gmail.com>; +Cc: pgsql-general
Howdy,
pg_dump is just issuing SQL commands, you could turn on timestamps in your
postgresql log.
JD
On Fri, Nov 20, 2020 at 10:02 AM Durumdara <durumdara@gmail.com> wrote:
> Hello!
>
> We need to log the pg_dump's state.
> What objects are in copy, and what are the starting and ending times.
>
> But when I try to redirect the output, the result doesn't have timestamps.
>
> PG 11, on Windows.
>
> As I see the -v option isn't enough to see the starting times.
>
> For example:
>
> 2020-11-19 12:00:01.084 Dump table content table1
> 2020-11-19 12:03:12.932 Dump table content table2
> ...
> etc.
>
>
> Thank you for any information you can provide!
>
> dd
>
>
>
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pg_dump - how to force to show timestamps in client log
2020-11-20 18:01 pg_dump - how to force to show timestamps in client log Durumdara <durumdara@gmail.com>
@ 2020-11-20 20:56 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-11-20 21:00 ` Re: pg_dump - how to force to show timestamps in client log Ron <ronljohnsonjr@gmail.com>
2 siblings, 1 reply; 9+ messages in thread
From: Adrian Klaver @ 2020-11-20 20:56 UTC (permalink / raw)
To: Durumdara <durumdara@gmail.com>; pgsql-general
On 11/20/20 10:01 AM, Durumdara wrote:
> Hello!
>
> We need to log the pg_dump's state.
> What objects are in copy, and what are the starting and ending times.
>
> But when I try to redirect the output, the result doesn't have timestamps.
>
> PG 11, on Windows.
>
> As I see the -v option isn't enough to see the starting times.
>
> For example:
>
> 2020-11-19 12:00:01.084 Dump table content table1
> 2020-11-19 12:03:12.932 Dump table content table2
> ...
> etc.
If you are redirecting to a file it have the creation time that you can
use. Internally times don't really matter for the objects as the dump is
based on a snapshot. Said snapshot is based on visible transactions not
time. So for practical purposes they all occur at the same 'time'.
>
>
> Thank you for any information you can provide!
>
> dd
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pg_dump - how to force to show timestamps in client log
2020-11-20 18:01 pg_dump - how to force to show timestamps in client log Durumdara <durumdara@gmail.com>
2020-11-20 20:56 ` Re: pg_dump - how to force to show timestamps in client log Adrian Klaver <adrian.klaver@aklaver.com>
@ 2020-11-20 21:00 ` Ron <ronljohnsonjr@gmail.com>
2020-11-20 21:39 ` Re: pg_dump - how to force to show timestamps in client log Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 9+ messages in thread
From: Ron @ 2020-11-20 21:00 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 11/20/20 2:56 PM, Adrian Klaver wrote:
> On 11/20/20 10:01 AM, Durumdara wrote:
>> Hello!
>>
>> We need to log the pg_dump's state.
>> What objects are in copy, and what are the starting and ending times.
>>
>> But when I try to redirect the output, the result doesn't have timestamps.
>>
>> PG 11, on Windows.
>>
>> As I see the -v option isn't enough to see the starting times.
>>
>> For example:
>>
>> 2020-11-19 12:00:01.084 Dump table content table1
>> 2020-11-19 12:03:12.932 Dump table content table2
>> ...
>> etc.
>
>
> If you are redirecting to a file it have the creation time that you can
> use. Internally times don't really matter for the objects as the dump is
> based on a snapshot. Said snapshot is based on visible transactions not
> time. So for practical purposes they all occur at the same 'time'.
It makes all the difference when monitoring the progress of a backup.
--
Angular momentum makes the world go 'round.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pg_dump - how to force to show timestamps in client log
2020-11-20 18:01 pg_dump - how to force to show timestamps in client log Durumdara <durumdara@gmail.com>
2020-11-20 20:56 ` Re: pg_dump - how to force to show timestamps in client log Adrian Klaver <adrian.klaver@aklaver.com>
2020-11-20 21:00 ` Re: pg_dump - how to force to show timestamps in client log Ron <ronljohnsonjr@gmail.com>
@ 2020-11-20 21:39 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-11-20 22:00 ` Re: pg_dump - how to force to show timestamps in client log Ron <ronljohnsonjr@gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: Adrian Klaver @ 2020-11-20 21:39 UTC (permalink / raw)
To: Ron <ronljohnsonjr@gmail.com>; pgsql-general@lists.postgresql.org
On 11/20/20 1:00 PM, Ron wrote:
> On 11/20/20 2:56 PM, Adrian Klaver wrote:
>> On 11/20/20 10:01 AM, Durumdara wrote:
>>> Hello!
>>>
>>> We need to log the pg_dump's state.
>>> What objects are in copy, and what are the starting and ending times.
>>>
>>> But when I try to redirect the output, the result doesn't have
>>> timestamps.
>>>
>>> PG 11, on Windows.
>>>
>>> As I see the -v option isn't enough to see the starting times.
>>>
>>> For example:
>>>
>>> 2020-11-19 12:00:01.084 Dump table content table1
>>> 2020-11-19 12:03:12.932 Dump table content table2
>>> ...
>>> etc.
>>
>>
>> If you are redirecting to a file it have the creation time that you
>> can use. Internally times don't really matter for the objects as the
>> dump is based on a snapshot. Said snapshot is based on visible
>> transactions not time. So for practical purposes they all occur at the
>> same 'time'.
>
> It makes all the difference when monitoring the progress of a backup.
>
With -v you will get running list of objects dumped, just not the time.
The time is only of value relative to the following. Progress will only
be measurable by determining what is left to run and the time for each
object. Not sure that is feasible as you would have to pre-run the dump
to get information about the number of objects and an estimate of the
data quantity involved and the effect of each on the other. I could see
that estimate getting worse the bigger the data set(and hence the more
you cared) got. Because at some point the load on the machine would
affect the output speed of the dump.
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pg_dump - how to force to show timestamps in client log
2020-11-20 18:01 pg_dump - how to force to show timestamps in client log Durumdara <durumdara@gmail.com>
2020-11-20 20:56 ` Re: pg_dump - how to force to show timestamps in client log Adrian Klaver <adrian.klaver@aklaver.com>
2020-11-20 21:00 ` Re: pg_dump - how to force to show timestamps in client log Ron <ronljohnsonjr@gmail.com>
2020-11-20 21:39 ` Re: pg_dump - how to force to show timestamps in client log Adrian Klaver <adrian.klaver@aklaver.com>
@ 2020-11-20 22:00 ` Ron <ronljohnsonjr@gmail.com>
2020-11-20 22:32 ` Re: pg_dump - how to force to show timestamps in client log Mark Johnson <remi9898@gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: Ron @ 2020-11-20 22:00 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 11/20/20 3:39 PM, Adrian Klaver wrote:
> On 11/20/20 1:00 PM, Ron wrote:
>> On 11/20/20 2:56 PM, Adrian Klaver wrote:
>>> On 11/20/20 10:01 AM, Durumdara wrote:
>>>> Hello!
>>>>
>>>> We need to log the pg_dump's state.
>>>> What objects are in copy, and what are the starting and ending times.
>>>>
>>>> But when I try to redirect the output, the result doesn't have timestamps.
>>>>
>>>> PG 11, on Windows.
>>>>
>>>> As I see the -v option isn't enough to see the starting times.
>>>>
>>>> For example:
>>>>
>>>> 2020-11-19 12:00:01.084 Dump table content table1
>>>> 2020-11-19 12:03:12.932 Dump table content table2
>>>> ...
>>>> etc.
>>>
>>>
>>> If you are redirecting to a file it have the creation time that you can
>>> use. Internally times don't really matter for the objects as the dump is
>>> based on a snapshot. Said snapshot is based on visible transactions not
>>> time. So for practical purposes they all occur at the same 'time'.
>>
>> It makes all the difference when monitoring the progress of a backup.
>>
>
> With -v you will get running list of objects dumped, just not the time.
> The time is only of value relative to the following. Progress will only be
> measurable by determining what is left to run and the time for each
> object. Not sure that is feasible as you would have to pre-run the dump to
> get information about the number of objects and an estimate of the data
> quantity involved and the effect of each on the other. I could see that
> estimate getting worse the bigger the data set(and hence the more you
> cared) got. Because at some point the load on the machine would affect the
> output speed of the dump.
By knowing the sizes of the tables, and how long it takes to takes the first
"some" tables, then one can forecast how long it takes to backup the whole
database.
--
Angular momentum makes the world go 'round.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pg_dump - how to force to show timestamps in client log
2020-11-20 18:01 pg_dump - how to force to show timestamps in client log Durumdara <durumdara@gmail.com>
2020-11-20 20:56 ` Re: pg_dump - how to force to show timestamps in client log Adrian Klaver <adrian.klaver@aklaver.com>
2020-11-20 21:00 ` Re: pg_dump - how to force to show timestamps in client log Ron <ronljohnsonjr@gmail.com>
2020-11-20 21:39 ` Re: pg_dump - how to force to show timestamps in client log Adrian Klaver <adrian.klaver@aklaver.com>
2020-11-20 22:00 ` Re: pg_dump - how to force to show timestamps in client log Ron <ronljohnsonjr@gmail.com>
@ 2020-11-20 22:32 ` Mark Johnson <remi9898@gmail.com>
2020-11-21 09:31 ` Re: pg_dump - how to force to show timestamps in client log Ron <ronljohnsonjr@gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: Mark Johnson @ 2020-11-20 22:32 UTC (permalink / raw)
To: Ron <ronljohnsonjr@gmail.com>; Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: PostgreSQL <pgsql-general@lists.postgresql.org>
This all sounds like a previous discussion on pg hackers about a progress
meter for pg_dump. Search the archives for that discussion. Also, search
the web for something like "pg_dump progress meter" and you'll get a few
suggestions like pipe to pv, although that does not appear to work with all
of the file formats supported by pg_dump.
What do you see in pg_stat_activity? It's been a while since I tried to
monitor a running pg_dump.
Also, if you redirect the output to a file then doesn't the file's
timestamp get updated each time something happens. (That's what I used to
do with Oracle before they added timestamps).
On Fri, Nov 20, 2020 at 5:00 PM Ron <ronljohnsonjr@gmail.com> wrote:
> On 11/20/20 3:39 PM, Adrian Klaver wrote:
> > On 11/20/20 1:00 PM, Ron wrote:
> >> On 11/20/20 2:56 PM, Adrian Klaver wrote:
> >>> On 11/20/20 10:01 AM, Durumdara wrote:
> >>>> Hello!
> >>>>
> >>>> We need to log the pg_dump's state.
> >>>> What objects are in copy, and what are the starting and ending times.
> >>>>
> >>>> But when I try to redirect the output, the result doesn't have
> timestamps.
> >>>>
> >>>> PG 11, on Windows.
> >>>>
> >>>> As I see the -v option isn't enough to see the starting times.
> >>>>
> >>>> For example:
> >>>>
> >>>> 2020-11-19 12:00:01.084 Dump table content table1
> >>>> 2020-11-19 12:03:12.932 Dump table content table2
> >>>> ...
> >>>> etc.
> >>>
> >>>
> >>> If you are redirecting to a file it have the creation time that you
> can
> >>> use. Internally times don't really matter for the objects as the dump
> is
> >>> based on a snapshot. Said snapshot is based on visible transactions
> not
> >>> time. So for practical purposes they all occur at the same 'time'.
> >>
> >> It makes all the difference when monitoring the progress of a backup.
> >>
> >
> > With -v you will get running list of objects dumped, just not the time.
> > The time is only of value relative to the following. Progress will only
> be
> > measurable by determining what is left to run and the time for each
> > object. Not sure that is feasible as you would have to pre-run the dump
> to
> > get information about the number of objects and an estimate of the data
> > quantity involved and the effect of each on the other. I could see that
> > estimate getting worse the bigger the data set(and hence the more you
> > cared) got. Because at some point the load on the machine would affect
> the
> > output speed of the dump.
>
> By knowing the sizes of the tables, and how long it takes to takes the
> first
> "some" tables, then one can forecast how long it takes to backup the whole
> database.
>
> --
> Angular momentum makes the world go 'round.
>
>
>
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pg_dump - how to force to show timestamps in client log
2020-11-20 18:01 pg_dump - how to force to show timestamps in client log Durumdara <durumdara@gmail.com>
2020-11-20 20:56 ` Re: pg_dump - how to force to show timestamps in client log Adrian Klaver <adrian.klaver@aklaver.com>
2020-11-20 21:00 ` Re: pg_dump - how to force to show timestamps in client log Ron <ronljohnsonjr@gmail.com>
2020-11-20 21:39 ` Re: pg_dump - how to force to show timestamps in client log Adrian Klaver <adrian.klaver@aklaver.com>
2020-11-20 22:00 ` Re: pg_dump - how to force to show timestamps in client log Ron <ronljohnsonjr@gmail.com>
2020-11-20 22:32 ` Re: pg_dump - how to force to show timestamps in client log Mark Johnson <remi9898@gmail.com>
@ 2020-11-21 09:31 ` Ron <ronljohnsonjr@gmail.com>
0 siblings, 0 replies; 9+ messages in thread
From: Ron @ 2020-11-21 09:31 UTC (permalink / raw)
To: PostgreSQL <pgsql-general@lists.postgresql.org>
TBH, it's also been a while since I needed to monitor pg_dump, since we now
use pgbackrest (which just so happens to have a progress meter...).
On 11/20/20 4:32 PM, Mark Johnson wrote:
> This all sounds like a previous discussion on pg hackers about a progress
> meter for pg_dump. Search the archives for that discussion. Also, search
> the web for something like "pg_dump progress meter" and you'll get a few
> suggestions like pipe to pv, although that does not appear to work with
> all of the file formats supported by pg_dump.
>
> What do you see in pg_stat_activity? It's been a while since I tried to
> monitor a running pg_dump.
>
> Also, if you redirect the output to a file then doesn't the file's
> timestamp get updated each time something happens. (That's what I used to
> do with Oracle before they added timestamps).
>
> On Fri, Nov 20, 2020 at 5:00 PM Ron <ronljohnsonjr@gmail.com
> <mailto:ronljohnsonjr@gmail.com>> wrote:
>
> On 11/20/20 3:39 PM, Adrian Klaver wrote:
> > On 11/20/20 1:00 PM, Ron wrote:
> >> On 11/20/20 2:56 PM, Adrian Klaver wrote:
> >>> On 11/20/20 10:01 AM, Durumdara wrote:
> >>>> Hello!
> >>>>
> >>>> We need to log the pg_dump's state.
> >>>> What objects are in copy, and what are the starting and ending times.
> >>>>
> >>>> But when I try to redirect the output, the result doesn't have
> timestamps.
> >>>>
> >>>> PG 11, on Windows.
> >>>>
> >>>> As I see the -v option isn't enough to see the starting times.
> >>>>
> >>>> For example:
> >>>>
> >>>> 2020-11-19 12:00:01.084 Dump table content table1
> >>>> 2020-11-19 12:03:12.932 Dump table content table2
> >>>> ...
> >>>> etc.
> >>>
> >>>
> >>> If you are redirecting to a file it have the creation time that
> you can
> >>> use. Internally times don't really matter for the objects as the
> dump is
> >>> based on a snapshot. Said snapshot is based on visible
> transactions not
> >>> time. So for practical purposes they all occur at the same 'time'.
> >>
> >> It makes all the difference when monitoring the progress of a backup.
> >>
> >
> > With -v you will get running list of objects dumped, just not the time.
> > The time is only of value relative to the following. Progress will
> only be
> > measurable by determining what is left to run and the time for each
> > object. Not sure that is feasible as you would have to pre-run the
> dump to
> > get information about the number of objects and an estimate of the data
> > quantity involved and the effect of each on the other. I could see that
> > estimate getting worse the bigger the data set(and hence the more you
> > cared) got. Because at some point the load on the machine would
> affect the
> > output speed of the dump.
>
> By knowing the sizes of the tables, and how long it takes to takes the
> first
> "some" tables, then one can forecast how long it takes to backup the
> whole
> database.
>
> --
> Angular momentum makes the world go 'round.
>
>
--
Angular momentum makes the world go 'round.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: pg_dump - how to force to show timestamps in client log
2020-11-20 18:01 pg_dump - how to force to show timestamps in client log Durumdara <durumdara@gmail.com>
@ 2020-11-21 11:07 ` Peter J. Holzer <hjp-pgsql@hjp.at>
2 siblings, 0 replies; 9+ messages in thread
From: Peter J. Holzer @ 2020-11-21 11:07 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 2020-11-20 19:01:47 +0100, Durumdara wrote:
> We need to log the pg_dump's state.
> What objects are in copy, and what are the starting and ending times.
>
> But when I try to redirect the output, the result doesn't have timestamps.
>
> PG 11, on Windows.
>
> As I see the -v option isn't enough to see the starting times.
>
> For example:
>
> 2020-11-19 12:00:01.084 Dump table content table1
> 2020-11-19 12:03:12.932 Dump table content table2
You can pipe the output through a timestamping tool like this:
pg_dump --compress=5 -v -Fd -f "$name.$$" $db 2>&1 | ts > log/"$name".$(isodate).log
ts is available here: https://github.com/hjp/simple/tree/master/ts
hp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2020-11-21 11:07 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20 18:01 pg_dump - how to force to show timestamps in client log Durumdara <durumdara@gmail.com>
2020-11-20 20:32 ` Joshua Drake <jd@commandprompt.com>
2020-11-20 20:56 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-11-20 21:00 ` Ron <ronljohnsonjr@gmail.com>
2020-11-20 21:39 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-11-20 22:00 ` Ron <ronljohnsonjr@gmail.com>
2020-11-20 22:32 ` Mark Johnson <remi9898@gmail.com>
2020-11-21 09:31 ` Ron <ronljohnsonjr@gmail.com>
2020-11-21 11:07 ` Peter J. Holzer <hjp-pgsql@hjp.at>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox