This specification provides one or more embodiments of a
data query method, apparatus, electronic device, and storage medium. The method includes: during a
data query of queried data based on the compilation result of a
data query language, in response to the end of a data query for the current data unit, obtaining a first query time for the current data unit, and swapping the order of a first predicate and a second predicate in the compilation result of the data
query language, wherein the queried data includes multiple data units; in response to the end of a data query for the next data unit, obtaining a second query time for the next data unit; in response to the first query time being greater than or equal to the second query time, retaining the order of the first predicate and the second predicate in the compilation result; and in response to the first query time being less than the second query time, restoring the order of the first predicate and the second predicate in the compilation result of the data
query language.