Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id AD6D49F988C for ; Tue, 14 Aug 2007 19:57:29 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 49444-05 for ; Tue, 14 Aug 2007 19:56:17 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.181]) by postgresql.org (Postfix) with ESMTP id C047B9F987B for ; Tue, 14 Aug 2007 19:56:07 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id d32so3777276pye for ; Tue, 14 Aug 2007 15:54:16 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=nCINLeDwnqPHP0dv77m5zZGbVFwE4uK7xToS3pLBC4pOAojVdtGAwJqmT3nooYGZ5tZeo9iGRdBVVa0i4+RKS9r219v8um5lnRY8QqcVX7dVYq23m8ZMf0phOuTEpswvfnYNlC6YDqkvTZiyVxc1FZ8FngEOJ1Uds3YPjLzMqxY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=KcSVpBqZS26P8Sc6fA3xwlrjFo4zJ6muvyjPRxRzOIvCnsB4MA6zaHIqdZ1xGhpjO/mJwpszvLFAdLuVqYpc0MblDCL7JfJcVSzXsoI9QACmjxy05RUnml45ToVtR8sHm/z3pt37ZxUCGsnTu7tYsdVR8DnPg5vANzGLcx3R1B0= Received: by 10.65.73.16 with SMTP id a16mr12770830qbl.1187131455054; Tue, 14 Aug 2007 15:44:15 -0700 (PDT) Received: by 10.65.110.15 with HTTP; Tue, 14 Aug 2007 15:44:14 -0700 (PDT) Message-ID: <8078a1730708141544m4e695accl10664066c28aae95@mail.gmail.com> Date: Tue, 14 Aug 2007 15:44:14 -0700 From: "Medi Montaseri" To: Decibel! Subject: Re: postmaster restart on a different dataDir Cc: pgsql-admin@postgresql.org In-Reply-To: <20070814220151.GU54135@nasby.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_62730_25990911.1187131454708" References: <8078a1730708131605pd700c76u2bc9e4c96cac5947@mail.gmail.com> <20070814220151.GU54135@nasby.net> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/168 X-Sequence-Number: 26499 ------=_Part_62730_25990911.1187131454708 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Actually I found the answer....pg_ctl supports a -w switch which waits for the start operation to complete. Decibel...without -w, pg_ctl will return immediately before postmaster is fully operational. If you don't believe me start the engine and try to connect to it right away with pgsql(1)... Cheers for now Medi On 8/14/07, Decibel! wrote: > > On Mon, Aug 13, 2007 at 04:05:37PM -0700, Medi Montaseri wrote: > > Hi, > > > > I am trying to measure startup time of postmaster. Say I have postmaster > > Why? > > > running on -D /tmp/d1 and would like to restart it on -D /tmp/d2. > > > > If I just say > > time pg_ctl restart -D /tmp/d2 > > it will not produce an accurate result because pg_ctl will start > postmaster > > in the background and return immediately but if you query the engine > right > > away, you'll see that it is not ready yet as in > > time ( pg_ctl restart -D /tmp/d2 ; psql -l ) > > > > If I call postmaster, then the command is blocking waiting for > postmaster to > > exit. > > So let it stop, start the timer, then start it again. > -- > Decibel!, aka Jim Nasby decibel@decibel.org > EnterpriseDB http://enterprisedb.com 512.569.9461 (cell) > > ------=_Part_62730_25990911.1187131454708 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Actually I found the answer....pg_ctl supports a -w switch which waits for the start operation to complete.

Decibel...without -w, pg_ctl will return immediately before postmaster is fully operational. If you don't believe me start the engine and try to connect to it right away with pgsql(1)...

Cheers for now
Medi

On 8/14/07, Decibel! <decibel@decibel.org> wrote:
On Mon, Aug 13, 2007 at 04:05:37PM -0700, Medi Montaseri wrote:
> Hi,
>
> I am trying to measure startup time of postmaster. Say I have postmaster

Why?

> running on -D /tmp/d1 and would like to restart it on -D /tmp/d2.
>
> If I just say
> time pg_ctl restart -D /tmp/d2
> it will not produce an accurate result because pg_ctl will start postmaster
> in the background and return immediately but if you query the engine right
> away, you'll see that it is not ready yet as in
> time ( pg_ctl restart -D /tmp/d2 ; psql -l )
>
> If I call postmaster, then the command is blocking waiting for postmaster to
> exit.

So let it stop, start the timer, then start it again.
--
Decibel!, aka Jim Nasby                        decibel@decibel.org
EnterpriseDB       http://enterprisedb.com      512.569.9461 (cell)


------=_Part_62730_25990911.1187131454708--