CROSS JOIN in SQL

Introduction

A CROSS JOIN combines every row from one input with every row from another. It does not normally use a relationship condition. If the first input has M rows and the second has N rows, the result contains M multiplied by N rows. This is called a Cartesian product.

SELECT c.color_name,
       s.size_name
FROM colors AS c
CROSS JOIN sizes AS s;

CROSS JOIN is powerful when every possible combination is intentionally required. It can generate product variants, calendars, reporting grids, test configurations, scenario models, comparison pairs, and missing fact rows. The same multiplication makes an accidental or poorly bounded CROSS JOIN expensive.

Basic Definition

For every row in the first input, CROSS JOIN pairs that row with every row in the second input. There is no concept of matching or unmatched populations because every possible pair qualifies.

SELECT selected_columns
FROM table_a AS a
CROSS JOIN table_b AS b;

The absence of ON is intentional. If a relationship predicate is required, INNER JOIN usually communicates that requirement more clearly.

Colors and Sizes Example

Suppose colors contains Red, Blue, and Green, while sizes contains Small, Medium, and Large. CROSS JOIN creates nine combinations.

ColorSize
RedSmall
RedMedium
RedLarge
BlueSmall
BlueMedium
BlueLarge
GreenSmall
GreenMedium
GreenLarge

Three colors multiplied by three sizes equals nine rows. Each row represents one color-size variant.

CROSS JOIN Mental Model

For each row in A
       |
       v
Pair it with every row in B

A1 -> B1, B2, B3
A2 -> B1, B2, B3

2 rows * 3 rows = 6 combinations

The database may choose different physical strategies, but the logical result contains every required combination.

Cartesian Product

Mathematically, if A contains A1 and A2 and B contains B1, B2, and B3, the Cartesian product contains (A1,B1), (A1,B2), (A1,B3), (A2,B1), (A2,B2), and (A2,B3). SQL’s CROSS JOIN implements this concept for row sources.

Row-Count Formula

Rows in ARows in BResult rows
236
10550
100202,000
1,0001,0001,000,000
10,00010,000100,000,000

Estimate this multiplication before running the query. For three inputs, multiply all three counts: A multiplied by B multiplied by C.

What If One Input Is Empty?

If either input contains zero rows, the result is empty. One hundred multiplied by zero equals zero. CROSS JOIN does not preserve rows from a nonempty side, so it is not a substitute for an outer join.

One-Row Input

When one input has exactly one row, the result count equals the other input. This is useful for attaching a one-row aggregate, configuration, or parameter set to every row.

WITH company_stats AS (
  SELECT AVG(salary) AS company_average
  FROM employees
)
SELECT d.department_id,
       d.department_average,
       c.company_average
FROM department_stats d
CROSS JOIN company_stats c;

CROSS JOIN Versus INNER JOIN

INNER JOIN returns combinations satisfying a relationship. CROSS JOIN returns every combination without a relationship condition.

-- Relationship-based combinations
FROM customers c
INNER JOIN orders o
  ON o.customer_id = c.customer_id

-- Every customer with every order
FROM customers c
CROSS JOIN orders o

The second result is rarely meaningful for customer orders because it associates unrelated entities.

CROSS JOIN Versus FULL OUTER JOIN

FULL OUTER JOIN preserves matched and unmatched rows according to a predicate. CROSS JOIN ignores matching and generates all pairs. Two one-hundred-row inputs can produce about one hundred rows under a one-to-one full join but exactly ten thousand under CROSS JOIN.

CROSS JOIN Versus UNION

CROSS JOIN combines columns horizontally into every pair. UNION appends compatible result rows vertically. They solve unrelated problems.

Old Comma Syntax

SELECT c.color_name,
       s.size_name
FROM colors c, sizes s;

Without a WHERE predicate, comma-separated sources produce a Cartesian product. Explicit CROSS JOIN is preferable because it states intent and helps reviewers distinguish deliberate combinations from a missing condition.

Filtering a CROSS JOIN

A WHERE clause can remove combinations after the Cartesian product is defined.

SELECT c.color_name,
       s.size_name
FROM colors c
CROSS JOIN sizes s
WHERE NOT (c.color_name = 'White' AND s.size_name = 'XL');

The query starts with every color-size pair and then removes an invalid business combination. When the condition is fundamentally relational, INNER JOIN may be clearer.

