Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
9e28a8b6
Commit
9e28a8b6
authored
Nov 10, 2020
by
Krasimir Angelov
Committed by
Achilleas Pipinellis
Nov 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update docs on compaing execution plans when optimizing queries
Add paragraph on importance of BUFFERS
parent
f82c3f2d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
doc/development/understanding_explain_plans.md
doc/development/understanding_explain_plans.md
+11
-0
No files found.
doc/development/understanding_explain_plans.md
View file @
9e28a8b6
...
@@ -434,6 +434,17 @@ If there aren't any, check if you can perhaps slightly change an existing one to
...
@@ -434,6 +434,17 @@ If there aren't any, check if you can perhaps slightly change an existing one to
fit both the existing and new queries. Only add a new index if none of the
fit both the existing and new queries. Only add a new index if none of the
existing indexes can be used in any way.
existing indexes can be used in any way.
When comparing execution plans, don't take timing as the only important metric.
Good timing is the main goal of any optimization, but it can be too volatile to
be used for comparison (for example, it depends a lot on the state of cache).
When optimizing a query, we usually need to reduce the amount of data we're
dealing with. Indexes are the way to work with fewer pages (buffers) to get the
result, so, during optimization, look at the number of buffers used (read and hit),
and work on reducing these numbers. Reduced timing will be the consequence of reduced
buffer numbers.
[
#database-lab
](
#database-lab
)
guarantees that the plan is structurally
identical to production (and overall number of buffers is the same as on production),
but difference in cache state and I/O speed may lead to different timings.
## Queries that can't be optimised
## Queries that can't be optimised
Now that we have seen how to optimise a query, let's look at another query that
Now that we have seen how to optimise a query, let's look at another query that
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment