diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-18 03:09:20 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-18 03:09:20 +0300 |
commit | 72721699f11187199e89631ce0b5e3d2f7c167e9 (patch) | |
tree | b51a227be89d82aa24fc954e7b50e7b0933583cc /doc/development/understanding_explain_plans.md | |
parent | 06be418a7cd98a1c87c41ba43cca1ce9acbe885e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development/understanding_explain_plans.md')
-rw-r--r-- | doc/development/understanding_explain_plans.md | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/doc/development/understanding_explain_plans.md b/doc/development/understanding_explain_plans.md index 8f4caf286fe..8b1a6df72c4 100644 --- a/doc/development/understanding_explain_plans.md +++ b/doc/development/understanding_explain_plans.md @@ -707,7 +707,7 @@ For more information about the available options, run: ### `#database-lab` -Another tool GitLab employees can use is a chatbot powered by [Joe](https://gitlab.com/postgres-ai/joe), available in the [`#database-lab`](https://gitlab.slack.com/archives/CLJMDRD8C) channel on Slack. +Another tool GitLab employees can use is a chatbot powered by [Joe](https://gitlab.com/postgres-ai/joe) which uses [Database Lab](https://gitlab.com/postgres-ai/database-lab) to instantly provide developers with their own clone of the production database. Joe is available in the [`#database-lab`](https://gitlab.slack.com/archives/CLJMDRD8C) channel on Slack. Unlike chatops, it gives you a way to execute DDL statements (like creating indexes and tables) and get query plan not only for `SELECT` but also `UPDATE` and `DELETE`. For example, in order to test new index you can do the following: @@ -742,6 +742,20 @@ For more information about the available options, run: help ``` +#### Tips & Tricks + +The database connection is now maintained during your whole session, so you can use `exec set ...` for any session variables (such as `enable_seqscan` or `work_mem`). These settings will be applied to all subsequent commands until you reset them. + +It is also possible to use transactions. This may be useful when you are working on statements that modify the data, for example INSERT, UPDATE, and DELETE. The `explain` command will perform `EXPLAIN ANALYZE`, which executes the statement. In order to run each `explain` starting from a clean state you can wrap it in a transaction, for example: + +```sql +exec BEGIN + +explain UPDATE some_table SET some_column = TRUE + +exec ROLLBACK +``` + ## Further reading A more extensive guide on understanding query plans can be found in |