CROSS JOIN with Three Inputs

SELECT c.color_name,
       s.size_name,
       m.material_name
FROM colors c
CROSS JOIN sizes s
CROSS JOIN materials m;

Five colors, four sizes, and three materials create sixty variants. Add another ten-value dimension and the count becomes six hundred.

Product Variant Generation

Retail systems can generate candidate product variants by combining controlled color, size, material, and style dimensions. CROSS JOIN establishes the complete candidate space; business filters then remove impossible or unavailable combinations.

Do not assume every possible combination is sellable. A separate compatibility table may be more accurate when valid variants are sparse.

Date and Product Grid

SELECT d.calendar_date,
       p.product_id
FROM calendar_dates d
CROSS JOIN products p
WHERE d.calendar_date >= '2026-01-01'
  AND d.calendar_date <  '2026-02-01';

The result contains one row per product-day combination. It can serve as a reporting scaffold to which actual sales are LEFT JOINed.

Zero-Filled Reporting

WITH grid AS (
  SELECT d.calendar_date,
         p.product_id
  FROM calendar_dates d
  CROSS JOIN products p
  WHERE d.calendar_date >= :start_date
    AND d.calendar_date <  :end_date
),
sales_by_day AS (
  SELECT sale_date,
         product_id,
         SUM(quantity) AS quantity
  FROM sales
  GROUP BY sale_date, product_id
)
SELECT g.calendar_date,
       g.product_id,
       COALESCE(s.quantity, 0) AS quantity
FROM grid g
LEFT JOIN sales_by_day s
  ON s.sale_date = g.calendar_date
 AND s.product_id = g.product_id;

The grid creates missing product-day combinations; LEFT JOIN supplies facts where available.

Store and Product Availability Grid

Stores multiplied by products can define a complete availability matrix, but the result may be too large and may include products a store never carries. If a store_products table defines valid offerings, combine that smaller set with dates or scenarios instead of crossing all stores and products.

Calendar Expansion

A calendar dimension crossed with employees, accounts, or devices can create expected daily coverage. LEFT JOIN actual attendance, balances, or telemetry to identify missing activity. Bound the date range before crossing to avoid generating years of unnecessary combinations.

Scenario Analysis

SELECT p.product_name,
       s.scenario_name,
       p.price * s.multiplier AS simulated_price
FROM products p
CROSS JOIN pricing_scenarios s;

If scenarios contain discount, base, and premium multipliers, every product is evaluated under all three assumptions. This supports planning without changing stored product prices.

Parameter Expansion

WITH params AS (
  SELECT DATE '2026-01-01' AS start_date,
         DATE '2027-01-01' AS end_date
)
SELECT p.product_id,
       x.start_date,
       x.end_date
FROM products p
CROSS JOIN params x;

Every product receives the same one-row parameter values. Date literal syntax varies by database.

CROSS JOIN with VALUES

SELECT p.product_name,
       s.size_name
FROM products p
CROSS JOIN (
  VALUES ('S'), ('M'), ('L')
) AS s(size_name);

Supported syntax varies, but row constructors are convenient for small controlled domains that do not require a permanent table.

Test Data Generation

SELECT r.role_name,
       a.account_state,
       p.payment_method
FROM roles r
CROSS JOIN account_states a
CROSS JOIN payment_methods p;

This generates systematic role-state-payment scenarios. Add expected outcomes or filters so each combination becomes an executable test case rather than an unreviewed list.

Cartesian Testing Versus Pairwise Testing

CROSS JOIN generates complete combination coverage. Ten values across four dimensions produce ten thousand cases. Pairwise and other combinatorial methods reduce cases while covering selected interactions. Choose full Cartesian coverage only when every combination is required or the domains are small enough.

Environment and Browser Matrix

Automation teams can combine supported browsers, operating systems, locales, and account types. Before scheduling every case, remove unsupported pairs and estimate execution time. A CROSS JOIN matrix can overwhelm test infrastructure even when the SQL query itself runs quickly.

Self CROSS JOIN

SELECT a.team_name AS team_a,
       b.team_name AS team_b
FROM teams a
CROSS JOIN teams b;

With three teams, this includes self-pairs and both directional orders: A-A, A-B, B-A, and so on.

Removing Self-Pairs

SELECT a.team_name AS team_a,
       b.team_name AS team_b
FROM teams a
CROSS JOIN teams b
WHERE a.team_id <> b.team_id;

