Skip to content

Commit 01f4983

Browse files
authored
Merge pull request #137 from sqlitecloud/stage
chore(docs): improve Query Analyzer documentation
2 parents 11a75aa + 7db05f2 commit 01f4983

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

sqlite-cloud/platform/analyzer.mdx

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,49 @@ import VideoPlayer from '@commons-components/Video/VideoPlayer.astro';
99
import enableAnalyzer from '@docs-website-assets/introduction/video/dashboard_enable_query_analyzer.mp4';
1010
import applyAnalyzer from '@docs-website-assets/introduction/video/dashboard_analyzer_apply_suggestion.mp4';
1111

12+
import Callout from "@commons-components/Information/Callout.astro";
13+
1214

1315
The Analyzer panel is a powerful tool that collects and categorizes all the queries executed on your cluster based on their execution time. It allows for intelligent and proactive analysis, and provides recommendations on which indexes to use to optimize frequently used queries.
1416

1517
---
1618

1719
## Getting Started
1820

19-
By default, the Analyzer is turned off to avoid a small performance penalty. However, you can enable it by accessing the Settings button and setting the `query_analyzer_enabled` flag to 1, then pressing Save. You can also adjust the `query_analyzer_threshold` flag to set the minimum threshold query time (in milliseconds) that triggers a query to be included in the Analyzer. If the default value is too low, it's recommended to increase it to avoid having too many queries included in the panel.
21+
By default, the Analyzer is disabled to avoid unnecessary overhead. You can enable it directly from the top-left dropdown menu in the Analyzer panel.
22+
23+
Simply click on the dropdown (initially labeled **Disabled**) and select a monitoring threshold. You can choose a preset value (e.g., **Threshold 10ms**, **Threshold 100ms**) or define a **Custom Threshold**. Only queries taking longer than the selected time (in milliseconds) will be recorded and analyzed.
24+
25+
26+
<Callout type="warning">
27+
Query Analyzer is a **debugging tool**. <br/>It's recommended to keep it active only for the time strictly necessary to identify and optimize queries.
28+
</Callout>
29+
30+
2031
<VideoPlayer src={enableAnalyzer} />
2132

2233

34+
2335
----
2436
## Testing the Analyzer
25-
To test the Analyzer, we can go to the `Studio -> chinook.sqlite -> SQL Console` section and perform a query that filters the non-indexed Composer column of the Track table with the following statement: `SELECT * FROM Tracks WHERE Composer = 'AC/DC'`;
37+
To test the Analyzer, we can navigate to the `Studio -> chinook.sqlite -> SQL Console` section and perform a query that filters the non-indexed `Composer` column of the `Track` table using the following statement:
38+
39+
`SELECT * FROM Tracks WHERE Composer = 'AC/DC';`
40+
2641
<VideoPlayer src={applyAnalyzer} />
2742

43+
Once the query is executed, return to the **Analyzer** panel. You will see the query listed in the table along with execution statistics, such as **Count**, **Avg. Time (ms)**, and **Max Time (ms)**.
2844

45+
### Analyzing Performance and Applying Suggestions
2946

30-
Once we have executed this query, we can go back to the Analyzer panel and see that it has been successfully analyzed by the **nxidiwbuhz** node.
47+
Click on the query row to open the **Query Details** side panel. This panel provides in-depth information organized into three tabs:
3148

49+
1. **Query**: Displays the full SQL statement (with an option to copy it).
50+
2. **Current Execution Plan**: Shows how the database engine currently processes the query (e.g., `SCAN TABLE` indicates a full table scan, which is often inefficient).
51+
3. **Index Suggestions**: This is the most critical section for optimization. It displays **Candidate Indexes** and a **Suggested Index**.
3252

33-
By selecting **Details** and **Plan**, we can get more in-depth information about the execution of this query over time. However, what we're most interested in is the intelligent recommendation, which can be found by selecting **Suggest**. In the Indexes field, we can find the optimal index to apply to our database, which will speed up all queries on the Track table filtered by the Composer column.
53+
To optimize your database performance, navigate to the **Index Suggestions** tab.
3454

55+
If an optimization is available, you will see a proposed `CREATE INDEX` statement.
3556

36-
To apply the recommended index(es), simply select **Apply** and they will be automatically written and distributed in the `Chinook.sqlite` database.
57+
Simply click the **Apply All Suggestions** button. The Analyzer will automatically create and distribute the optimal index in the `chinook.sqlite` database, speeding up future queries filtered by the `Composer` column.

0 commit comments

Comments
 (0)