π Looking to optimize the performance of your queries and avoid wasting money?
Check out this to find out which queries are spending the most and get tips for optimizing performance and avoiding waste! ππ
- We can navigate to the Diagnosis section and select SQL Statements to observe the historical cost of their queries. This dashboard aggregates similar queries, allowing us to easily identify which queries consumed the most Request Units (RUs) both in total and on average.
- Click on Diagnosis in the navigation menu.
- Click on the SQL Statement tab.
- Click on Total RU to sort queries by Total RU
- Click on Mean RU to sort queries by Mean RU per query
- By clicking on a specific query in the SQL Statements dashboard, we can access the corresponding query plan. This insight enables us to apply the optimization techniques discussed earlier, such as adding appropriate indexes, to enhance query performance.
- A TableFullScan executor means scanning all the data without an appropriate index for any of the WHERE clauses. This is strong evidence of poor performance and waste of money.
- Add appropriate index based on the WHERE clause and use EXPLAIN ANALYZE command to ensure that the newly added index is working as expected.
- For example, if the WHERE clause is bar = '1' and name of the table is table_foo_bar, running the following SQL statement will add an index to speed up the query. ALTER TABLE table_foo_bar ADD INDEX idx_bar (bar)
Top comments (0)