CDCgov / prime-devops

Apache License 2.0
4 stars 2 forks source link

Run vacuum and analyze on the insert only tables #90

Closed mkalish closed 1 year ago

mkalish commented 1 year ago

Issue

Many of the tables for report stream are insert only and have never been vacuumed or had analyze ran against them. This has resulted in the stats being extremely off and results in non-optimal query plans getting generated.

Resolution

Run vacuum and analyze on all the tables that never had it run.

select relname
from pg_stat_user_tables
where last_analyze is null;

Tables as of writing this ticket in rough priority order if this needs to get broken up

report_lineage
item_lineage
report_file
action
covid_result_metadata
setting
flyway_schema_history
task
county_lat_long
email_schedule
jti_cache
lookup_table_version
lookup_table_row
action_log
temp_action
temp
temp_vt_resubmissions
elr_result_metadata
today_actions
sender_ips
october_actions
vw_livd_table
temp_patient_demographics
patient_gender
sender
state
JosiahSiegel commented 1 year ago

closed as duplicate of https://app.zenhub.com/workspaces/prime-devops-606cb208a8c112000fd48349/issues/gh/cdcgov/prime-devops/89