Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-18 09:12:21 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-18 09:12:21 +0300
commit231e74886fa51f23f2884d70ae05d283c91c3f76 (patch)
treed5e8d863287ca6b9cebbd802351bfa4d2e9c9e60 /doc/development/database
parenta23e299d919dbc710ff47878307f194745ea1e44 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development/database')
-rw-r--r--doc/development/database/efficient_in_operator_queries.md28
-rw-r--r--doc/development/database/multiple_databases.md2
2 files changed, 13 insertions, 17 deletions
diff --git a/doc/development/database/efficient_in_operator_queries.md b/doc/development/database/efficient_in_operator_queries.md
index 0e979534acd..1e706890f64 100644
--- a/doc/development/database/efficient_in_operator_queries.md
+++ b/doc/development/database/efficient_in_operator_queries.md
@@ -66,9 +66,9 @@ The execution of the query can be largely broken down into three steps:
1. The database sorts the `issues` rows in memory by `created_at` and returns `LIMIT 20` rows to
the end-user. For large groups, this final step requires both large memory and CPU resources.
-<details>
-<summary>Expand this sentence to see the execution plan for this DB query.</summary>
-<pre><code>
+Execution plan for this DB query:
+
+```sql
Limit (cost=90170.07..90170.12 rows=20 width=1329) (actual time=967.597..967.607 rows=20 loops=1)
Buffers: shared hit=239127 read=3060
I/O Timings: read=336.879
@@ -106,8 +106,7 @@ The execution of the query can be largely broken down into three steps:
Planning Time: 7.750 ms
Execution Time: 967.973 ms
(36 rows)
-</code></pre>
-</details>
+```
The performance of the query depends on the number of rows in the database.
On average, we can say the following:
@@ -240,9 +239,9 @@ to make the query execute efficiently:
"idx_issues_on_project_id_and_created_at_and_id" btree (project_id, created_at, id)
```
-<details>
-<summary>Expand this sentence to see the SQL query.</summary>
-<pre><code>
+The SQL query:
+
+```sql
SELECT "issues".*
FROM
(WITH RECURSIVE "array_cte" AS MATERIALIZED
@@ -353,8 +352,7 @@ SELECT (records).*
FROM "recursive_keyset_cte" AS "issues"
WHERE (COUNT <> 0)) issues -- filtering out the initializer row
LIMIT 20
-</code></pre>
-</details>
+```
### Using the `IN` query optimization
@@ -466,9 +464,9 @@ Gitlab::Pagination::Keyset::InOperatorOptimization::QueryBuilder.new(
).execute.limit(20)
```
-<details>
-<summary>Expand this sentence to see the SQL query.</summary>
-<pre><code>
+The SQL query:
+
+```sql
SELECT "issues".*
FROM
(WITH RECURSIVE "array_cte" AS MATERIALIZED
@@ -586,9 +584,7 @@ FROM
FROM "recursive_keyset_cte" AS "issues"
WHERE (COUNT <> 0)) issues
LIMIT 20
-</code>
-</pre>
-</details>
+```
NOTE:
To make the query efficient, the following columns need to be covered with an index: `project_id`, `issue_type`, `created_at`, and `id`.
diff --git a/doc/development/database/multiple_databases.md b/doc/development/database/multiple_databases.md
index d00103c94ba..0ba752ba3a6 100644
--- a/doc/development/database/multiple_databases.md
+++ b/doc/development/database/multiple_databases.md
@@ -508,7 +508,7 @@ end
```
Don't hesitate to reach out to the
-[sharding group](https://about.gitlab.com/handbook/engineering/development/enablement/sharding)
+[sharding group](https://about.gitlab.com/handbook/engineering/development/enablement/sharding/)
for advice.
## `config/database.yml`