Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uL05l-00GCeF-5p for pgsql-admin@arkaria.postgresql.org; Fri, 30 May 2025 13:48:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uL05j-0023t8-S3 for pgsql-admin@arkaria.postgresql.org; Fri, 30 May 2025 13:48:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uL05j-0023t0-HE for pgsql-admin@lists.postgresql.org; Fri, 30 May 2025 13:48:11 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uL05g-000tTu-2w for pgsql-admin@lists.postgresql.org; Fri, 30 May 2025 13:48:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Transfer-Encoding:Content-Type:MIME-Version :References:Reply-To:Message-ID:Subject:Cc:To:Sender:From:Date:Content-ID: Content-Description; bh=SgUV2YcReGxH1vOFyQiOBmkZeGlSNAUkjvHTV1vBybM=; b=bcpdk 2W9HVks2DGQNdPQVbUl3RCaqGcVPs2SI3p7fbUSQhEE1+N9hjG6cyjNB+MvWWc4DvoJgISZSESxf0 5eV55eO9KfqG9gztBu5LsBGI5EJwx/a1OzwEfBEIhgThoB8Lr/S/d046e4OcdWzOGlM8FSjtWqetU riK5VV/3kG+w=; Received: from depesz by depesz.com with local (Exim 4.96) (envelope-from ) id 1uL05g-009ijY-08; Fri, 30 May 2025 15:48:08 +0200 Date: Fri, 30 May 2025 15:48:08 +0200 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Ron Johnson Cc: Pgsql-admin Subject: Re: pg_dump verbose start and stop times? Message-ID: Reply-To: depesz@depesz.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, May 30, 2025 at 08:54:24AM -0400, Ron Johnson wrote: > And yet it's not possible to show how long it takes to copy each object . > This, at least, does the math to show the grand elapsed time, and puts an > easily greppable string in the cron job's stdout+stderr log file: > > time_it() > { > local ActionLabel=$1 > shift > date +"%n%F %T TIMEIT $ActionLabel started.%n" > START_SECS=$(date +"%s") > $@ > local RC=$? ; echo "TIMEIT Return Code = $RC" > FINISH_SECS=$(date +"%s") > ET=$(echo "scale=2;(${FINISH_SECS} - ${START_SECS})/60" | bc) > date +"%n%F %T TIMEIT $ActionLabel finished. Elapsed time: ${ET} > minutes." > return $RC > } > > time_it DUMP_$DB pg_dump -j ${Threads} -Z${ZLvl} -v -C -Fd --file=$DB $DB > 2> ${DB}_pgdump.log You do know that you could have just done: time pg_dump … without the time_it function? And if you'd want to write your own function, assuming you're running not-so-ancient bash, you could have just used $EPOCHREALTIME and not the date +… ? Best regards, depesz