| CPC G06F 16/24544 (2019.01) | 26 Claims |

|
1. A system comprising:
at least one hardware processor; and
a memory storing instructions that cause the at least one hardware processor to perform operations comprising:
receiving a first query plan corresponding to a query, the first query plan comprising a set of join nodes, and a join order hint of a target query plan, each join node of the target query plan associated with a hint;
generating a second query plan to correct a set of vertical positions of a set of terminal nodes of the first query plan following the join order hint of the target query plan, the generating the second query plan comprising:
processing the join order hint, the processing comprising:
sorting the join order hint based on an increasing order of query block identifiers; and
generating position metadata for each terminal node from the set of terminal nodes, the generating the position metadata comprising:
assigning a current height as a vertical position of a terminal node based on processing the join order hint in sorted order of query block identifiers;
incrementing the current height after assigning the vertical position to the terminal node; and
assigning a lateral position to the terminal node based on alias information from the join order hint, the lateral position indicating whether the terminal node is a left child or right child of a parent join node;
generating a third query plan to correct a set of lateral positions of the set of terminal nodes of the second query plan following the join order hint of the target query plan;
for each join node from the set of join nodes of the third query plan, indicating that each join node has been hinted;
generating, after each join node of the third query plan has been indicated as being hinted, the target query plan based at least in part on the third query plan;
in response to generating the target query plan after each join node of the third query plan has been indicated as being hinted, determining to forgo performing a cost-based optimization process for the query, the determining facilitating skipping a computationally expensive step in query compilation of the query; and
in response to determining to forgo performing the cost-based optimization, generating a final query plan, the final query plan comprising a hinted query plan based on the target query plan.
|