Why do I have an extra join in my generated SQL?

Knowledge Drop

Last tested: May 2020

Generally speaking, Looker only write in a join to a table when needed. You can force joins to appear using required_joins.

Looker only adds a join to generated SQL when a user selects a field requiring that join on the Explore page. This also goes for fields that are forced to be in the query, such as with sql_always_where, sql_where, or liquid references of fields from other views.

Also, if a part of the sql_on in the join is commented out as a SQL comment (using dashes --) rather than a LookML comment (using number sign #), that part of the join will still be included in the generated SQL. Looker will pull in other joins to make sure those field references are valid, despite the fact that they're in a SQL comment.

This content is subject to limited support.                

Version history
Last update:
‎04-05-2021 09:10 AM
Updated by: