The present invention particularly relates to a
database logic plan caching method and device based on KV. The
database logic plan caching method and device based on KV parses the user
SQL request text, extracts the
user input variables, compiles and optimizes to generate a complete logic plan, generates index and
reverse index cache, and caches the logic plan; when in use, parses the subsequent received user
SQL request text, recalculates the KV constant expression with the newly extracted
user input variables, and replaces the corresponding KV value in the logic plan to generate a new logic plan; when the statistical information changes, the
reverse index is used to find the logical plan related to the change table for
elimination, the corresponding storage space is cleared, and the logic plan cache is updated. The
database logic plan caching method and device based on KV not only realizes the logic plan caching under the distributed NEWSQL database
management system, but also realizes the reuse of the logic plan of the user request
SQL, improves the access performance of the database, and reduces the loss of
system resources.