Do you remember the problem statement where you wrote a query to determine the top ten customers from the ‘market_star’ schema using different rank functions? Let’s revisit it and try to optimise the query. In the upcoming video, Shreyas will attempt to optimise the query using some optimisation techniques. Watch the upcoming video to understand how this changes the query execution time.
You must have noticed that you obtained the exact same result as you did earlier. However, the execution time of the unoptimised and the optimised queries are 141 ms and 15 ms, respectively. The order of magnitude is 141/15=9.4. This is obviously a huge improvement and will only become more pronounced in a real-life data set, which will be much larger than what you are dealing with in this module.
Do you recall the concepts of joins and nested queries that you learnt in basic SQL? In the next segment, you will see how they compare with each other in terms of performance.