This retains A-B and B-A as separate ordered pairs while excluding A-A.

Unique Unordered Pairs

SELECT a.team_name AS team_a,
       b.team_name AS team_b
FROM teams a
CROSS JOIN teams b
WHERE a.team_id < b.team_id;

The stable less-than condition removes self-pairs and reverse duplicates. For N rows, the count is N multiplied by N minus one, divided by two.

Ordered Pair Formula

If A-to-B differs from B-to-A and self-pairs are excluded, the count is N multiplied by N minus one. Four entities produce twelve ordered pairs. This pattern supports routes, directed comparisons, and source-target testing.

Comparison Matrices

Self-crossing records can create candidate pairs for similarity or duplicate detection. Apply blocking criteria first, such as same country or first-letter group, to avoid comparing every record with every other record in a large dataset. Exact all-pairs comparison grows quadratically.

Attaching a Global Aggregate

WITH company AS (
  SELECT AVG(salary) AS average_salary
  FROM employees
)
SELECT e.employee_name,
       e.salary,
       c.average_salary,
       e.salary - c.average_salary AS difference
FROM employees e
CROSS JOIN company c;

The one-row CTE attaches the same aggregate to every employee without a relationship key.

Attaching Configuration Values

A guaranteed one-row configuration source can supply a tax rate, reporting date, or threshold to every result row. Enforce the one-row expectation. If configuration accidentally contains three rows, every business row triples.

Generating Sequence-Based Grids

Number or calendar helper tables can be crossed with entities to generate installments, forecast periods, recurring tasks, or capacity slots. Restrict the helper domain to the required range before crossing. A reusable numbers table should have clear boundaries and reliable uniqueness.

Expected Versus Actual Coverage

Create the expected domain with CROSS JOIN, then LEFT JOIN actual observations. Missing actual rows become visible as NULL and can be counted.

WITH expected AS (
  SELECT e.environment_id,
         t.test_case_id
  FROM environments e
  CROSS JOIN test_cases t
)
SELECT x.environment_id,
       x.test_case_id,
       r.execution_status
FROM expected x
LEFT JOIN test_results r
  ON r.environment_id = x.environment_id
 AND r.test_case_id = x.test_case_id;

Defining the Result Grain

Before crossing, state what one output row represents: product-month, store-product-day, role-browser, or team-pair. Every added dimension becomes part of that grain. Aggregations and downstream joins must respect it to avoid inflated totals.

Deduplicating Input Domains

If a dimension should contain unique values, verify or deduplicate it before CROSS JOIN. Two duplicate size rows produce duplicate-looking variants for every color. Prefer constraints or a deliberate distinct projection rather than hiding duplicate output later.

Filter Inputs Before Crossing

WITH active_products AS (
  SELECT product_id
  FROM products
  WHERE is_active = 1
),
report_dates AS (
  SELECT calendar_date
  FROM calendar_dates
  WHERE calendar_date >= :start_date
    AND calendar_date <  :end_date
)
SELECT p.product_id,
       d.calendar_date
FROM active_products p
CROSS JOIN report_dates d;

Reducing each domain before multiplication is one of the most effective safeguards.

Valid Combinations Versus All Combinations

CROSS JOIN creates possible pairs according to its inputs, not necessarily legal business pairs. Product-country combinations may violate regulation, store-product combinations may not be stocked, and browser-operating-system combinations may be unsupported. Apply explicit eligibility data or predicates.

Sparse Domains

When only a small fraction of combinations are meaningful, store or derive valid pairs rather than generating the full product. A store_products relationship crossed with report dates is usually much smaller than stores crossed with all products and dates.

Accidental Cartesian Products

A missing join condition can create the same multiplication as CROSS JOIN while hiding intent.

-- Likely defect: relationship condition omitted
SELECT *
FROM customers c
JOIN orders o
  ON 1 = 1;

Use explicit CROSS JOIN only when every combination is intended. Code review should challenge any unexpected Cartesian operation.

Predicting Multi-Dimensional Size

One hundred dates, one hundred stores, ten thousand products, and ten scenarios produce one billion rows. Individually small-looking dimensions can become enormous together. Record estimated counts in design reviews and set practical limits.

Intermediate Row Explosion

