Search code examples
db2db2-luw

db2: how to set the timing and show rows modified?


On Postgres i use set timing

\timing

and show me timing and how much rows updated

update sales set target = 20000;
UPDATE 5
Time: 638,375 ms

on db2 is a little silent

db2 => update sales set target = 20000;
DB20000I The SQL command completed successfully.

How to show timing and rows updated on db2? Is the standard local client called db2.

Edit: I have solved for the "verbose" mode

db2 -m

or

export DB2OPTIONS="-m"
db2

But I found nothing for timing, except a workaround using batch mode and unix time command(sic!).


Solution

  • Db2 has a dedicated benchmark tool named db2batch. It can even print out more than just the timings and give you details about how many rows were impacted / fetched.