DPSQL+: A Differentially Private SQL Library with a Minimum Frequency Rule

Tomoya Matsumoto, Shokichi Takakura, Shun Takagi, Satoshi HasegawaarXiv 2026

TL;DR

DPSQL+ is an open-source, proxy-based SQL library that bridges the gap between formal Differential Privacy (DP) and real-world compliance by simultaneously enforcing user-level $(\varepsilon, \delta)$-DP and the "minimum frequency rule" (ensuring every released cell contains at least $k$ distinct users). By decoupling query validation from execution and integrating advanced privacy accounting alongside optimized estimators for quadratic statistics, it delivers high data utility and supports complex relational queries like JOINs across multiple database backends.

What Problem Does This Paper Address?

Exploratory data analysis using SQL often risks leaking sensitive user information through membership or attribute inference attacks. While Differential Privacy (DP) offers a mathematically rigorous defense by adding calibrated noise to query results, deploying it in production presents practical hurdles:

  1. Regulatory Compliance: Institutional data governance frameworks frequently mandate a "minimum frequency rule" (or threshold rule)—requiring that any released data group represent at least $k$ distinct individuals. Standard DP mechanisms do not inherently guarantee this noiseless threshold constraint.
  2. Architectural Rigidity & Limited SQL Support: Existing DP-SQL tools are often tightly coupled to a single database engine, fail to track cumulative privacy budgets across multi-query sessions, or struggle with complex SQL operations like JOINs.
  3. High Noise in Advanced Statistics: For higher-order quadratic statistics like variance and covariance, standard DP noise injection tends to amplify errors, rendering the results virtually useless for analysts.

DPSQL+ addresses these gaps by providing a modular, extensible proxy library that satisfies both formal DP mathematical guarantees and strict institutional suppression policies.

Methods

DPSQL+ acts as an intermediary proxy between the analyst and the underlying database engine.

Figure 1: The architecture of DPSQL+.

Its modular architecture relies on four core components:

  • Validator: Performs static analysis on incoming SQL queries to ensure they belong to a DP-safe subset (e.g., enforcing aggregate-only outputs and requiring nested subqueries to be structured as Common Table Expressions (CTEs) via the WITH clause).
  • Accountant: Tracks cumulative privacy loss across multiple queries using advanced composition techniques like Rényi DP (RDP) and Privacy Loss Distributions (PLD) to maximize the query budget.
  • Backend: Interfaces with popular engines (Spark SQL, SQLite, DuckDB) to execute the underlying data processing.

Core Algorithmic Innovations

  • Double Thresholding: To satisfy both DP and the minimum frequency rule, DPSQL+ applies a two-stage thresholding logic derived from the Gaussian sparse histogram mechanism. It checks both the exact noiseless user count against the regulatory threshold $k$, and the noisy count against a DP threshold $\tau$.
  • Two-Stage Contribution Bounding: It limits the maximum number of rows a single user can contribute to an aggregation. Crucially, it applies this bounding both before and after the thresholding step, preventing users from wasting their limited privacy budget on keys that are ultimately pruned.
  • Bézier Mechanism: For quadratic statistics (VAR, STDDEV, COVAR), the library integrates the Bézier mechanism, which constructs an optimal estimator to minimize mean squared error (MSE) for bounded range inputs.
  • Floating-Point Safety: To prevent vulnerabilities stemming from floating-point rounding behaviors, low-level noise generation is securely delegated to the OpenDP library.

Datasets

The authors evaluated DPSQL+ using the standard TPC-H benchmark database (Scale Factor = 1.0) across 10 distinct query patterns (covering scalar and grouped statistical queries).

Because the original TPC-H data exhibits negligible natural correlation between price and discount, the authors preprocessed the lineitem table by reordering the L_DISCOUNT column to introduce a synthetic Pearson correlation of approximately 0.3 with L_EXTENDEDPRICE, allowing for a meaningful evaluation of covariance (COVAR) estimation.

Key Insights and Ideas

  • The Necessity of Double Thresholding: Standard single-thresholding only checks if a noisy count exceeds a limit, which can still accidentally release cells containing fewer than $k$ true users. Checking both the exact and noisy counts provides a bulletproof way to satisfy legal compliance without violating DP.
  • Decoupled Execution Enhances Portability: By separating the privacy validation logic from the actual database execution, DPSQL+ makes it remarkably easy to add support for new SQL backends without rewriting the core privacy mechanisms.
  • Smart Accounting Multiplies Query Budgets: Rather than relying on loose, basic sequential composition bounds, embedding stateful PLD and RDP accounting directly into the system architecture drastically increases the number of queries an analyst can run before exhausting their global privacy budget.

Key Results

DPSQL+ was benchmarked against two popular baseline libraries: Qrlew and SmartNoise SQL.

  • Broader Query Support: DPSQL+ successfully executed complex relational workloads (JOIN and GROUPBY JOIN) that SmartNoise SQL cannot support. It also successfully computed VAR, STDDEV, and COVAR, which caused runtime errors or were unsupported in Qrlew.
  • Superior Accuracy for Quadratic Stats: Thanks to the Bézier mechanism, DPSQL+ consistently achieved the lowest Mean Relative Error (MRE) for higher-order statistics compared to the baselines.
  • Enhanced Privacy Budget Efficiency: As shown in Figure 3, the integrated PLD accountant allowed substantially more queries to be executed under a fixed global privacy budget than SmartNoise SQL.
Figure 3: Maximum number of queries executable with fixed per- query budget (ε, δ) = (0.1, 10−7) under two global budgets.

Limitations and Future Work

  • Query Expressiveness Constraints: To maintain robust static analysis, analysts cannot use nested subqueries in the FROM clause and must rewrite complex logic using CTEs.
  • Session-Scoped Accounting: The privacy accountant tracks budget consumption in-memory for the lifetime of the engine instance. If the system restarts, budget tracking is lost, meaning host applications must implement external state persistence.
  • Scope of Guarantee: The library focuses strictly on algorithmic privacy against output-based inference. It does not mitigate physical side-channel attacks (like timing analysis) or runtime vulnerabilities (like integer overflows).

Future Work: The authors plan to relax current query syntax constraints to improve expressiveness and develop automated privacy calibration mechanisms to reduce the operational burden on data analysts.

Summary updated

BibTeX
@misc{matsumoto2026dpsql,
  author = {Tomoya Matsumoto and Shokichi Takakura and Shun Takagi and Satoshi Hasegawa},
  title = {{DPSQL+: A Differentially Private SQL Library with a Minimum Frequency Rule}},
  year = {2026},
  eprint = {2602.22699},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2602.22699},
}
Figure