Re: Running concurrent txns and measuring the timings in Postgres
От
Adrian Ho
Тема
Re: Running concurrent txns and measuring the timings in Postgres
Дата
Msg-id
4dac2416-b98b-5e5b-90cf-0e8d3f98a80a@03s.net
Ответ на
Re: Running concurrent txns and measuring the timings in Postgres (Souvik Bhattacherjee)
Список
Дерево обсуждения
Running concurrent txns and measuring the timings in Postgres Souvik Bhattacherjee <kivuosb@gmail.com>
Re: Running concurrent txns and measuring the timings in Postgres Adrian Klaver <adrian.klaver@aklaver.com>
Re: Running concurrent txns and measuring the timings in Postgres Souvik Bhattacherjee <kivuosb@gmail.com>
Re: Running concurrent txns and measuring the timings in Postgres Rob Sargent <robjsargent@gmail.com>
Re: Running concurrent txns and measuring the timings in Postgres Adrian Klaver <adrian.klaver@aklaver.com>
Re: Running concurrent txns and measuring the timings in Postgres Souvik Bhattacherjee <kivuosb@gmail.com>
Re: Running concurrent txns and measuring the timings in Postgres Adrian Klaver <adrian.klaver@aklaver.com>
Re: Running concurrent txns and measuring the timings in Postgres Souvik Bhattacherjee <kivuosb@gmail.com>
Re: Running concurrent txns and measuring the timings in Postgres Adrian Klaver <adrian.klaver@aklaver.com>
Re: Running concurrent txns and measuring the timings in Postgres Souvik Bhattacherjee <kivuosb@gmail.com>
Re: Running concurrent txns and measuring the timings in Postgres Adrian Ho <ml+postgresql@03s.net>
Re: Running concurrent txns and measuring the timings in Postgres Adrian Klaver <adrian.klaver@aklaver.com>
On 25/7/19 5:24 AM, Souvik Bhattacherjee wrote:
> 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.
>
Even if you're using the ancient Bash version 3 (AFAIK only macOS still
uses it out of the box), about half the lines are unnecessary:
#!/bin/bash
SECONDS=0
for i in {1..4}
do
psql -d mydb -f insert_txn${i}.sql &
done
wait
echo "Elapsed time: $SECONDS secs"
Read the bash man page to understand that SECONDS "magic", and why I
didn't bother with PIDs at all. I also fixed a variable-dereferencing
bug in your original script ("insert_txn[$i].sql" literally expands to
"insert_txn[1].sql", etc.)
Best Regards,
Adrian
В списке pgsql-general по дате отправления
От: PegoraroF10
Дата:
От: Adrian Klaver
Дата: