Join optimization is the process of optimizing the joining, or combining, of two or more tables in a database.
Here is a simple join optimization algorithm (JOA) being implemented to find the lowest estimated cost join plan
for a natural chain join query using dynamic programming (DP).
Each relation should appear once.
Left Relation Join
$ python main.py --query sample
For this sample example, there are three relationships, each one with cardinality of 5, 10, 15, and R1 has foreign key to R2, R2 has the foreign key to R3. It prints a the lowest cost join tree graph:
R0 JO(5) R1 JO(5) R2
Where it indicates a join of R0 and R1 first, with an estimated cardinality of 5, then join it with R2 with a total cardinality of 5.