Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at the 2025 Microsoft Fabric Community Conference. March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for $400 discount. Register now

Reply
frithjof_v
Super User
Super User

KQL: which pattern do you use most often, JOIN or LOOKUP?

I'm curious which pattern is most common in practice.

 

Which pattern do you use most regularly when writing KQL queries?

 

JOIN (dimension table on the left side) or LOOKUP (fact table on the left side)?

 

Thanks in advance!

1 ACCEPTED SOLUTION
v-junyant-msft
Community Support
Community Support

Hi @frithjof_v ,

When it comes to writing KQL (Kusto Query Language) queries, both JOIN and LOOKUP patterns have their own use cases, but the most common pattern often depends on the specific requirements and the data schema.

JOIN is frequently used when you need to combine rows from two tables based on a related column between them. This is especially common when you need detailed data that spans across multiple tables. The typical scenario is joining a fact table (which contains transactional data) with a dimension table (which contains contextual data like metadata).
For example:

FactTable
| join kind=inner DimensionTable on FactTable.Id == DimensionTable.Id


LOOKUP is used when you need to add columns from a dimension table to the fact table based on a key. This is more of a mapping operation, where you enrich your fact data with additional information from the dimension table.
For example:

FactTable
| lookup kind=leftouter DimensionTable on FactTable.Id == DimensionTable.Id


JOIN is typically used more often when writing KQL queries, especially when dealing with complex analytical queries that require combining datasets based on matching keys.
LOOKUP is also used regularly, particularly when the goal is to enrich a dataset with additional attributes without requiring a full join operation. It tends to be more performance-efficient for simple enrichment tasks.

Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-junyant-msft
Community Support
Community Support

Hi @frithjof_v ,

When it comes to writing KQL (Kusto Query Language) queries, both JOIN and LOOKUP patterns have their own use cases, but the most common pattern often depends on the specific requirements and the data schema.

JOIN is frequently used when you need to combine rows from two tables based on a related column between them. This is especially common when you need detailed data that spans across multiple tables. The typical scenario is joining a fact table (which contains transactional data) with a dimension table (which contains contextual data like metadata).
For example:

FactTable
| join kind=inner DimensionTable on FactTable.Id == DimensionTable.Id


LOOKUP is used when you need to add columns from a dimension table to the fact table based on a key. This is more of a mapping operation, where you enrich your fact data with additional information from the dimension table.
For example:

FactTable
| lookup kind=leftouter DimensionTable on FactTable.Id == DimensionTable.Id


JOIN is typically used more often when writing KQL queries, especially when dealing with complex analytical queries that require combining datasets based on matching keys.
LOOKUP is also used regularly, particularly when the goal is to enrich a dataset with additional attributes without requiring a full join operation. It tends to be more performance-efficient for simple enrichment tasks.

Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements