Patent attributes
Techniques for reusing optimized query blocks in query processing are provided. The techniques include checking a data structure to determine whether a previously-generated query block information record corresponding to an already-processed first inner query block exists in the data structure, where the already-processed first inner query block corresponds to the first inner query block in a first state in an already-processed form. If the previously-generated query block information record exists in the data structure, then query block information is established for the first inner query block in the first state based on the previously-generated query block information record. Then a cost is determined for a semantically equivalent query that includes the first inner query block in the first state based on the query block information for the first inner query block in the first state.