Skip site navigation (1) Skip section navigation (2)

Re: timing for \copy

From: Neil Conway <neilc(at)samurai(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: List pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: timing for \copy
Date: 2006-12-13 17:40:16
Message-ID: 1166031616.5901.63.camel@localhost.localdomain (view raw or flat)
Thread:
Lists: pgsql-patches
On Wed, 2006-12-13 at 11:36 -0500, Andrew Dunstan wrote:
> + 		if (pset.timing)
> + 		{
> + 			GETTIMEOFDAY(&after);
> + 			elapsed_msec = DIFF_MSEC(&after, &before);
> + 			if (success)
> + 				printf(_("Time: %.3f ms\n"), elapsed_msec);
> + 
> + 		}

Not exactly a big deal, but

	if (pset.timing && success)
	{
		/* ... */
	}

seems a bit clearer, and avoids unnecessary work on failure. You can
also move "elapsed_msec" and "after" inside the "if" block.

Also, I believe headers should #include the headers that they themselves
depend on, so the inclusion of the getttimeofday() or _ftime() headers
could be moved to common.h

-Neil



In response to

Responses

pgsql-patches by date

Next:From: Jim C. NasbyDate: 2006-12-13 19:34:07
Subject: Re: Load distributed checkpoint
Previous:From: Andrew DunstanDate: 2006-12-13 16:36:20
Subject: timing for \copy

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group