mirror of
https://github.com/postgres/postgres.git
synced 2025-07-18 17:42:25 +03:00
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.
This commit is contained in:
@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user