LIGHT: A Learned Join Order Selection Network Using Dynamic Graph Attention Mechanism
摘要
Join order selection is one of the key technologies in database query optimizers. Traditional approaches rely heavily on expert experiences, resulting in a prolonged development cycle. Heuristic methods based on predefined rules also fail to leverage past experiences. In recent years, reinforcement learning-based methods have emerged as a promising approach for query optimization. However, different segments of the join plan in SQL queries carry varying degrees of importance for execution latency, which can cause high variability in reward values. Such discrepancies pose challenges in generating robust and efficient query plans. This paper proposes LIGHT, a learned join order selection network that leverages a dynamic graph attention mechanism. This mechanism propagates and fuses table node vectors, allowing each node to focus on the features of its most relevant neighbors, thereby enhancing the query’s vector representation. Moreover, a beam-random search method with a weighted list is employed to retain more possibilities for exploring the best join order in reinforcement learning action selection. Finally, to mitigate reward volatility, the model introduces a logarithmic transformation to compress reward values. This accelerates the training process and promotes the generation of robust query plans. Extensive comparative experiments on the Join Order Benchmark and TPC-DS demonstrate that LIGHT significantly outperforms existing learned optimizers in terms of query execution performance.