@@ -1709,7 +1709,7 @@ pgstat_report_analyze(Relation rel,
1709
1709
*
1710
1710
* Waste no time on partitioned tables, though.
1711
1711
*/
1712
- if (rel -> pgstat_info != NULL &&
1712
+ if (pgstat_relation_should_count ( rel ) &&
1713
1713
rel -> rd_rel -> relkind != RELKIND_PARTITIONED_TABLE )
1714
1714
{
1715
1715
PgStat_TableXactStatus * trans ;
@@ -2359,13 +2359,12 @@ add_tabstat_xact_level(PgStat_TableStatus *pgstat_info, int nest_level)
2359
2359
void
2360
2360
pgstat_count_heap_insert (Relation rel , PgStat_Counter n )
2361
2361
{
2362
- PgStat_TableStatus * pgstat_info = rel -> pgstat_info ;
2363
-
2364
- if (pgstat_info != NULL )
2362
+ if (pgstat_relation_should_count (rel ))
2365
2363
{
2366
- /* We have to log the effect at the proper transactional level */
2364
+ PgStat_TableStatus * pgstat_info = rel -> pgstat_info ;
2367
2365
int nest_level = GetCurrentTransactionNestLevel ();
2368
2366
2367
+ /* We have to log the effect at the proper transactional level */
2369
2368
if (pgstat_info -> trans == NULL ||
2370
2369
pgstat_info -> trans -> nest_level != nest_level )
2371
2370
add_tabstat_xact_level (pgstat_info , nest_level );
@@ -2380,13 +2379,12 @@ pgstat_count_heap_insert(Relation rel, PgStat_Counter n)
2380
2379
void
2381
2380
pgstat_count_heap_update (Relation rel , bool hot )
2382
2381
{
2383
- PgStat_TableStatus * pgstat_info = rel -> pgstat_info ;
2384
-
2385
- if (pgstat_info != NULL )
2382
+ if (pgstat_relation_should_count (rel ))
2386
2383
{
2387
- /* We have to log the effect at the proper transactional level */
2384
+ PgStat_TableStatus * pgstat_info = rel -> pgstat_info ;
2388
2385
int nest_level = GetCurrentTransactionNestLevel ();
2389
2386
2387
+ /* We have to log the effect at the proper transactional level */
2390
2388
if (pgstat_info -> trans == NULL ||
2391
2389
pgstat_info -> trans -> nest_level != nest_level )
2392
2390
add_tabstat_xact_level (pgstat_info , nest_level );
@@ -2405,13 +2403,12 @@ pgstat_count_heap_update(Relation rel, bool hot)
2405
2403
void
2406
2404
pgstat_count_heap_delete (Relation rel )
2407
2405
{
2408
- PgStat_TableStatus * pgstat_info = rel -> pgstat_info ;
2409
-
2410
- if (pgstat_info != NULL )
2406
+ if (pgstat_relation_should_count (rel ))
2411
2407
{
2412
- /* We have to log the effect at the proper transactional level */
2408
+ PgStat_TableStatus * pgstat_info = rel -> pgstat_info ;
2413
2409
int nest_level = GetCurrentTransactionNestLevel ();
2414
2410
2411
+ /* We have to log the effect at the proper transactional level */
2415
2412
if (pgstat_info -> trans == NULL ||
2416
2413
pgstat_info -> trans -> nest_level != nest_level )
2417
2414
add_tabstat_xact_level (pgstat_info , nest_level );
@@ -2463,13 +2460,12 @@ pgstat_truncdrop_restore_counters(PgStat_TableXactStatus *trans)
2463
2460
void
2464
2461
pgstat_count_truncate (Relation rel )
2465
2462
{
2466
- PgStat_TableStatus * pgstat_info = rel -> pgstat_info ;
2467
-
2468
- if (pgstat_info != NULL )
2463
+ if (pgstat_relation_should_count (rel ))
2469
2464
{
2470
- /* We have to log the effect at the proper transactional level */
2465
+ PgStat_TableStatus * pgstat_info = rel -> pgstat_info ;
2471
2466
int nest_level = GetCurrentTransactionNestLevel ();
2472
2467
2468
+ /* We have to log the effect at the proper transactional level */
2473
2469
if (pgstat_info -> trans == NULL ||
2474
2470
pgstat_info -> trans -> nest_level != nest_level )
2475
2471
add_tabstat_xact_level (pgstat_info , nest_level );
@@ -2492,10 +2488,12 @@ pgstat_count_truncate(Relation rel)
2492
2488
void
2493
2489
pgstat_update_heap_dead_tuples (Relation rel , int delta )
2494
2490
{
2495
- PgStat_TableStatus * pgstat_info = rel -> pgstat_info ;
2491
+ if (pgstat_relation_should_count (rel ))
2492
+ {
2493
+ PgStat_TableStatus * pgstat_info = rel -> pgstat_info ;
2496
2494
2497
- if (pgstat_info != NULL )
2498
2495
pgstat_info -> t_counts .t_delta_dead_tuples -= delta ;
2496
+ }
2499
2497
}
2500
2498
2501
2499
/*
0 commit comments