mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-02-08 16:02:14 -05:00
Put the less-specific column on the left-hand side (#193)
Some database systems can make better use of an index if the index columns are ordered left-to-right in increasing specificity. I'm not sure if Postgres is one of those databases, but it also makes sense to me to read an index as "ordered by type and then ID".
This commit is contained in:
parent
c17c07158a
commit
2ce4af84e9
@ -4,7 +4,7 @@ class CreateGlitchNotes < ActiveRecord::Migration[5.1]
|
||||
t.bigint :target_id, null: false
|
||||
t.string :target_type, null: false
|
||||
t.text :note, null: false
|
||||
t.index [:target_id, :target_type]
|
||||
t.index [:target_type, :target_id]
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
@ -188,7 +188,7 @@ ActiveRecord::Schema.define(version: 20180118192721) do
|
||||
t.text "note", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["target_id", "target_type"], name: "index_glitch_notes_on_target_id_and_target_type"
|
||||
t.index ["target_type", "target_id"], name: "index_glitch_notes_on_target_type_and_target_id"
|
||||
end
|
||||
|
||||
create_table "imports", force: :cascade do |t|
|
||||
|
Loading…
x
Reference in New Issue
Block a user