November 2015
Beginner
464 pages
9h 46m
English
An important question regarding a database system is: how fast is it? How many transactions can it handle per second, or how much time a particular query takes to execute? The topic on the performance of a database has been covered in Chapter 10, Optimizing Database Performance. Here, we will only discuss the task of measuring it.
The Psql meta-command \timing is used to measure the time of execution of a particular SQL command. Once timing is enabled, psql shows the time of execution for each command:
car_portal-# \timing Timing is on. car_portal=# SELECT count(*) FROM car_portal_app.car; count ------- 229 (1 row) Time: 19.492 ms
Usually, that is enough to understand which query is faster. However, one cannot rely on that timing ...
Read now
Unlock full access