Join tables together starting with the smallest table (table with less cardinality) speeds things up.
To save resources, one should join tables together starting from the one that has the smallest cardinality whenever possible.
To inspect the cost of the query, append
EXPLAIN to the query so that we can get an execution plan.
Lei Ma (2020). 'Postgres Optimization in JOIN', Datumorphism, 11 April. Available at: https://datumorphism.leima.is/til/data/postgres.join-begin-with-smallest-cardinality/.
Table of Contents