A later WHERE clause may return a small final result while the logical combination space remains huge. Optimizers can push safe predicates, but do not rely on them to rescue an unnecessarily broad Cartesian product. Model relationships directly and filter domains first.

CROSS JOIN and LIMIT

A row limit may allow some engines to stop early, but LIMIT does not make the full logical domain small or meaningful. Without deterministic ORDER BY, the returned combinations are not a stable sample. Use bounded source sets or an intentional sampling method.

Pagination

Pagination does not reduce the total Cartesian space. Stable ordering must include all relevant dimension keys. If users never need most combinations, redesign the query rather than paging through millions of generated rows.

Security and Tenant Isolation

An unrestricted CROSS JOIN can associate customers from one tenant with products or accounts from another. Permissions still apply, but logical cross-tenant combinations can leak context or create misleading exports. Restrict each input to the authorized tenant and include tenant-aware eligibility data.

CROSS JOIN Performance

Performance is dominated by output cardinality, row width, sorting, materialization, downstream joins, memory, and data transfer. The database cannot avoid producing required combinations merely because they are numerous. A query that returns one hundred million wide rows is expensive by definition.

Indexes and CROSS JOIN

Indexes do not reduce a true Cartesian product because every row from both inputs participates. They can help filters that reduce input domains and joins that attach facts afterward. Optimize the selected domains first rather than searching for an index that makes unnecessary combinations cheap.

Execution Plan Review

Inspect estimated and actual rows at each multiplication step, access methods, filters, sorts, spools, memory grants, spills, parallel exchanges, and downstream join growth. Estimate errors can make resource allocation poor even when the Cartesian product is intentional.

Validating Row Counts

SELECT COUNT(*) FROM colors;
SELECT COUNT(*) FROM sizes;

SELECT COUNT(*)
FROM colors
CROSS JOIN sizes;

The final count should equal the product of input counts before post-join filtering. For multiple dimensions, multiply all participating counts.

CROSS JOIN for Capacity Planning

Capacity planning often begins with a controlled set of workloads, environments, and growth assumptions. A CROSS JOIN can turn those independent dimensions into a complete planning matrix. For example, a platform team may define three traffic profiles, four deployment regions, and five instance sizes. Crossing those domains produces sixty rows that can be enriched with expected requests, memory limits, hourly cost, and measured throughput. The result makes missing scenarios visible and gives analysts a repeatable basis for comparison.

SELECT
    w.profile_name,
    r.region_name,
    i.instance_type,
    w.requests_per_second,
    i.hourly_cost
FROM workload_profiles w
CROSS JOIN deployment_regions r
CROSS JOIN instance_sizes i;

The planning domains should remain deliberately small and governed. Crossing every historical metric with every infrastructure record would create noise instead of a useful model. Treat each input as a list of approved assumptions, calculate the expected row count, and attach measured facts at the same grain. This approach supports cost estimation and performance forecasting without pretending that every theoretical combination is deployable.

Generating Fiscal Period Grids

Reporting systems frequently need one row for every business unit and fiscal period, including periods with no activity. A fiscal calendar can be crossed with the selected business units to establish that complete reporting grain before financial facts are joined. This is especially useful when fiscal months do not align with calendar months or when organizations use week-based accounting periods.

WITH reporting_grid AS (
    SELECT u.unit_id, p.fiscal_year, p.fiscal_period
    FROM business_units u
    CROSS JOIN fiscal_periods p
    WHERE p.fiscal_year = 2026
)
SELECT
    g.unit_id,
    g.fiscal_year,
    g.fiscal_period,
    COALESCE(SUM(f.amount), 0) AS total_amount
FROM reporting_grid g
LEFT JOIN financial_facts f
  ON f.unit_id = g.unit_id
 AND f.fiscal_year = g.fiscal_year
 AND f.fiscal_period = g.fiscal_period
GROUP BY g.unit_id, g.fiscal_year, g.fiscal_period;

The calendar table should contain authoritative start dates, end dates, labels, and close status rather than deriving fiscal boundaries repeatedly. Filter both units and periods before crossing them. The resulting zero-filled grid makes trend charts stable because a missing transaction no longer causes an entire period to disappear.

CROSS JOIN with Window Functions

Window functions operate after the FROM and filtering stages, so they can analyze rows produced by a CROSS JOIN without collapsing them. In a scenario matrix, a window function might rank instance sizes within each workload profile, calculate cumulative cost across regions, or compare each generated option with the cheapest option in its group. This combination is useful when the Cartesian product represents a legitimate set of alternatives.

