perf: Add another index to surveyitemresponses. Implement bullet suggestions. Memoize a function in measure.rb

This commit is contained in:
rebuilt 2023-06-10 10:19:05 -07:00
parent eee0cb14a3
commit 452876ef09
4 changed files with 19 additions and 11 deletions

View file

@ -0,0 +1,6 @@
class AddSurveyItemIndexToSurveyItemResponses < ActiveRecord::Migration[7.0]
def change
add_index :survey_item_responses, %i[school_id academic_year_id survey_item_id],
name: 'by_school_year_and_survey_item'
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_04_21_034505) do
ActiveRecord::Schema[7.0].define(version: 2023_06_10_165508) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -447,6 +447,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_04_21_034505) do
t.index ["academic_year_id"], name: "index_survey_item_responses_on_academic_year_id"
t.index ["gender_id"], name: "index_survey_item_responses_on_gender_id"
t.index ["response_id"], name: "index_survey_item_responses_on_response_id"
t.index ["school_id", "academic_year_id", "survey_item_id"], name: "by_school_year_and_survey_item"
t.index ["school_id", "academic_year_id"], name: "index_survey_item_responses_on_school_id_and_academic_year_id"
t.index ["school_id", "survey_item_id", "academic_year_id", "grade"], name: "index_survey_responses_on_grade"
t.index ["school_id"], name: "index_survey_item_responses_on_school_id"