Re: pg_restore -j <nothing>

Lists: pgsql-hackers
From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: pg_restore -j <nothing>
Date: 2009-04-22 22:26:04
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

I just noticed (!) that Make accepts an argument-less -j option, which
it takes to mean "use as many parallel jobs as possible". As far as I
see in our pg_restore code, we don't even accept an argumentless -j
option; was this deviation from the Make precedent on purpose, or were
we just not following Make at all on this?

I have to admit that I'm not really sure whether this kind of usage
would be a reasonable thing for pg_restore to support.

(Even if this was a good idea, I'm not suggesting that it be implemented
for 8.4. But if it is, then maybe it deserves a TODO entry.)

Thoughts?

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_restore -j <nothing>
Date: 2009-04-22 22:29:46
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

Alvaro Herrera wrote:
> Hi,
>
> I just noticed (!) that Make accepts an argument-less -j option, which
> it takes to mean "use as many parallel jobs as possible". As far as I
> see in our pg_restore code, we don't even accept an argumentless -j
> option; was this deviation from the Make precedent on purpose, or were
> we just not following Make at all on this?
>
> I have to admit that I'm not really sure whether this kind of usage
> would be a reasonable thing for pg_restore to support.
>
> (Even if this was a good idea, I'm not suggesting that it be implemented
> for 8.4. But if it is, then maybe it deserves a TODO entry.)

An unlimited pg_restore -j seems pretty scary.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_restore -j <nothing>
Date: 2009-04-22 22:33:47
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

Alvaro Herrera wrote:
> Hi,
>
> I just noticed (!) that Make accepts an argument-less -j option, which
> it takes to mean "use as many parallel jobs as possible". As far as I
> see in our pg_restore code, we don't even accept an argumentless -j
> option; was this deviation from the Make precedent on purpose, or were
> we just not following Make at all on this?
>
> I have to admit that I'm not really sure whether this kind of usage
> would be a reasonable thing for pg_restore to support.
>
> (Even if this was a good idea, I'm not suggesting that it be implemented
> for 8.4. But if it is, then maybe it deserves a TODO entry.)
>
> Thoughts?
>
>

There was no intention to follow Make.

And I think it's far far too early to be planning "improvements" of this
kind. We need to see how it gets used in the field.

cheers

andrew


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_restore -j <nothing>
Date: 2009-04-22 22:46:32
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Alvaro Herrera wrote:
>> I just noticed (!) that Make accepts an argument-less -j option, which
>> it takes to mean "use as many parallel jobs as possible".

> An unlimited pg_restore -j seems pretty scary.

Yeah. Even if Make has a sane way to estimate how many jobs it should
use, I'm not sure that pg_restore does. (The most obvious heuristic
for Make is to try to find out how many CPUs there are --- but at
least it's running on the same machine it's going to be eating CPU
on. pg_restore can't assume that.)

regards, tom lane


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Subject: Re: pg_restore -j <nothing>
Date: 2009-04-22 22:49:14
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On Thursday 23 April 2009 01:26:04 Alvaro Herrera wrote:
> I just noticed (!) that Make accepts an argument-less -j option, which
> it takes to mean "use as many parallel jobs as possible". As far as I
> see in our pg_restore code, we don't even accept an argumentless -j
> option; was this deviation from the Make precedent on purpose, or were
> we just not following Make at all on this?

There was likely no strong intention to follow make on this. A small problem
would be that getopt doesn't portably support single-letter options with
optional arguments.

The main problem, however, is that make -j is pretty useless and dangerous.
Using it on a large parallel-make-safe project can easily lock up (thrash)
your machine. make -j together with -l (--load-average) is kind of useful, I
guess, but exactly how "load average" translated to a PostgreSQL database
system is to be determined.


From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_restore -j <nothing>
Date: 2009-04-23 01:27:38
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

* Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> Yeah. Even if Make has a sane way to estimate how many jobs it should
> use, I'm not sure that pg_restore does. (The most obvious heuristic
> for Make is to try to find out how many CPUs there are --- but at
> least it's running on the same machine it's going to be eating CPU
> on. pg_restore can't assume that.)

I'm not sure if I'd consider it 'sane', but make basically uses the
dependency information, if a job can be run based on its dependency
requirements, then it's started. For small projects, this isn't
necessairly terrible, but it's not something I would generally
recommend.

I don't see any reasonable implementation, or justification, for
supporting something like that in pg_restore.

Thanks,

Stephen