Band Join

Important Notice: Migration of Documentation Website

Please be advised that our documentation website is currently undergoing a migration to a new platform. To ensure you have access to the most up-to-date information, we kindly request that you visit our new documentation website located at:

Official Snowflake Snowconvert Documentation

For any immediate assistance or if you encounter any issues, please contact our support team at [email protected].

Thank you for your understanding.

Some parts in the output code are omitted for clarity reasons.

Description

A band join is a special type of nonequijoin in which key values in one data set must fall within the specified range (“band”) of the second data set. The same table can serve as both the first and second data sets. (Oracle SQL Language Reference BandJoin)

In this section, we will see how a band join is executed in Snowflake and the execution plan is very similar to the improved version of Oracle.

Sample Source Patterns

Order by clause added because the result order may vary between Oracle and Snowflake.

Since the result set is too large, Row Limiting Clause was added. You can remove it to retrieve the entire result set.

Check this section to set up the sample database.

Basic Band Join case

Oracle

Snowflake

Execution plan

As extra information, the special thing about the band joins is the execution plan.

The following image shows the enhanced execution plan (implemented since Oracle 12c) for the test query:

And in the following image, we will see the execution plan in Snowflake:

The execution plan in Snowflake is very similar to Oracle’s optimized version. The final duration and performance of the query will be affected by many other factors and are completely dependent on each DBMS internal functionality.

Known Issues

1. Results ordering mismatch between languages

The query result will have the same content in both database engines but the order might be different if no Order By clause is defined in the query.

  • SSC-EWI-OR0036: Types resolution issues, the arithmetic operation may not behave correctly between string and date.

Last updated