Jaco van der Laan

Pre-Processed Joins

10/09/2025  ·  Data Engineering

‹ ›

Avoid in-line casting or transformations in JOIN conditions. Instead:

  • Pre-process the necessary columns in CTEs.
  • Use transformed columns in JOIN conditions to improve readability and performance.

Also avoid the use of literals in a JOIN.
Instead of using literals in your JOIN clauses, create a Common Table Expression (CTE) with the necessary filters. Then, join this CTE using keys.
This approach enhances readability, reusability and maintainability.