How to Prevent Unintentional Joins in Looker Explore?

Looker's Explore automatically includes any joins defined in the Explore block. While this simplifies query building, it also leads to unintended joins when we only need data from a single table.

For example, if I want to get a simple distinct count or list from a particular column in table 'B', the Explore still joins with table 'A', leading to inaccurate results. I have several columns in table 'B' where I might need a distinct count or list, but these unnecessary joins affect the data.

I understand that this happens because of the join configurations defined in our Explore file, which are absolutely necessary for other queries.

explore: table_a {
join: table_b {
type: left_outer
sql_on: ${table_a.a_id} = ${table_b.b_id} ;;
relationship: many_to_one
}

join: table_c {
type: left_outer
sql_on: ${table_a.a_id} = ${table_c.c_id} ;;
relationship: many_to_one
}
}


My Questions:
Is there a better way or a workaround to prevent these unintended joins?
If yes, how can I apply the same workaround to other tables like table_c and table_d, where joins are required for some queries but not always?

Impact on Explore Assistance:
Since table_a Explore is linked to Explore Assistance, would introducing multiple Explores for individual tables (e.g., separate Explores for table_b, table_c, etc.) affect the behaviour of Explore Assistance?

Would appreciate any guidance on handling this more efficiently. Thanks!

0 1 64
1 REPLY 1

Whenever you start a query from an Explore, the Explore's base table will always be included in the query.

So, if you want to start a query from table B without any joins, you would have to create a new Explore starting from table B.

I'm not 100% following your question about Explore Assistance, but there should be no problem with referencing the same table in multiple Explores. Looker treats each Explore as a unique entity.

Top Labels in this Space