SELECT
    w.profile_name,
    i.instance_type,
    i.hourly_cost,
    RANK() OVER (
        PARTITION BY w.profile_name
        ORDER BY i.hourly_cost
    ) AS cost_rank
FROM workload_profiles w
CROSS JOIN instance_sizes i;

The window calculation does not control the number of generated rows. It only analyzes the rows after they exist. Therefore, the same cardinality safeguards still apply. Define the partition grain carefully, avoid ranking meaningless combinations, and make ordering deterministic when equal values are possible. A stable secondary key such as instance_type can prevent inconsistent presentation between executions.

Materializing Reusable Combination Sets

Some combination grids are reused by many reports or processes. Rebuilding a large but stable product on every request can waste resources, so a team may materialize the approved combinations in a table or materialized view. Examples include supported browser-device pairs, sellable product-region combinations, and a governed reporting calendar for active stores.

Materialization changes the operational responsibility. The stored grid must be refreshed when a source domain changes, protected from duplicate rows, and validated against eligibility rules. Give the table a key that matches its grain, record effective dates where combinations change over time, and document whether removed combinations are deleted or retained for history. A scheduled refresh can compare expected and stored counts, but count equality alone is not enough; the process should also detect missing, extra, and changed combinations.

Do not materialize a Cartesian product merely to hide an inefficient query. Storage can become as problematic as repeated computation when most combinations are never consumed. Materialization is justified when the set is bounded, reused frequently, expensive to derive, and governed as meaningful business data.

Batching Large Combination Workloads

An intentional combination set may still be too large for one transaction or API call. Batch processing divides the work by a stable dimension such as date range, tenant, region, or numeric key. Each batch should produce a disjoint, restartable portion of the final result. For example, a pricing process can cross active products with one region at a time instead of generating every product-region pair in a single operation.

Choose a batch boundary that exists before the cross join and can be indexed efficiently. Record the batch identifier, input range, start time, completion time, row count, and failure state. Idempotent writes are important because a failed batch may run again. A unique constraint on the target grain can prevent duplicate combinations, while an upsert or replace strategy can make recovery predictable.

Offset-based pagination over the generated result is usually a weak batching strategy because source changes can shift rows between pages. Key-range batching or a fixed snapshot provides more reliable coverage. The goal is not merely to reduce memory use; it is to make progress observable and ensure that every required combination is processed exactly as intended.

Data Quality Checks for Input Domains

The correctness of a CROSS JOIN depends directly on the quality of each input domain. Duplicate business keys multiply downstream duplicates, inactive records create invalid scenarios, and null identifiers make matching generated rows to facts difficult. Validate domains independently before combining them. Typical checks include unique keys, required labels, active-date ranges, tenant ownership, and the absence of overlapping effective periods.

-- Detect duplicate active product keys before generating combinations
SELECT product_code, COUNT(*) AS duplicate_count
FROM products
WHERE active_flag = 'Y'
GROUP BY product_code
HAVING COUNT(*) > 1;

After the cross join, verify both cardinality and membership. Cardinality proves that the multiplication behaved as expected, while membership confirms that specific required combinations exist and prohibited combinations do not. Automated checks should compare the result with authoritative eligibility rules, especially when the generated grid feeds pricing, compliance, security, or customer-facing reports.

Operational Safeguards

Production use benefits from safeguards outside the SQL statement itself. Establish maximum accepted input counts, estimated result thresholds, query timeouts, memory limits, and monitoring for unusual row growth. A deployment pipeline can run an explain plan and reject a change when estimated cardinality exceeds an agreed boundary. Scheduled jobs can alert when a dimension grows unexpectedly, such as a configuration table increasing from ten rows to ten thousand after a faulty import.

Log the counts of each input and the generated output so incidents can be diagnosed without rerunning an expensive query. For exports, apply explicit column lists and size limits rather than selecting wide rows blindly. For recurring jobs, use a staging table and publish results only after row-count and data-quality checks pass. These controls turn the product formula into an observable contract instead of leaving it as an assumption in application code.

Resource governance does not replace query design. A timeout may stop an accidental explosion, but it cannot make an invalid grid correct. The best safeguard remains a bounded business requirement expressed through filtered, unique, authorized input domains.

When Not to Use CROSS JOIN

