ChatPaper.aiChatPaper

LLM-R2: クエリ効率向上のための大規模言語モデル拡張ルールベース書き換えシステム

LLM-R2: A Large Language Model Enhanced Rule-based Rewrite System for Boosting Query Efficiency

April 19, 2024
著者: Zhaodonghui Li, Haitao Yuan, Huiming Wang, Gao Cong, Lidong Bing
cs.AI

要旨

クエリ書き換えは、SQLクエリの構造を変更しながらクエリ結果を変えずにより効率的なクエリを生成することを目的としており、重要な研究課題となってきました。書き換え中に元のクエリと書き換え後のクエリの等価性を維持するため、従来のクエリ書き換え手法は常に特定の書き換えルールに従ってクエリを書き換えます。しかし、いくつかの問題が依然として残っています。まず、最適な書き換えルールの選択やシーケンスを見つける既存の手法はまだ限られており、そのプロセスには多くのリソースがかかります。新しい書き換えルールを発見する手法は、通常、構造論理の複雑な証明や大規模なユーザーインタラクションを必要とします。次に、現在のクエリ書き換え手法は、しばしば正確ではないDBMSのコスト推定器に大きく依存しています。本論文では、これらの問題に対処するため、大規模言語モデル(LLM)を採用してデータベース書き換えシステムのための可能な書き換えルールを提案する、LLM-R2という新しいクエリ書き換え手法を提案します。LLMが書き換えルールを推薦する際の推論能力をさらに向上させるため、カリキュラム学習によってコントラスティブモデルを訓練し、クエリ表現を学習し、LLMのための効果的なクエリデモンストレーションを選択します。実験結果は、我々の手法がクエリ実行効率を大幅に改善し、ベースライン手法を上回ることを示しています。さらに、我々の手法は異なるデータセット間で高いロバスト性を享受しています。
English
Query rewrite, which aims to generate more efficient queries by altering a SQL query's structure without changing the query result, has been an important research problem. In order to maintain equivalence between the rewritten query and the original one during rewriting, traditional query rewrite methods always rewrite the queries following certain rewrite rules. However, some problems still remain. Firstly, existing methods of finding the optimal choice or sequence of rewrite rules are still limited and the process always costs a lot of resources. Methods involving discovering new rewrite rules typically require complicated proofs of structural logic or extensive user interactions. Secondly, current query rewrite methods usually rely highly on DBMS cost estimators which are often not accurate. In this paper, we address these problems by proposing a novel method of query rewrite named LLM-R2, adopting a large language model (LLM) to propose possible rewrite rules for a database rewrite system. To further improve the inference ability of LLM in recommending rewrite rules, we train a contrastive model by curriculum to learn query representations and select effective query demonstrations for the LLM. Experimental results have shown that our method can significantly improve the query execution efficiency and outperform the baseline methods. In addition, our method enjoys high robustness across different datasets.

Summary

AI-Generated Summary

PDF121December 15, 2024