Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opt: reduce planning time for queries with many joins #114623

Merged
merged 8 commits into from
Nov 17, 2023

Commits on Nov 16, 2023

  1. opt: move slow-query benchmark schemas to SQL file

    This commit moves the schemas used for slow-query benchmarks into a
    separate SQL file so that the schemas can continue to grow without
    making a mess of `bench_test.go`.
    
    Release note: None
    mgartner committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    09bab66 View commit details
    Browse the repository at this point in the history
  2. opt: add slow-query-6

    Release note: None
    mgartner committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    a16bff6 View commit details
    Browse the repository at this point in the history
  3. opt: add two reorder_join_limit cases for BenchmarkSlowQueries

    `BenchmarkSlowQueries` now runs each slow query benchmark with
    `reorder_join_limit` set to `0` and `8`. This will allow us to analyze
    the range of query optimization performance with respect to this setting
    which is commonly adjusted to reduce planning latency.
    
    Release note: None
    mgartner committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    4bf0c1d View commit details
    Browse the repository at this point in the history
  4. opt: avoid FuncDepSet.tryToReduceKey in FuncDepSet.addEquivalency

    Prior to this commit, `FuncDepSet.tryToReduceKey` was called at the end
    of `FuncDepSet.addEquivalency`. This was inefficient because
    `FuncDepSet.AddFrom` and `FuncDepSet.AddEquivFrom` can call
    `addEquivalency` multiple times, and the FD's key only needs to be
    reduced after all equivalencies and dependencies have been added. Now,
    `tryToReduceKey` is no longer called in `addEquivalency` and callers are
    responsible for ensuring that it is called. This mimics the behavior of
    the similar function `addDependency`.
    
    Release note: None
    mgartner committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    09123f2 View commit details
    Browse the repository at this point in the history
  5. opt: add FuncDepSet.addConstantsNoKeyReduction

    This commit adds a new method `FuncDepSet.addConstantsNoKeyReduction`
    which is the same as `FuncDepSet.AddConstants`, only differing because
    it not attempt to reduce the key like `AddConstants does. This allows us
    to avoid key-reducing computation in a few places.
    
    Release note: None
    mgartner committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    232dc16 View commit details
    Browse the repository at this point in the history
  6. opt: use ComputeEquivClosureNoCopy in FuncDepSet.addEquivalency

    This commit changes the invocation of `ComputeEquivClosure` within
    `FuncDepSet.addEquivalency` to `ComputeEquivClosureNoCopy`. This is
    valid because `addEquivalency` is only called with sets that have
    already been copied, so mutating the input set is safe.
    
    Release note: None
    mgartner committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    38f3953 View commit details
    Browse the repository at this point in the history

Commits on Nov 17, 2023

  1. opt: avoid ColSet allocations in statisticsBuilder.colStatJoin

    This commit reduces allocation in `statisticsBuilder.colStatJoin`.
    Previously, it was creating intersections of two sets, which, in some
    cases, were only useful for checking their emptiness. Now we use the
    `ColSet.Intersects` method which returns a boolean and does not
    build a new set.
    
    Release note: None
    mgartner committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    a0945b6 View commit details
    Browse the repository at this point in the history
  2. opt: reduce allocations in statistic builder

    This commit reduces allocations in the statistics builder by avoiding
    creating singleton column sets. A new `ColStatsMap.LookupSingleton`
    method allows columns stats for a single column to be fetched without
    building a column set and potentially allocating memory.
    
    Release note: None
    mgartner committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    97112ff View commit details
    Browse the repository at this point in the history