Re: timing for \copy

Поиск
Список
Период
Сортировка
От Neil Conway
Тема Re: timing for \copy
Дата
Msg-id 1166031616.5901.63.camel@localhost.localdomain
обсуждение исходный текст
Ответ на timing for \copy  (Andrew Dunstan <andrew@dunslane.net>)
Ответы Re: timing for \copy  (Andrew Dunstan <andrew@dunslane.net>)
Список 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



В списке pgsql-patches по дате отправления:

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: timing for \copy
Следующее
От: "Simon Riggs"
Дата:
Сообщение: pg_standby