diff options
author | Tom Lane | 2010-10-12 18:44:25 +0000 |
---|---|---|
committer | Tom Lane | 2010-10-12 18:44:25 +0000 |
commit | f4d242ef94730c447d87b9840a40b0ec3371fe0f (patch) | |
tree | f6d6ea879c0ab7650966de4244218fe026589636 | |
parent | 82659e0456f5c5a52a35ee41e63882c280ec2496 (diff) |
Remove some unnecessary tests of pgstat_track_counts.
We may as well make pgstat_count_heap_scan() and related macros just count
whenever rel->pgstat_info isn't null. Testing pgstat_track_counts buys
nothing at all in the normal case where that flag is ON; and when it's OFF,
the pgstat_info link will be null, so it's still a useless test.
This change is unlikely to buy any noticeable performance improvement,
but a cycle shaved is a cycle earned; and my investigations earlier today
convinced me that we're down to the point where individual instructions in
the inner execution loops are starting to matter.
-rw-r--r-- | src/backend/postmaster/pgstat.c | 8 | ||||
-rw-r--r-- | src/include/pgstat.h | 14 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index 483d7afe349..a1ad3429535 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -1660,7 +1660,7 @@ pgstat_count_heap_insert(Relation rel) { PgStat_TableStatus *pgstat_info = rel->pgstat_info; - if (pgstat_track_counts && pgstat_info != NULL) + if (pgstat_info != NULL) { /* We have to log the effect at the proper transactional level */ int nest_level = GetCurrentTransactionNestLevel(); @@ -1681,7 +1681,7 @@ pgstat_count_heap_update(Relation rel, bool hot) { PgStat_TableStatus *pgstat_info = rel->pgstat_info; - if (pgstat_track_counts && pgstat_info != NULL) + if (pgstat_info != NULL) { /* We have to log the effect at the proper transactional level */ int nest_level = GetCurrentTransactionNestLevel(); @@ -1706,7 +1706,7 @@ pgstat_count_heap_delete(Relation rel) { PgStat_TableStatus *pgstat_info = rel->pgstat_info; - if (pgstat_track_counts && pgstat_info != NULL) + if (pgstat_info != NULL) { /* We have to log the effect at the proper transactional level */ int nest_level = GetCurrentTransactionNestLevel(); @@ -1732,7 +1732,7 @@ pgstat_update_heap_dead_tuples(Relation rel, int delta) { PgStat_TableStatus *pgstat_info = rel->pgstat_info; - if (pgstat_track_counts && pgstat_info != NULL) + if (pgstat_info != NULL) pgstat_info->t_counts.t_delta_dead_tuples -= delta; } diff --git a/src/include/pgstat.h b/src/include/pgstat.h index 87541433c09..d49bd80526d 100644 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@ -705,37 +705,37 @@ extern void pgstat_initstats(Relation rel); #define pgstat_count_heap_scan(rel) \ do { \ - if (pgstat_track_counts && (rel)->pgstat_info != NULL) \ + if ((rel)->pgstat_info != NULL) \ (rel)->pgstat_info->t_counts.t_numscans++; \ } while (0) #define pgstat_count_heap_getnext(rel) \ do { \ - if (pgstat_track_counts && (rel)->pgstat_info != NULL) \ + if ((rel)->pgstat_info != NULL) \ (rel)->pgstat_info->t_counts.t_tuples_returned++; \ } while (0) #define pgstat_count_heap_fetch(rel) \ do { \ - if (pgstat_track_counts && (rel)->pgstat_info != NULL) \ + if ((rel)->pgstat_info != NULL) \ (rel)->pgstat_info->t_counts.t_tuples_fetched++; \ } while (0) #define pgstat_count_index_scan(rel) \ do { \ - if (pgstat_track_counts && (rel)->pgstat_info != NULL) \ + if ((rel)->pgstat_info != NULL) \ (rel)->pgstat_info->t_counts.t_numscans++; \ } while (0) #define pgstat_count_index_tuples(rel, n) \ do { \ - if (pgstat_track_counts && (rel)->pgstat_info != NULL) \ + if ((rel)->pgstat_info != NULL) \ (rel)->pgstat_info->t_counts.t_tuples_returned += (n); \ } while (0) #define pgstat_count_buffer_read(rel) \ do { \ - if (pgstat_track_counts && (rel)->pgstat_info != NULL) \ + if ((rel)->pgstat_info != NULL) \ (rel)->pgstat_info->t_counts.t_blocks_fetched++; \ } while (0) #define pgstat_count_buffer_hit(rel) \ do { \ - if (pgstat_track_counts && (rel)->pgstat_info != NULL) \ + if ((rel)->pgstat_info != NULL) \ (rel)->pgstat_info->t_counts.t_blocks_hit++; \ } while (0) |