This tip was authored by Jim Knicely
The vsql \timing meta-command reports, in milliseconds, the length of time it takes each SQL statement to execute.
Example:
dbadmin=> \timing Timing is on. dbadmin=> SELECT COUNT(*) FROM big_varchar_table WHERE pk BETWEEN 1000000 AND 2000000; COUNT --------- 1000001 (1 row) Time: First fetch (1 row): 179.609 ms. All rows formatted: 179.691 ms
You can also enable \timing from the command line using the vsql -i command.
Example:
[dbadmin@s18384357 ~]$ vsql -ic "SELECT COUNT(*) FROM big_varchar_table WHERE pk BETWEEN 1000000 AND 2000000;" COUNT --------- 1000001 (1 row) Time: First fetch (1 row): 52.728 ms. All rows formatted: 52.881 ms
Have Fun!