Cherry Picking: A Semantic Query Processing Strategy for the Evaluation of Expensive Predicates

Fábio Porto, Eduardo Sany Laber, Patrick ValduriezInfoscience 2005

Abstract

A common requirement of many scientific applications is the ability to process queries involving expensive predicates corresponding to user programs. Optimizing such queries is hard because static cost predictions and statistical estimates are not applicable. In this paper, we propose a novel approach, called Cherry Picking (CP), based on the modeling of data dependencies among expensive predicate input values as a k-partite graph. We show how CP can be easily integrated into a cost-based query processor. We propose a CP Greedy algorithm that processes the graph by selecting the candidate values that minimize query execution cost. Based on performance simulation, we show that our algorithm yields executions up to 86% faster than statically chosen pipeline strategies.

1. Introduction

Scientific database queries frequently incorporate "expensive predicates"—user-defined functions or external programs that perform complex computations, such as image analysis or sensor data processing. Traditional query optimizers typically handle these by assigning a static rank based on average cost and selectivity. However, this approach fails to account for data dependencies. For instance, if a specific data value (e.g., a geographic region) appears in multiple tuples, evaluating it once could potentially prune many rows. Static optimizers are blind to these "fanout" opportunities, leading to redundant computations.

2. The Cherry Picking (CP) Approach

The proposed Cherry Picking strategy treats query optimization as a graph problem. By modeling input data as a k-partite hypergraph (KHG), the system can identify and exploit data redundancies.

2.1 k-partite Hypergraph (KHG) Modeling

In this model, vertices represent distinct input values (e.g., a specific Region ID or City ID), and edges represent the tuples in the database. This structure allows the optimizer to visualize how a single evaluation can impact multiple rows.

Modeling data dependencies as a bipartite graph to identify fanout opportunities.

2.2 Optimization Algorithms

The authors introduce two primary algorithms:

  • KHG Greedy Algorithm: A blocking strategy that analyzes the entire dataset to calculate "fanout" for each value. It prioritizes evaluating values with the highest fanout—those that appear in the most rows and have the best cost-to-selectivity ratio.
  • Epredicate Algorithm: A pipelined, non-blocking version that uses Relative Attribute Value Cost (RAVC) to make on-the-fly decisions about which attribute to evaluate next, facilitating faster initial result delivery.

3. Experimental Evaluation

The CP approach was evaluated using synthetic datasets simulating scientific workloads with up to 100,000 tuples. Parameters such as function cost (1–10 seconds), selectivity (0.01–1), and data distribution were varied to test robustness.

4. Key Results and Insights

The core finding is that the frequency of a data value is as critical as the function's execution cost. CP effectively finds a "cover" of the hypergraph, focusing on identifying "false" results as cheaply as possible.

  • Performance Gains: The CP Greedy algorithm achieved up to an 86% speedup over the best static pipeline strategies in high-duplication scenarios.
  • Adaptability: Unlike static plans, CP adapts to data skew by looking at the actual values present in the query.
  • Pipeline Efficiency: The Epredicate algorithm outperformed the best-ranked static orders in the majority of tested scenarios, proving its viability for interactive use.

5. Conclusion and Future Work

Cherry Picking offers a significant advancement in optimizing queries with expensive predicates by leveraging data dependencies. While the KHG Greedy algorithm provides the best overall speedup, its blocking nature is a limitation for real-time applications. Future work will focus on refining selectivity estimates for the pipelined Epredicate algorithm and validating the approach on real-world scientific datasets and distributed systems.

Summary updated

BibTeX
@inproceedings{porto2005cherry,
  author = {Fábio Porto and Eduardo Sany Laber and Patrick Valduriez},
  title = {{Cherry Picking: A Semantic Query Processing Strategy for the Evaluation of Expensive Predicates}},
  booktitle = {Infoscience},
  year = {2005},
}
Figure