Re: Running concurrent txns and measuring the timings in Postgres - Mailing list pgsql-general

From Souvik Bhattacherjee
Subject Re: Running concurrent txns and measuring the timings in Postgres
Date
Msg-id CAANrPSfT9MVELJPomuggtcg8+KrLcRv2qAi-46figornSbUxsQ@mail.gmail.com
Whole thread Raw
In response to Re: Running concurrent txns and measuring the timings in Postgres  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: Running concurrent txns and measuring the timings in Postgres  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
> The duplicate elimination is being handled by ON CONFLICT or some custom
> process in the code generating the transactions?

Yes, we used ON CONFLICT for that. Thanks btw.

> If the transactions are being created from a single app/script could you
> not just use 'timing' to mark the beginning of the transactions and the
> end and record that somewhere(db table and/or file)?

So did you mean to say that I need to get the timestamps of the beginning/end
of the txn since \timing only produces elapsed time?  Surely that would solve the
problem but I'm not sure how to get that done in Postgres.

I wanted to check to see if there are simpler ways to get this done in Postgres
before trying out something similar to Rob's suggestion or yours.

On Wed, Jul 24, 2019 at 4:12 PM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 7/24/19 12:22 PM, Souvik Bhattacherjee wrote:
>  > It would help to know what problem you are trying to solve?
>
> Multiple txns are inserting tuples into a table concurrently. Wanted to
> measure
> the total time taken to complete the insertion process. Some txns
> overlap with
> others on the tuples they insert. Duplicate tuples are not inserted.

The duplicate elimination is being handled by ON CONFLICT or some custom
process in the code generating the transactions?

If the transactions are being created from a single app/script could you
not just use 'timing' to mark the beginning of the transactions and the
end and record that somewhere(db table and/or file)?

>
> On Wed, Jul 24, 2019 at 1:58 PM Adrian Klaver <adrian.klaver@aklaver.com
> <mailto:adrian.klaver@aklaver.com>> wrote:
>
>     On 7/24/19 9:54 AM, Souvik Bhattacherjee wrote:
>      > Hi,
>      >
>      > Is there a standard procedure to execute two or more concurrent
>     txns at
>      > the same time? I understand that if we want to run concurrent
>     txns, we
>      > need to execute them from different psql sessions. But how do we
>     make
>      > sure that they begin execution almost at the same time.
>
>     Well different sessions be they psql or some other client. That
>     would be
>     the difficulty, determining what is submitting the transaction.
>
>      >
>      > Also, I'm interested in measuring the time taken across all
>     executing
>      > txns, i.e. the time from the start of the earliest txns till the
>     end of
>      > the last txn.
>
>     It would help to know what problem you are trying to solve?
>
>      >
>      > Best,
>      > -SB
>
>
>     --
>     Adrian Klaver
>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>


--
Adrian Klaver
adrian.klaver@aklaver.com

pgsql-general by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Default ordering option
Next
From: Adrian Klaver
Date:
Subject: Re: Running concurrent txns and measuring the timings in Postgres