vacuumdb --all --analyze-in-stages - wrong order?

Started by Pavel Stehulealmost 12 years ago6 messageshackers
Jump to latest
#1Pavel Stehule
pavel.stehule@gmail.com

Hello

I am looking on --analyze-in-stages option. If I understand well,
motivation for this option is a get some minimal statistic for databases in
minimal time. But when I tested, I found so iterations are per databases,
not per stages - some first database get a maximum statistics and second
has zero statistics. Isn't it unpractical?

Now:

DB a
stage 1, stage2, stage3
DB b
stage 1, stage2, stage3

should be:

Stage1
DB a, DB b ...
Stage 2
DB a, DB b ...
Stage 3
DB a, DB b, ..

Regards

Pavel

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Pavel Stehule (#1)
Re: vacuumdb --all --analyze-in-stages - wrong order?

On 5/18/14, 3:52 AM, Pavel Stehule wrote:

Hello

I am looking on --analyze-in-stages option. If I understand well,
motivation for this option is a get some minimal statistic for databases
in minimal time. But when I tested, I found so iterations are per
databases, not per stages - some first database get a maximum statistics
and second has zero statistics. Isn't it unpractical?

Yes. Let me see if I can fix that.

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Peter Eisentraut
peter_e@gmx.net
In reply to: Peter Eisentraut (#2)
Re: vacuumdb --all --analyze-in-stages - wrong order?

On Mon, 2014-05-19 at 13:51 -0400, Peter Eisentraut wrote:

On 5/18/14, 3:52 AM, Pavel Stehule wrote:

I am looking on --analyze-in-stages option. If I understand well,
motivation for this option is a get some minimal statistic for databases
in minimal time. But when I tested, I found so iterations are per
databases, not per stages - some first database get a maximum statistics
and second has zero statistics. Isn't it unpractical?

Yes. Let me see if I can fix that.

At long last, here is a patch.

If somebody has an idea how to code some of that less confusingly, let
me know.

Attachments:

fix-analyze-in-stages.patchtext/x-patch; charset=UTF-8; name=fix-analyze-in-stages.patchDownload+36-7
#4Pavel Stehule
pavel.stehule@gmail.com
In reply to: Peter Eisentraut (#3)
Re: vacuumdb --all --analyze-in-stages - wrong order?

2014-09-04 5:36 GMT+02:00 Peter Eisentraut <peter_e@gmx.net>:

On Mon, 2014-05-19 at 13:51 -0400, Peter Eisentraut wrote:

On 5/18/14, 3:52 AM, Pavel Stehule wrote:

I am looking on --analyze-in-stages option. If I understand well,
motivation for this option is a get some minimal statistic for

databases

in minimal time. But when I tested, I found so iterations are per
databases, not per stages - some first database get a maximum

statistics

and second has zero statistics. Isn't it unpractical?

Yes. Let me see if I can fix that.

At long last, here is a patch.

If somebody has an idea how to code some of that less confusingly, let
me know.

It is little bit hard to read.

/* If stage is -1, then run all stages. Otherwise, we got
a stage
* from vacuum_all_databases(), so just run that one. */
for (i = (stage == -1 ? 0 : stage); i < (stage == -1 ? 3 :
stage + 1); i++)
{
puts(gettext(stage_messages[i]));
executeCommand(conn, stage_commands[i], progname,
echo);
run_vacuum_command(conn, sql.data, echo, dbname,
table, progname);
}

maybe better be more verbose - and it can be in alone function, because it
is "analyze only"

if (stage == -1)
{
for (i = 0; i < 3; i++)
{
puts(gettext(stage_messages[i]));
executeCommand(conn, stage_commands[i], progname, echo);
run_vacuum_command(conn, sql.data, echo, dbname, table, progname);
}
}
else
{
puts(gettext(stage_messages[stage]));
executeCommand(conn, stage_commands[stage], progname, echo);
run_vacuum_command(conn, sql.data, echo, dbname, table, progname);
}

Regards

Pavel

#5Peter Eisentraut
peter_e@gmx.net
In reply to: Pavel Stehule (#4)
Re: vacuumdb --all --analyze-in-stages - wrong order?

On 9/4/14 4:23 PM, Pavel Stehule wrote:

It is little bit hard to read.

maybe better be more verbose - and it can be in alone function, because
it is "analyze only"

if (stage == -1)
{
for (i = 0; i < 3; i++)
{
puts(gettext(stage_messages[i]));
executeCommand(conn, stage_commands[i], progname, echo);
run_vacuum_command(conn, sql.data, echo, dbname, table, progname);
}
}
else
{
puts(gettext(stage_messages[stage]));
executeCommand(conn, stage_commands[stage], progname, echo);
run_vacuum_command(conn, sql.data, echo, dbname, table, progname);
}

Done that way, thanks!

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#6Pavel Stehule
pavel.stehule@gmail.com
In reply to: Peter Eisentraut (#5)
Re: vacuumdb --all --analyze-in-stages - wrong order?

2014-09-12 3:44 GMT+02:00 Peter Eisentraut <peter_e@gmx.net>:

On 9/4/14 4:23 PM, Pavel Stehule wrote:

It is little bit hard to read.

maybe better be more verbose - and it can be in alone function, because
it is "analyze only"

if (stage == -1)
{
for (i = 0; i < 3; i++)
{
puts(gettext(stage_messages[i]));
executeCommand(conn, stage_commands[i], progname, echo);
run_vacuum_command(conn, sql.data, echo, dbname, table,

progname);

}
}
else
{
puts(gettext(stage_messages[stage]));
executeCommand(conn, stage_commands[stage], progname, echo);
run_vacuum_command(conn, sql.data, echo, dbname, table, progname);
}

Done that way, thanks!

Thank you

It is interesting feature

Pavel