[MDEV-17858] improve optimizer_use_condition_selectivity=5 Created: 2018-11-28  Updated: 2018-11-28

Status: Open
Project: MariaDB Server
Component/s: Optimizer
Fix Version/s: None

Type: Task Priority: Major
Reporter: Sergei Golubchik Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

improve optimizer_use_condition_selectivity=5

  • use it for more than LIKE
    • basically, it could be used for any condition that is too complex to be estimated without sampling
  • use random dives, not table scan
  • get rid of optimizer_selectivity_sampling_limit
    • either continue sampling until the result converges (using some hard-coded error marging and some safety check against sampling too much)
    • or, ideally, sample as long as needed:
      • sample a little bit, say, 10 rows. the selectivity will be within some range [sel min; sel max]
      • this corresponds to two execution plans, Plan min with the cost Cost min and a Plan max with the cost Cost max
      • we don't need more precise selectivity estimates as long as the best alternative plan is outside of [Cost min; Cost max]
      • otherwise we have to sample just enough to narrow down the range until it no longer includes the best alternative plan (or until the range converges and stops shrinking)

Generated at Thu Feb 08 08:39:38 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.