In this recipe, we will be discussing the nesting loops mechanism in PostgreSQL.
Nesting loops is one of the table joining mechanisms, in which PostgreSQL prefers to join two different datasets based on a join condition. The name itself describes the nesting loops as a loop inside another loop. The outer loop holds a dataset and compares each tuple with the dataset that holds an inner loop. That is, if the outer loop has N number of tuples and the inner loop has M number of tuples, then the nested loop performs N * M number of comparisons to produce the output.
How to do it…
- For demonstrating the nesting loops, let's run a join query at
benchmarksqlto retrieve the list of warehouse names along with the customer name that ...