In this lab we will experiment query tuning techniques to best understand how to observe and improve performance.
- DBeaver
- ./cockroach sql --insecure
- psql
Student, Database, pgurl, adminurl
The lab cluster is configured in Google Clould in a singe zone:
- us-east4-b
- http://35.237.249.82:26258
- http://34.74.60.87:26258
- http://35.243.199.13:26258
- http://35.243.209.78:26258
https://github.com/glennfawcett/roachcrib
Run the following query and observe the performance.
SELECT ol_number, SUM(ol_quantity)
FROM order_line
WHERE ol_w_id > 30
AND ol_amount > 9990
GROUP BY ol_number
ORDER BY ol_number;
This query must run in less than 1 second! Note the the location of the client program will effect performance. For instance, the following times should be achieved
- DBeaver:: < 200ms
- cockroach (laptop-to-cloud):: < 200ms
- roachprod sql glenn-querylabs:3 --insecure:: < 12ms
How do you show the query plan?
How do you analyze the query performs?
What can be done to improve the performance of this Query so that it runs in less than 170ms?
Connect to the adminurl for the cluster. The exact URL should be saved as a bookmark or the instructor will display them.
something link this:
- http://35.237.249.82:26258
- http://34.74.60.87:26258
- http://35.243.199.13:26258
- http://35.243.209.78:26258
How big is your database?
Which query is taking the most time?
How much memory is being used on each node of the cluster?