Remove redundant gettimeofday() calls to the extent practical without
Tom Lane <tgl@sss.pgh.pa.us>
Remove redundant gettimeofday() calls to the extent practical without changing semantics too much. statement_timestamp is now set immediately upon receipt of a client command message, and the various places that used to do their own gettimeofday() calls to mark command startup are referenced to that instead. I have also made stats_command_string use that same value for pg_stat_activity.query_start for both the command itself and its eventual replacement by <IDLE> or <idle in transaction>. There was some debate about that, but no argument that seemed convincing enough to justify an extra gettimeofday() call.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/transam/xact.c | modified | +8 −5 |
| src/backend/commands/prepare.c | modified | +2 −2 |
| src/backend/postmaster/pgstat.c | modified | +9 −3 |
| src/backend/postmaster/postmaster.c | modified | +9 −5 |
| src/backend/storage/lmgr/proc.c | modified | +40 −33 |
| src/backend/tcop/postgres.c | modified | +122 −165 |
| src/backend/utils/adt/timestamp.c | modified | +55 −1 |
| src/backend/utils/error/elog.c | modified | +4 −5 |
| src/backend/utils/mmgr/portalmem.c | modified | +2 −2 |
| src/include/libpq/libpq-be.h | modified | +6 −3 |
| src/include/utils/timestamp.h | modified | +11 −1 |