Important
The SingleStore 9.1 release candidate (RC) is available now. It will be promoted to general availability (GA) soon and at that time it will be renamed to SingleStore 10.
In the interim, SingleStore 9.1 RC can be used to preview, evaluate, and provide feedback on the new and upcoming features in SingleStore 10, while SingleStore 9.0 is recommended for production workloads.
REOPTIMIZE
On this page
The REOPTIMIZE command reoptimizes the most recently profiled query based on previous executions of it.
Syntax
REOPTIMIZE [[EXPLAIN] | [COMMIT]] [<reoptimize_level>]Remarks
-
The
REOPTIMIZEcommand is used with thePROFILEcommand to look for improved query plans. -
REOPTIMIZEworks on the most recently profiled query in the current connection. -
The keyword
EXPLAINshows the explain output for the reoptimized plan. -
Subsequent
REOPTIMIZEstatements will generate differing plans (<reoptimize_).level> Refer to specific subsequent plans with the corresponding number of the order in which the REOPTIMIZEwas executed.For example, if you run REOPTIMIZEthree times consecutively on the same query profile, you can rerun the second of the optimizations by referring to its place in the order of execution, like so:REOPTIMIZE 2; -
To save a reoptimize plan to apply to a query, use the
COMMITkeyword:REOPTIMIZE COMMIT 2;After running the above statement, the query will use the plan generated the second time
REOPTIMIZEwas executed. -
Refer to the Permissions Matrix for the required permissions.
-
Refer to REOPTIMIZE MARK for automatic feedback reoptimization.
Example
PROFILE <query text>;REOPTIMIZE EXPLAIN; -- prints the explain of the reoptimized planREOPTIMIZE; -- runs the reoptimized plan as a profile;SHOW PROFILE; -- shows the reoptimized profileREOPTIMIZE; -- Runs reoptimize with the previous two executions statsREOPTIMIZE; -- Runs reoptimize with the previous three executions statsREOPTIMIZE 2; -- Runs the reoptimize plan from the second reoptimizeREOPTIMIZE COMMIT 2; -- Runs and saves the second reoptimize plan to <query text><query text>; -- Uses the committed reoptimize plan
Last modified: