[MDEV-6038] Cache execution plans in PS and SP Created: 2014-04-07  Updated: 2023-12-07

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

Type: New Feature Priority: Major
Reporter: Sergei Golubchik Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: None


 Description   

MySQL and MariaDB never cache execution plans for prepared statements, the optimizer is run for every PS execution. Traditionally we've been saying that a table might change between two PS executions and these changes might be big enough to affect the statistics and the execution plan. But now when engine independent statistics is enabled this argument is no longer valid.

Note, the execution plan might still depend on exact values in placeholders, there are different ways of solving this issue (not cache these plans, cache the first plan, cache the "average" plan, etc).



 Comments   
Comment by Oleksandr Byelkin [ 2020-11-04 ]
  1. keep Prepare phase results (do not cleanup them)
  2. analiaze all transformation - most shoud be permanent and so we do not need rollbacks
  3. divide optimisation on permanent and depend on table content. Dependent can be:
    1. constant tables (tables with 1 or 0 records) (make additional constant propagation for it?)
    2. some range optimisations
Generated at Thu Feb 08 07:08:54 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.