If you don’t understand your datastore’s strengths and weaknesses, your application is not going to scale. When is it best to carefully craft a SQL query to get exactly the information you want, and when should you just say “find(45)” and munge your data in application code?
Armed with a better understanding of SQL’s worldview you can make better decisions about what work goes in what part of your systems. We’re going to dig into a couple of example queries that do things like joining tables to themselves and intentionally creating cartesian products.
For each example you’ll see both sides of the coin: - Conceptually what each query is doing (as relational algebra) - Practically what each query is doing (iterating over data structures in your database)