Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add problem(external_id) database index. #3808

Merged
merged 1 commit into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- Ability to pass custom arguments (eg: SSL config) to server when running via Docker
- Allow bin/fetch start/end times to be fractional.
- Add an --exclude option to bin/fetch.
- Add an index on problem(external_id) to speed up bin/fetch --updates
- Open311 improvements:
- Increase default timeout.

Expand Down
1 change: 1 addition & 0 deletions bin/update-schema
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ else {
# (assuming schema change files are never half-applied, which should be the case)
sub get_db_version {
return 'EMPTY' if ! table_exists('problem');
return '0076' if index_exists('problem_external_id_idx');
return '0075' if column_exists('alert', 'parameter3');
return '0074' if index_exists('users_fulltext_idx');
return '0073' if index_exists('problem_fulltext_idx');
Expand Down
2 changes: 2 additions & 0 deletions db/downgrade_0076---0075.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DROP INDEX problem_external_id_idx;

1 change: 1 addition & 0 deletions db/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ create table problem (
);
create index problem_state_latitude_longitude_idx on problem(state, latitude, longitude);
create index problem_user_id_idx on problem ( user_id );
create index problem_external_id_idx on problem(external_id);
create index problem_external_body_idx on problem(lower(external_body));
create index problem_radians_latitude_longitude_idx on problem(radians(latitude), radians(longitude));
create index problem_bodies_str_array_idx on problem USING gin(regexp_split_to_array(bodies_str, ','));
Expand Down
1 change: 1 addition & 0 deletions db/schema_0076-add-index-problem-external_id.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE INDEX CONCURRENTLY problem_external_id_idx on problem(external_id);