Practical Differential Privacy for SQL Queries Using Elastic Sensitivity

Noah M. Johnson, Joseph P. Near, Dawn Xiaodong SongarXiv 2017

Introduction

Differential privacy (DP) has emerged as the formal standard for protecting individual privacy in statistical databases. However, its practical application to SQL-based analytics—the backbone of modern data science—remains challenging. This paper introduces Elastic Sensitivity, a novel mechanism designed to provide strong privacy guarantees for complex SQL queries, particularly those involving joins, with minimal performance impact and high utility.

The Challenge of SQL Joins

The primary obstacle in applying DP to SQL is determining the sensitivity of a query: the maximum change an individual record can cause in the output. While sensitivity is straightforward for simple aggregations, SQL joins cause a "sensitivity explosion." A single record in one table can match an arbitrary number of records in another, potentially leading to unbounded sensitivity.

Distribution of Joins per Query

As shown in the distribution of real-world queries, many analytics tasks involve multiple joins, making traditional "global sensitivity" approaches—which assume the worst-case scenario across all possible databases—impractical due to excessive noise.

Methodology: Elastic Sensitivity and the FLEX System

To address this, the authors propose Elastic Sensitivity, a computationally efficient upper bound on local sensitivity. Unlike global sensitivity, local sensitivity considers the actual state of the database.

  1. Elastic Sensitivity Calculation: By utilizing precomputed metadata, specifically the maximum frequency of join keys, the system recursively calculates how much a join can amplify a single row's influence.
  2. The FLEX System: FLEX is an end-to-end implementation that performs static analysis on SQL queries to determine their elastic sensitivity. It then applies "smooth sensitivity" techniques to safely add Laplace noise.
  3. Architecture: FLEX is designed as a "no-mod" system that sits outside the database engine. It is compatible with standard backends like Postgres, MySQL, and Vertica, requiring only query text and basic metadata.

Empirical Analysis of Real-World Queries

The development of FLEX was informed by an extensive study of 8.1 million queries executed at Uber. This analysis provided critical insights into the requirements for a practical DP system.

Characteristics of Joins in Real-World SQL Queries

The study revealed that joins are ubiquitous, with over 60% of queries utilizing them. Crucially, 76% of these are equijoins, which are highly amenable to the Elastic Sensitivity approach. Furthermore, the majority of joins are one-to-many (64%), a pattern that FLEX is specifically optimized to handle.

Key Results and Performance

Evaluation on the Uber dataset and TPC-H benchmarks demonstrates that FLEX achieves high utility and performance:

  • Negligible Overhead: The system adds only 0.03% overhead to query execution time.
  • High Accuracy: For large datasets, the relative error introduced by DP is typically less than 10%, and often below 1%.
  • Broad Applicability: FLEX successfully provided privacy bounds for 76% of the 8.1 million queries analyzed.

Limitations and Future Directions

While FLEX represents a significant step forward, certain challenges remain. The system currently focuses on equijoins and COUNT aggregations. Extending support to non-equijoins (e.g., inequality joins) and refining bounds for SUM and AVG—which are more sensitive to outliers—are key areas for future research. Additionally, maintaining up-to-date metadata in rapidly changing databases is essential for ensuring continuous privacy guarantees.

Summary updated

BibTeX
@misc{johnson2017practical,
  author = {Noah M. Johnson and Joseph P. Near and Dawn Xiaodong Song},
  title = {{Practical Differential Privacy for SQL Queries Using Elastic Sensitivity}},
  year = {2017},
  eprint = {1706.09479},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1706.09479},
}
Figure