-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add index by user_id on classifications (#56)
- Loading branch information
1 parent
fd99643
commit bf69893
Showing
2 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
db/migrate/20240328183306_add_index_by_user_id_for_classifications.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
# Timescale currently does not support creating indexes concurrently. See: https://github.com/timescale/timescaledb/issues/504 | ||
# This means that we cannot avoid write locks. | ||
# Timescale does offer adding indexes on a transaction per chunk basis. | ||
# See: https://docs.timescale.com/api/latest/hypertable/create_index/ for more details. | ||
|
||
class AddIndexByUserIdForClassifications < ActiveRecord::Migration[7.0] | ||
disable_ddl_transaction! | ||
|
||
def change | ||
execute <<~SQL | ||
CREATE INDEX index_classification_events_on_user_id ON classification_events(user_id) WITH (timescaledb.transaction_per_chunk); | ||
SQL | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters