Closed ruichen199801 closed 1 year ago
Currently we optimized 3 of the 4 complex analytics queries. The execution time of the queries is improved, but there is no significant difference in the server response time of the analytics routes in production.
This happens probably because for queries with LIKE %text%
, the query is mainly slowed down by it and other optimizations may not reflect on the actual server response time; for queries without it, althought the query optimization is significant, the query runs in less than 1s before the optimization and is fast enough already.
Also, the useEffect
calls all of the 4 analytics routes, therefore contents are only rendered after all 4 queries finish executing. So although our optimizations work, they may not make a huge impact to users visually.
How to test BEST_SAME_CITY query:
Issue with #77 (resolved):
imageUrl
is not included in the BEST_SAME_CITY query, and the query does not have the same behavior as the original one (e.g. display no result when saving some restaurant), so we revert to the commit before merging the optimized analytics queries.
Currently the optimized queries are archived in the archive/feature/optimize-sql
branch.
Optimize complex SQL queries used in analytics routes.
Details: https://docs.google.com/document/d/1G4SQG4v3Ostppn91XGbUNfPpWdlaAutYeeUZEM9J7cA/edit