improve machine and ip address heartbeat querying speeds (#490)

This commit is contained in:
Fox Ellson-Taylor
2025-08-25 08:01:05 -05:00
committed by GitHub
parent 5544ebb599
commit c299e26e67
2 changed files with 9 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
class AddAltIdentifyingIndexes < ActiveRecord::Migration[8.0]
def change
add_index :heartbeats, :ip_address
add_index :heartbeats, :machine
end
end

4
db/schema.rb generated
View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2025_07_22_233948) do
ActiveRecord::Schema[8.0].define(version: 2025_08_21_021751) do
create_schema "pganalyze"
# These are extensions that must be enabled in order to support this database
@@ -258,6 +258,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_07_22_233948) do
t.bigint "raw_heartbeat_upload_id"
t.index ["category", "time"], name: "index_heartbeats_on_category_and_time"
t.index ["fields_hash"], name: "index_heartbeats_on_fields_hash_when_not_deleted", unique: true, where: "(deleted_at IS NULL)"
t.index ["ip_address"], name: "index_heartbeats_on_ip_address"
t.index ["machine"], name: "index_heartbeats_on_machine"
t.index ["project", "time"], name: "index_heartbeats_on_project_and_time"
t.index ["project"], name: "index_heartbeats_on_project"
t.index ["raw_heartbeat_upload_id"], name: "index_heartbeats_on_raw_heartbeat_upload_id"