Fix performance of percentile calculation for annual reports (#32765)
This commit is contained in:
parent
823f597f00
commit
90f4ffa31d
7 changed files with 77 additions and 47 deletions
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreateAnnualReportStatusesPerAccountCounts < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
create_table :annual_report_statuses_per_account_counts do |t| # rubocop:disable Rails/CreateTableWithTimestamps
|
||||
t.integer :year, null: false
|
||||
t.bigint :account_id, null: false
|
||||
t.bigint :statuses_count, null: false
|
||||
end
|
||||
|
||||
add_index :annual_report_statuses_per_account_counts, [:year, :account_id], unique: true
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_10_22_214312) do
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_11_04_082851) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
|
@ -260,6 +260,13 @@ ActiveRecord::Schema[7.1].define(version: 2024_10_22_214312) do
|
|||
t.bigint "status_ids", array: true
|
||||
end
|
||||
|
||||
create_table "annual_report_statuses_per_account_counts", force: :cascade do |t|
|
||||
t.integer "year", null: false
|
||||
t.bigint "account_id", null: false
|
||||
t.bigint "statuses_count", null: false
|
||||
t.index ["year", "account_id"], name: "idx_on_year_account_id_ff3e167cef", unique: true
|
||||
end
|
||||
|
||||
create_table "appeals", force: :cascade do |t|
|
||||
t.bigint "account_id", null: false
|
||||
t.bigint "account_warning_id", null: false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue