Re: Transaction commits VS Transaction commits (with parallel) VS query mean time

From: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>
To: Rahila Syed <rahila(dot)syed(at)2ndquadrant(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Transaction commits VS Transaction commits (with parallel) VS query mean time
Date: 2019-03-19 07:50:09
Message-ID: CAJrrPGe1pvL0QsMNLcMAy9hQLVK1RO4B_j+fHOuMsdFJjojjBA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 19, 2019 at 2:32 PM Rahila Syed <rahila(dot)syed(at)2ndquadrant(dot)com>
wrote:

> Hi Haribabu,
>
> The latest patch fails while applying header files part. Kindly rebase.
>

Thanks for the review.

> The patch looks good to me. However, I wonder what are the other scenarios
> where xact_commit is incremented because even if I commit a single
> transaction with your patch applied the increment in xact_commit is > 1. As
> you mentioned upthread, need to check what internal operation resulted in
> the increase. But the increase in xact_commit is surely lesser with the
> patch.
>

Currently, the transaction counts are incremented by the background process
like autovacuum and checkpointer.
when turn the autovacuum off, you can see exactly how many transaction
commits increases.

> postgres=# BEGIN;
> BEGIN
> postgres=# select xact_commit from pg_stat_database where datname =
> 'postgres';
> xact_commit
> -------------
> 158
> (1 row)
>
> postgres=# explain analyze select * from foo where i = 1000;
> QUERY
> PLAN
>
> ------------------------------------------------------------------------------------------------------------------------
> Gather (cost=1000.00..136417.85 rows=1 width=37) (actual
> time=4.596..3792.710 rows=1 loops=1)
> Workers Planned: 2
> Workers Launched: 2
> -> Parallel Seq Scan on foo (cost=0.00..135417.75 rows=1 width=37)
> (actual time=2448.038..3706.009 rows=0 loops=3)
> Filter: (i = 1000)
> Rows Removed by Filter: 3333333
> Planning Time: 0.353 ms
> Execution Time: 3793.572 ms
> (8 rows)
>
> postgres=# commit;
> COMMIT
> postgres=# select xact_commit from pg_stat_database where datname =
> 'postgres';
> xact_commit
> -------------
> 161
> (1 row)
>

Thanks for the test and confirmation.

Regards,
Haribabu Kommi
Fujitsu Australia

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Haribabu Kommi 2019-03-19 07:51:15 Re: Transaction commits VS Transaction commits (with parallel) VS query mean time
Previous Message Jamison, Kirk 2019-03-19 07:46:52 RE: Transaction commits VS Transaction commits (with parallel) VS query mean time