kb/data/en.wikipedia.org/wiki/Cartesian_explosion-0.md

19 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "Cartesian explosion"
chunk: 1/1
source: "https://en.wikipedia.org/wiki/Cartesian_explosion"
category: "reference"
tags: "science, encyclopedia"
date_saved: "2026-05-05T12:04:32.473820+00:00"
instance: "kb-cron"
---
A Cartesian explosion is an effect that occurs when applying the Cartesian product to multiple sets, which results in geometric growth in the number of outputted combinations.
== In database querying ==
This problem most often occurs in the realm of database querying in languages such as SQL. If a join operator is applied to multiple tables without specifying a join condition (such as a foreign key reference), the resulting data set ends up growing multiplicatively, producing a result that has a row count equal to the product of the row count of all tables involved in the query.
For example, if a Customers table has 5 rows and a Products table has 10 rows, running a naive SQL join query such as SELECT * FROM Customers, Products produces a result that has 5×10 (50) rows: every row in the first table is mapped to every row in the second table. If each table had thousands of rows, then doing this query would result in millions of rows of output, which may have severe performance impacts. If more than two tables are involved in the query, the impact is even more pronounced.
== References ==