Abstract:Database systems serve as the foundational infrastructure for data storage and processing, with their performance playing a critical role in the efficiency of modern society. With the advancement of memory technologies and the widespread adoption of SSDs (solid state drives), the performance bottleneck in disk-based databases has shifted towards optimizing CPU utilization and memory management. However, current database query execution often relies on interpreted methods, leading to numerous virtual function calls, context switches, and cache misses. This limits the ability of modern CPUs to fully utilize their pipelines and cache mechanisms, resulting in inefficient query execution, particularly in scenarios involving large datasets and complex queries. To address these issues, this study proposes several just-in-time (JIT) compilation optimization strategies for traditional interpreted database execution, validated through experiments on MySQL. First, an approach is presented wherein the LLVM (low level virtual machine) compiler is used to convert SQL predicates into machine code at runtime, replacing the interpretation method to reduce the overhead of virtual function calls and context switching. Next, a hybrid compilation and interpretation approach is introduced to extend the applicability of JIT execution. Finally, a query pushdown strategy is designed for pluggable database system architectures, enabling the transfer of JIT-compiled machine code to the storage engine layer to reduce unnecessary data transfer and computational overhead. Experimental results show that enabling JIT compilation significantly enhances MySQL’s query performance. Notably, for complex queries and large datasets, the JIT-compiled system reduces CPU load and memory usage, leading to substantial improvements in system response speed and throughput. In TPC-H-like tests, compared to the native MySQL version, the optimized system shows performance gains of up to 148%.