On Tue, Mar 22, 2022 at 12:57:10PM +0000, Prajna Shetty wrote: > 1. We have performed Vacuum/Analyze/Reindex post Upgrade. > 2. Tweaked work_mem so it does not spill to Disk. We can Disk Usage But it is still using Hash Aggregate and came down from 5 minutes to 20 seconds. (Expected ~5 seconds). Attached plan after modifying work_mem > 3. Disabled Seqcan/ nestedloop > 4. Tweaked random_page_cost/seq_page_cost > 5. Set default_statistics_target=1000 and then run vacuum(analyze,verbose) on selected tables. > 6. We have also tested performance by increasing resources up to 4 vCPU and 32 GB RAM. Would you provide your current settings ? https://wiki.postgresql.org/wiki/Server_Configuration