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 CAANrPScXj4RkN-N9TXTDjj69gkv+8jj=RXLpWU02E_y7_bOcbA@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
Re: Running concurrent txns and measuring the timings in Postgres
List pgsql-general
I got this thing running and hopefully works as expected. The txns are
stored in insert_txn1.sql, insert_txn2.sql, ...
Please let me know if you find any issues with this.
Script is attached.



On Wed, Jul 24, 2019 at 5:11 PM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 7/24/19 1:52 PM, Souvik Bhattacherjee wrote:
>  >Well it depends on the part you have not filled in, what client(s) you
>  > are using and how the transactions are being generated?
>
> Using a psql client and txns are generated manually at this point. Each
> txn is
> stored separately in a .sql file and are fired from different psql
> sessions, if that
> helps.
>

A quick demo:

psql -d production -U postgres -c "\timing" -c "select line_id, category
  from avail_headers order by line_id;"

Timing is on.
Time: 0.710 ms

> On Wed, Jul 24, 2019 at 4:44 PM Adrian Klaver <adrian.klaver@aklaver.com
> <mailto:adrian.klaver@aklaver.com>> wrote:
>
>     On 7/24/19 1:42 PM, Souvik Bhattacherjee wrote:
>      >  > 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.
>      >
>
>     Well it depends on the part you have not filled in, what client(s) you
>     are using and how the transactions are being generated?
>
>
>
>     --
>     Adrian Klaver
>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>


--
Adrian Klaver
adrian.klaver@aklaver.com
Attachment

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Running concurrent txns and measuring the timings in Postgres
Next
From: Adrian Klaver
Date:
Subject: Re: Running concurrent txns and measuring the timings in Postgres