Description
In this video, I look at a rather complex query along with a proposed change. We figure out the difference this change makes and find ways to drastically improve the overall query performance.
We also touch on two rather typical query optimizations: Partial indexes and UNION over OR. This brings the query runtime down from 5,000ms to less than 100ms in our example.
Andreas Brandl - Sr. Database Reliability Engineer at GitLab: https://gitlab.com/abrandl
---
This is the MR we are looking at: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/28887#note_185007453
We started to discuss about this complex query in https://www.youtube.com/watch?v=s70JhO1zt_8&t=2469s and we were wondering how to approach this from a reviewer perspective. I hope this recording gives an idea how even complex queries can be approached.