Technical Feature Advantage: JOIN

SQL Join is a fundamental operation in relational databases that allows you to combine data from multiple tables based on shared columns or relationships. It’s essential for retrieving comprehensive information that spans across different tables, forming the basis for complex queries and analysis.

Here’s a breakdown of the value and usage of SQL Joins in StarRocks:


  • Consolidated Data Insights: Fetch information from multiple related tables to gain a holistic view and uncover hidden relationships.

  • Powerful Data Exploration: Create complex queries involving diverse entities and attributes, enabling thorough analysis and discovery.

  • Flexible Data Relationships: Model real-world connections between entities and extract meaningful insights from interconnected data.

Usage in StarRocks:

  • JOIN Keyword: Employ the JOIN keyword in your SQL queries to specify how tables should be combined.

  • Join Types: Choose from different join types to control the resulting dataset (we support 6+ JOINS and the below is a small subset):

    • INNER JOIN: Returns only rows with matching values in both tables (default behavior).

    • LEFT JOIN: Returns all rows from the left table, plus matching rows from the right table or NULLs for unmatched rows.

    • RIGHT JOIN: Returns all rows from the right table, plus matching rows from the left table or NULLs for unmatched rows.

    • FULL OUTER JOIN: Returns all rows from both tables, regardless of matching, filling unmatched values with NULLs.

  • Join Conditions: Specify the columns to match using the ON clause (e.g., ON = table2.user_id).



SELECT *FROM customers JOIN orders ON customers.customer_id = orders.customer_id;

If you use our StarRocks QuickStart (Quick Start | StarRocks) or our retail ecommerce scenario which contains 85+ million records (Retail eCommerce Funnel Analysis Demo with 1 million members and 87 million record dataset using StarRocks · StarRocks/starrocks · Discussion #26075 · GitHub), you can see our JOINS in action.

Additional Considerations:

  • Join Optimization: StarRocks employs various techniques like vectorized execution and cost-based optimization to streamline join operations.

  • Join Performance: Analyze query plans and consider indexing strategies for optimal performance, especially with large datasets.

  • Join Complexity: Manage query complexity with multiple joins for readability and maintainability.

In essence, SQL Joins are indispensable tools for unlocking the full potential of relational databases like StarRocks. By mastering their types and usage, you can effectively extract meaningful insights from interconnected data, enabling comprehensive analysis and informed decision-making.