A CROSS JOIN is inappropriate when rows have a defined relationship that should be expressed with a join predicate. Customers and orders should normally be joined by customer ID; products and stores may need an assortment table; users and permissions should follow role assignments. Generating every pair and filtering later obscures the relationship and can produce a much larger intermediate result.

Avoid it when only a sparse subset of combinations is legal, when inputs are unbounded transaction tables, when the result has no clear grain, or when consumers need only observed facts. It is also a poor substitute for recursive sequence generation, graph traversal, or application-level workflow orchestration. Use purpose-built database features for those tasks.

The decision test is simple: can the business clearly explain why every row on one side should be paired with every row on the other? If the answer is no, model the relationship explicitly. If the answer is yes, estimate the product, bound the domains, and document the reason so future maintainers do not mistake an intentional Cartesian product for a missing join condition.

Testing CROSS JOIN Queries

Test empty inputs, one-row inputs, duplicate dimension values, excluded combinations, multiple dimensions, and expected row formulas. Verify a representative member of every domain pairs with all required members of the others. For test matrices, confirm unsupported combinations are removed and total execution cost is acceptable.

Debugging Workflow

  1. Define the intended output grain.
  2. Count and validate each input domain.
  3. Multiply counts before execution.
  4. Filter and deduplicate inputs where appropriate.
  5. Cross two dimensions at a time.
  6. Verify representative combinations and exclusions.
  7. Attach facts only after the grid is correct.
  8. Check aggregate grain and row width.
  9. Inspect the execution plan for large workloads.
  10. Reconsider the design if most combinations are discarded.

Common CROSS JOIN Mistakes

  • Failing to estimate the Cartesian size.
  • Crossing raw fact tables instead of small dimensions.
  • Assuming every generated combination is valid.
  • Forgetting that an empty input yields no rows.
  • Ignoring duplicate values in input domains.
  • Confusing CROSS JOIN with FULL OUTER JOIN.
  • Using comma syntax and accidentally omitting a relationship.
  • Blindly adding dimensions to an already large grid.
  • Using LIMIT as a substitute for a bounded design.
  • Creating cross-tenant combinations.

CROSS JOIN Best Practices

  • Use explicit CROSS JOIN syntax.
  • State the target grain before writing SQL.
  • Count and filter each input first.
  • Use small, controlled, unique dimensions.
  • Apply business eligibility rules explicitly.
  • Prefer valid-pair tables for sparse domains.
  • Generate grids before attaching aggregated facts.
  • Validate the product formula and representative rows.
  • Protect tenant and authorization boundaries.
  • Review plans and output volume for production use.

Interview Questions and Answers

What does CROSS JOIN return?

It returns every possible row combination from its inputs.

Does CROSS JOIN need an ON clause?

No. The absence of a matching condition is intentional.

What is a Cartesian product?

It is the set of all possible pairs between two sets of rows.

What is the row count for 10 and 20 rows?

Two hundred rows.

What if one input has zero rows?

The result has zero rows.

Does CROSS JOIN remove duplicates?

No. Duplicate input rows participate independently.

When is CROSS JOIN useful?

For combination grids, variants, calendars, scenarios, test matrices, pair generation, and one-row parameter expansion.

Why can CROSS JOIN be dangerous?

Row counts multiply rapidly, creating large intermediate and final results.

Quick Reference

-- Every color-size combination
SELECT c.color_name, s.size_name
FROM colors c
CROSS JOIN sizes s;

-- Unique unordered pairs
SELECT a.name, b.name
FROM entities a
CROSS JOIN entities b
WHERE a.id < b.id;

-- Three-dimensional matrix
SELECT a.value, b.value, c.value
FROM dimension_a a
CROSS JOIN dimension_b b
CROSS JOIN dimension_c c;

Core Mental Model

CROSS JOIN
= every row from A paired with every row from B

Result count
= rows(A) * rows(B) * rows(C) ...

No matching condition
= deliberate Cartesian product

First question
= how many combinations will this generate?

Key Takeaway

CROSS JOIN intentionally creates every possible combination. It is the right tool when the combination space itself is the required result, such as a product-date grid, scenario model, test matrix, or pair set.

Before execution, define the target grain, count each input, multiply the counts, remove irrelevant or duplicate domain values, and verify business eligibility. A well-bounded CROSS JOIN is useful; an unbounded one is a row explosion.