Query planner
The accounting team's query for unresolved invoices may begin with a few customers and later serve years of records. A payment restriction might affect one customer today and most customers during a wider incident. The question still means the same thing, but the work needed to answer it can change. A choice that performed well on the initial dataset may become expensive as that dataset develops.
Applications should be able to keep their shared query definitions through those changes. Rewriting a business question for performance can obscure its meaning and give different applications different versions of the same rule. Separating the question from its execution plan lets each change for its own reason. The business defines the answer it needs, while planning addresses the cost of finding it.
Real workloads
Data volume alone does not describe a workload. The same query can behave differently for customers with different amounts of activity, even within one dataset. Frequent questions also deserve different attention from questions asked once. Measurements from actual use can reveal which improvements would matter to the application.
The adaptive query planner uses that experience to improve execution choices as the workload changes. Applications keep using the same queries and mutations while those choices develop. An improvement must preserve the meaning of the question. For mutations, faster selection must still identify the data to which the business rule applies.
The cost of learning
Learning also consumes resources that the application could use for its own work. A small improvement to a rarely used query may never repay the effort spent finding it. Adaptation therefore needs to earn its cost through useful savings. The plugin is optional, so a dataset can use ordinary query planning when further learning offers little value.
Plans as data
An accepted plan belongs with the stored definition it helps execute. A useful choice can survive a restart without changing the authored query. Plan history makes performance decisions available for examination alongside changes to the business question. Keeping a chosen plan fixed can also be useful when an application needs explicit control over further changes.