ProjectSidewalk / SidewalkWebpage

Project Sidewalk web page
http://projectsidewalk.org
MIT License
80 stars 23 forks source link

Adds small version of audit_task_interaction table for faster select queries #3545

Closed misaugstad closed 1 month ago

misaugstad commented 1 month ago

Resolves #1245

Adds a copy of the audit_task_interaction table that holds only a subset of the records (~0.9%), which makes our queries that use records in that table much faster. I used a db dump from Seattle (around 250 million records in the table; 2 million in small version), and the relevant queries went from a runtime of 1 minute 15 seconds to less than 1 second.

Hopefully this will help to reduce load on the db when people use the Explore page! And it should drastically speed up the loading time for the /admin/user pages and the /timeCheck page.

One note is that the evolutions file creates the table, but I am going to manually run the query to copy data into that table. It took 6 minutes to run on my local environment, and I'm worried about what might happen if we do that on the prod servers. The query I'm using is commented out in the evolutions file.

Things to check before submitting the PR