Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`FuncDepSet.ReduceCols` is used frequently to manipulate `FuncDepSet`s. In queries with many tables, columns, and joins, it can contribute significantly to the latency of query planning, due to the `O(n²)` time complexity of calculating a transitive closure (see `FuncDepSet.inClosureOf`), where `n` is the number of dependencies in the set, and the relatively expensive `SubsetOf` set operation performed multiple times for each of the `n²` iterations. This commit optimizes the `ReduceCols` by adding a fast path that can more quickly determine if a column cannot be reduced by checking if it exists in none of the `to` sets of the functional dependencies. This avoids having to calculate the transitive closure in many cases, significantly speeding up query planning time. Release note (performance improvement): Query planning time has been reduced significantly for some queries in which many tables are joined.
- Loading branch information