mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user