On 1 Září 2012, 12:30, Robert Haas wrote:
> On Sat, Sep 1, 2012 at 12:00 AM, Peter Eisentraut <peter_e@gmx.net> wrote:
>> When initializing a large database, pgbench writes tons of "%d tuples
>> done" lines. I propose to change this to a sort of progress counter
>> that stays on the same line, as in the attached patch.
>
> I'm not sure I like this - what if the output is being saved off to a
> file?
What about using istty(stdout) to handle this situation? Although I find
it usually confusing, because it prints one thing when executed directly
and something else when the output is redirected to a file.
I see two other options:
(1) removing this output altogether (I can't imagine a situation when this
really matters) and replace it with a simple "inserted 23% of rows,
estimated remaining time 14:23 (863 sec)", updated each 1%
(2) adding a switch (--verbose) that enables these lines, don't print them
by default
Another option might be updating the process title so that the "top" shows
current progress more precisely than (1).
Tomas