You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/using-gitbase/optimize-queries.md
+52Lines changed: 52 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,58 @@ There are two ways to optimize a gitbase query:
6
6
- Create an index for some parts.
7
7
- Making sure the joined tables are squashed.
8
8
9
+
## Assessing performance bottlenecks
10
+
11
+
To assess if there is a performance bottleneck you might want to inspect the execution tree of the query. This is also very helpful when reporting performance issues on gitbase.
12
+
13
+
The output from an `EXPLAIN` query is represented as a tree and shows how the query is actually evaluated.
#### Detecting performance issues in the query tree
55
+
56
+
Some performance issues might not be obvious, but there are a few that really stand out by just looking at the query tree.
57
+
58
+
- Joins not squashed. If you performed some joins between tables and instead of a `SquashedTable` node you see `Join` and `Table` nodes, it means the joins were not successfully squashed. There is a more detailed explanation about this in next sections of this document.
59
+
- Indexes not used. If you can't see the indexes in your table nodes, it means somehow those indexes are not being used by the table. There is a more detailed explanation about this in next sections of this document.
60
+
9
61
## Indexes
10
62
11
63
The more obvious way to improve the performance of a query is to create an index for such query. Since you can index multiple columns or a single arbitrary expression, this may be useful for some kinds of queries. For example, if you're querying by language, you may want to index that so there is no need to compute the language each time.
0 commit comments