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

要約

クエリ リライトは、クエリ結果を変更せずに SQL クエリの構造を変更することで、より効率的なクエリを生成することを目的としており、重要な研究課題となっています。
書き換え中に書き換えられたクエリと元のクエリの間の等価性を維持するために、従来のクエリ書き換えメソッドは常に特定の書き換えルールに従ってクエリを書き換えます。
しかし、まだいくつかの問題が残っています。
まず、書き換えルールの最適な選択や順序を見つける既存の方法は依然として限られており、そのプロセスには常に多大なリソースがかかります。
新しい書き換えルールを発見する方法では、通常、構造ロジックの複雑な証明や広範なユーザー インタラクションが必要です。
第 2 に、現在のクエリ リライト手法は通常、正確ではない DBMS コスト推定に大きく依存しています。
この論文では、データベース書き換えシステムで考えられる書き換えルールを提案するために大規模言語モデル (LLM) を採用した、LLM-R2 と呼ばれる新しいクエリ書き換え方法を提案することで、これらの問題に対処します。
書き換えルールを推奨する際の LLM の推論能力をさらに向上させるために、クエリ表現を学習し、LLM に効果的なクエリ デモンストレーションを選択するために、カリキュラムごとに対照的なモデルをトレーニングします。
実験結果は、私たちの方法がクエリ実行効率を大幅に向上させ、ベースライン方法を上回るパフォーマンスを発揮できることを示しています。
さらに、私たちの方法は、さまざまなデータセットにわたって高い堅牢性を備えています。

要約(オリジナル)

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.

arxiv情報

著者 Zhaodonghui Li,Haitao Yuan,Huiming Wang,Gao Cong,Lidong Bing
発行日 2024-04-19 13:17:07+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.CL, cs.DB パーマリンク