Skip to content

Commit

Permalink
Speed up indexing with cursor_tuple_fraction pg option #11382
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Sep 6, 2024
1 parent 4a89eb2 commit b43fd2a
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 3 deletions.
4 changes: 3 additions & 1 deletion arches/install/arches-templates/project_name/settings.py-tpl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ DATABASES = {
"ENGINE": "django.contrib.gis.db.backends.postgis",
"HOST": "localhost",
"NAME": "{{ project_name }}",
"OPTIONS": {},
"OPTIONS": {
"options": "-c cursor_tuple_fraction=1",
},
"PASSWORD": "postgis",
"PORT": "5432",
"POSTGIS_TEMPLATE": "template_postgis",
Expand Down
4 changes: 3 additions & 1 deletion arches/install/arches-templates/tests/test_settings.py-tpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ DATABASES = {
"ENGINE": "django.contrib.gis.db.backends.postgis",
"HOST": "localhost",
"NAME": "{{ project_name }}",
"OPTIONS": {},
"OPTIONS": {
"options": "-c cursor_tuple_fraction=1",
},
"PASSWORD": "postgis",
"PORT": "5432",
"POSTGIS_TEMPLATE": "template_postgis",
Expand Down
3 changes: 3 additions & 0 deletions arches/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
"HOST": "localhost", # Set to empty string for localhost. Not used with sqlite3.
"PORT": "5432", # Set to empty string for default. Not used with sqlite3.
"POSTGIS_TEMPLATE": "template_postgis",
"OPTIONS": {
"options": "-c cursor_tuple_fraction=1",
},
}
}

Expand Down
3 changes: 3 additions & 0 deletions arches/settings_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ def get_optional_env_variable(var_name):
"HOST": get_env_variable("PGHOST"),
"PORT": get_env_variable("PGPORT"),
"POSTGIS_TEMPLATE": "template_postgis",
"OPTIONS": {
"options": "-c cursor_tuple_fraction=1",
},
}
}

Expand Down
3 changes: 3 additions & 0 deletions docker/settings_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ def get_optional_env_variable(var_name):
"HOST": get_env_variable("PGHOST"),
"PORT": get_env_variable("PGPORT"),
"POSTGIS_TEMPLATE": "template_postgis",
"OPTIONS": {
"options": "-c cursor_tuple_fraction=1",
},
}
}

Expand Down
10 changes: 10 additions & 0 deletions releases/8.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Arches 8.0.0 Release Notes
- 9613 Adds editable_future_graphs and the ability to update Graphs without unpublishing.
- 11042 Adds `ResourceInstanceLifecycle`s and `ResourceInstanceLifecycleState`s

### Performance improvements
- Improve indexing and bulk deletion performance [#11382](https://github.com/archesproject/arches/issues/11382)

### Additional highlights

- Add session-based REST APIs for login, logout [#11261](https://github.com/archesproject/arches/issues/11261)
Expand Down Expand Up @@ -52,6 +55,13 @@ JavaScript:

1. Remove "3.10" from the `python-version` matrix in `.github/workflows/main.yml`.

1. In settings.py, add the following key to `DATABASES` to [improve indexing performance](https://github.com/archesproject/arches/issues/11382):
```
"OPTIONS": {
"options": "-c cursor_tuple_fraction=1",
},
```

1. Update your frontend dependencies:
```
rm -rf node_modules package-lock.json
Expand Down
4 changes: 3 additions & 1 deletion tests/fixtures/testing_prj/testing_prj/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@
"ENGINE": "django.contrib.gis.db.backends.postgis",
"HOST": "localhost",
"NAME": "testing_prj",
"OPTIONS": {},
"OPTIONS": {
"options": "-c cursor_tuple_fraction=1",
},
"PASSWORD": "postgis",
"PORT": "5432",
"POSTGIS_TEMPLATE": "template_postgis",
Expand Down

0 comments on commit b43fd2a

Please sign in to comment.