
approach should optimize the features to reduce the
burden of representation learning and fitting learning in
the model. Existing AI-driven cost estimation methods
utilize relatively straightforward approaches to process-
ing input query features. Typically, the one-hot encoding
for tables [12], the one-hot encoding for indexes [13],
and the vector for numerical values are directly fed
into the evaluation model in a bottom-up path of the
query. Totally, we have identified two shortcomings
regarding feature design in existing AI-driven query cost
estimators:
(1) Missing Important Features: Current meth-
ods [3] primarily focus on encoding the query plan
and the table statistics, often overlooking the impact
of other database variables on query cost. However,
variables such as the storage format of data (e.g., B+
tree or LSM tree) and the hardware of the database
also play a significant role in determining the query
cost. Our investigation, as depicted in Figure 1, demon-
strates substantial differences (2 times in TPCH and 3
times in Sysbench) in the average execution time of the
same queries under different database environments (five
database knob configurations). Therefore, neglecting the
database environment can result in significant losses
when predicting query cost.
(2) Heavy Representation Learning: Existing meth-
ods directly utilize the table feature, index feature, oper-
ator feature, etc. as the input of the AI cost model. This
brings a large burden for representation learning [14],
which is used to learn the effective representation of
input features. Specifically, with the goal of simplifying
learned model (accelerating inference time), capturing
the relationships between the large amount of features
and the query cost can be a difficult task. This intricate
logic relationship between multiple features necessitates
multiple nonlinear transformations to effectively capture.
These two questions appear to be a contradiction.
The absence of crucial features primarily results from
an incomplete modeling of the query cost estimation
problem, necessitating the incorporation of additional
features. The heavy representation learning stems from
the ineffective elements of the encoding, necessitating
the removal of some features. Nevertheless, when viewed
collectively, these issues can be categorized as feature
engineering challenges, implying that the task of query
cost estimation’s feature engineering has not been pro-
cessed optimally.
To solve the above problems, we design an effective
feature engineering for query cost estimation, called
QCFE. The core sights are as follows: (1) To avoid
missing important variables, we define a novel concept,
called feature snapshot (SF ) to integrate the charac-
teristics of ignored variables (defined as the variable
set of database knobs, storage structure, hardware and
operating system). To the best of our knowledge, no one
has attempted to encode the ignored variables for the
query cost model. One possible reason may be that the
resource required to build an exact feature representation
is tantamount to build the database environment. Hence,
we propose an estimated method to obtain the snapshot
feature, ensuring high efficiency.
(2) For the heavy representation learning, we design
a difference-propagation feature reduction (FR) method,
to relieve the learning burden by pruning the ineffective
features. Specifically, depending on the relational table
and load type, certain features may not be effective. For
instance, the plan method employs columns with the
attribute’s length to encode the index. However, in pure
write scenarios, the database management system may
not create an index, resulting in an ineffective feature
with the length of the number of columns in the query
feature. These ineffective features not only increase the
training and inference cost of the AI evaluation model
but also reduce its accuracy [15].
Totally, the specific contributions are as follows:
• In order to improve the time-accuracy efficiency,
we propose a feature engineering for query cost
estimation, called QCFE.
• We first propose the feature snapshot (in Section III)
concept for query cost estimation, integrating the
influential the ignored variables variables. Our core
goal is to make some reasonable assumptions to
calculate the feature snapshot with high time effi-
ciency.
• We design the difference-propagation feature reduc-
tion method (in Section IV) to efficiently reduce the
useless feature, further improving model training
and inference efficiency.
• To clarify the effectiveness of our QCFE, we
demonstrate various comparisons (Section V) under
extensive popular benchmarks (TPC-H, job-light,
and Sysbench), including the evaluation of time-
accuracy efficiency, the ablation of QCFE, the ro-
bustness of QCFE, etc.
II. OVERVIEW
In this section, we overview the architecture and
workflow of our QCFE.
Firstly, we show the general feature engineering which
is widely used in existing works [16], [12], [17], to
clarify the effectiveness of our QCFE. As shown in
Figure 2, the general FE directly encodes the query
2
评论