Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Try adding these null key indexes
  • Loading branch information
Shpigford committed Jul 30, 2020
1 parent 852a49e commit a0e9e8e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions db/migrate/20200730181724_add_null_index_to_tracks.rb
@@ -0,0 +1,6 @@
class AddNullIndexToTracks < ActiveRecord::Migration[6.0]
def change
add_index :tracks, [:key, :audio_features_last_checked], where: "key is null"
add_index :tracks, :key, where: "key is null", name: 'tracks_key_is_null'
end
end
4 changes: 3 additions & 1 deletion db/schema.rb
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2020_07_29_182918) do
ActiveRecord::Schema.define(version: 2020_07_30_181724) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -145,7 +145,9 @@
t.index ["energy"], name: "index_tracks_on_energy"
t.index ["explicit"], name: "index_tracks_on_explicit"
t.index ["instrumentalness"], name: "index_tracks_on_instrumentalness"
t.index ["key", "audio_features_last_checked"], name: "index_tracks_on_key_and_audio_features_last_checked", where: "(key IS NULL)"
t.index ["key"], name: "index_tracks_on_key"
t.index ["key"], name: "tracks_key_is_null", where: "(key IS NULL)"
t.index ["liveness"], name: "index_tracks_on_liveness"
t.index ["loudness"], name: "index_tracks_on_loudness"
t.index ["lyrics_last_checked_at"], name: "index_tracks_on_lyrics_last_checked_at"
Expand Down

0 comments on commit a0e9e8e

Please sign in to comment.