
The distant variety pertains to situations where the workload
undergoes signicant evolution over the long term. As shown in Fig-
ure 1, workloads from hour 9 to hour 16 access columns
𝑐
2
, 𝑐
3
, 𝑐
6
, 𝑐
8,
which is a dierent set of columns than hour 1
−
8. Distant variety
is also observed in real scenarios, and it can result from a shift in
user intent or workload evolution. For example, Bustracker queries
during weekends are more activity-related, such as users exploring
bus schedules and alternative routes for leisure activities. In the
case of App-X [
34
], queries during the market closing time are more
technology-based, such as the securities company sta perform-
ing transaction monitoring of specic stock categories. Moreover,
workload shift is observed [
23
] in MOOC
2
whenever new fea-
tures are released because more queries exploring and utilizing new
functionalities emerge.
The continual similarity and distant variety raise two questions
for learning-based index advisors.
First, existing learning-based index advisors [
17
,
18
,
31
] often
overlook continual similarity and need to implement expensive
trials to t each workload. A natural question arises: can we train the
IA with a small batch of samples and use it to directly predict indexes
for similar workloads in a certain period of time? Since workloads
in adjacent hours have common query patterns and demands, they
would benet from employing similar index selection strategies.
Here, we emphasize that directly recommending indexes for similar
workloads is non-trivial because the indexing policy is based on
accurate workload representation that captures the subtle, index-
aware dierences in similar workloads.
Second, when workloads evolve, existing learning-based index
advisors utilize only the index trials on the current workload and
discard potentially valuable historical index selection experiences
on distant workloads in the past. Can we improve the learning ef-
ciency and reduce the training overhead of index advisors by fully
exploiting historical samples on past workloads? Since machine learn-
ing models can improve themselves through training experiences,
it is plausible that with appropriate treatments, past experiences
can give the index advisor a better initialization on the current
workload, and the index advisor will converge to the optimal index
selection faster. Nonetheless, integrating historical experiences into
the current training process is challenging because of the distant
variety. Clearly, the index selection strategies need to adapt and
undergo considerable changes to cater to the varied requirements of
distant workloads. The indexing policy must be carefully designed
to transfer knowledge from past experiences without negatively
impacting the current workload.
Most RL-based index advisors take a long training time to achieve
suciently good index recommendations, primarily because they
overlook the importance of continual similarity and distant variety
in their training process. For example, SWIRL [
17
] demonstrates
the state-of-the-art eectiveness for dynamic workloads. Yet, it
still requires approximately of training duration on the TPC-H
10GB dataset. By eectively leveraging the continual similarity and
distant variety, as we will show shortly, we only need 3.3 min of
training duration to achieve the same indexing performance.
2
https://www.mooc.org/
Our Contributions. To address the above issues, we propose
BALANCE
: a transfer RL-based index advisor for dynamic work-
loads in real scenarios.
First,
BALANCE
builds separate Lightweight Index Advisors
(LIAs) on sequential chunks of similar workloads. Each LIA is
trained with a small batch of samples drawn from the chunk, in-
stead of the whole chunk (i.e., lightweight). It can provide direct
index recommendations for other workloads in the same chunk
(Section 3.2).
BALANCE
achieves comparable indexing results to
the near-optimal Extend [
32
] with less than 0
.
6% inference runtime.
Second,
BALANCE
presents a policy transfer mechanism to
adapt the current LIA from previously trained LIAs based on work-
load similarities. Thus, knowledge learned from distant workloads
is transferred without introducing noise or fusing dissimilar work-
loads, and the training eciency of reinforcement learning is im-
proved (Section 5).
BALANCE
improves SWIRL by 10
.
03% while
reducing the training overhead by 35.70% on average.
Third,
BALANCE
employs a self-supervised contrastive learning
method before training LIAs to obtain o-the-shelf workload repre-
sentations. Thus, the workload representations are obtained more
eciently without actually implementing the time-costly reinforce-
ment learning trials. Furthermore, the workload representations
reveal key characteristics of the workloads related to indexing per-
formance and enable LIAs to produce more reliable and accurate
index recommendations (Section 4). Ablation study on
BALANCE
shows that, compared with workload representations extracted
from query text [
31
], the self-supervised workload representation
can reduce workload execution cost by up to 6.6%.
2 RELATED WORK
2.1 Index Advisor
Some heuristic-based index advisors reduce a comprehensive set of
initial index candidates step by step [
3
,
37
]. These methods often
lead to excessively long runtime because many iterations are re-
quired to satisfy the specied budget [
16
]. Other works add indexes
iteratively to an empty set, where the indexes can be single-column
indexes [12] or multi-column indexes [4, 6, 32, 36].
Recently, learning-based methods based on reinforcement learn-
ing [
35
] have shown great potential in both eciency and accuracy.
Their dierence mainly lies in state representations, which can be (1)
workload-independent [
27
,
41
], e.g., treating potential index combi-
nations as tree nodes and fetching index congurations via Monte
Carlo Tree Search (MCTS); (2) query level [
18
], e.g., including the
frequency of queries; (3) column level [
30
,
31
], e.g., incorporating
a selectivity vector of each attribute; or (4) plan level [
17
], e.g.,
incorporating query operators parsed from the execution plan.
As per [
16
], heuristic methods are shown to work poorly for large
databases and complex workloads because such methods cannot
balance between high inference eciency and high index quality.
As per [
17
], Extend [
32
] produces the best workload execution cost,
and SWIRL [
17
] makes comparable workload cost reduction while
signicantly reducing inference time and training overhead.
2.2 Transfer Reinforcement Learning
Reinforcement learning faces the problem of sparse feedback and
sample ineciency, especially in high-complexity state and action
1643
文档被以下合辑收录
评论