Using the query planner within SQL is the equivalent of using the debugger tools in browsers. By using explain
with options for formatting and actually executing with analyze
, we can see how our query performs.
Maybe we need to implement our query differently. Which includes possibly adding an index, using a sub-query instead of another table, or dozens of other options.
In the end, we need to first know how to profile our query and we do that with explain
.
Video notes: https://explain.depesz.com