To address the classical selectivity estimation problem for OLAP queries in relational databases, a radically different approach called PlanBouquet was recently proposed in [1] , wherein the estimation process is… Click to show full abstract
To address the classical selectivity estimation problem for OLAP queries in relational databases, a radically different approach called PlanBouquet was recently proposed in [1] , wherein the estimation process is completely abandoned and replaced with a calibrated discovery mechanism. The beneficial outcome of this new construction is that provable guarantees on worst-case performance, measured as Maximum Sub-Optimality (MSO), are obtained thereby facilitating robust query processing. The PlanBouquet formulation suffers, however, from a systemic drawbackâthe MSO bound is a function of not only the query, but also the optimizer's behavioral profile over the underlying database platform. As a result, there are adverse consequences: (i) the bound value becomes highly variable, depending on the specifics of the current operating environment, and (ii) it becomes infeasible to compute the value without substantial investments in preprocessing overheads. In this paper, we first present SpillBound, a new query processing algorithm that retains the core strength of the PlanBouquet discovery process, but reduces the bound dependency to only the query. It does so by incorporating plan termination and selectivity monitoring mechanisms in the database engine. Specifically, SpillBound delivers a worst-case multiplicative bound, of $D^2+3D$ , where $D$ is simply the number of error-prone predicates in the user query. Consequently, the bound value becomes independent of the optimizer and the database platform, and the guarantee can be issued simply by query inspection. We go on to prove that SpillBound is within an $O(D)$ factor of the best possible deterministic selectivity discovery algorithm in its class. We next devise techniques to bridge this quadratic-to-linear MSO gap by introducing the notion of contour alignment, a characterization of the nature of plan structures along the boundaries of the selectivity space. Specifically, we propose a variant of SpillBound, called AlignedBound, which exploits the alignment property and provides a guarantee in the range $\mathbf {[2D+2,D^2+3D]}$ . Finally, a detailed empirical evaluation over the standard decision-support benchmarks indicates that: (i) SpillBound provides markedly superior performance w.r.t. MSO as compared to PlanBouquet, and (ii) AlignedBound provides additional benefits for query instances that are challenging for SpillBound, often coming close to the ideal of MSO linearity in $D$ . From an absolute perspective, AlignedBound evaluates virtually all the benchmark queries considered in our study with MSO of around 10 or lesser. Therefore, in an overall sense, SpillBound and AlignedBound offer a substantive step forward in the long-standing quest for robust query processing.