---
title: "Towards practical differential privacy for SQL queries (2018)"
description: "How elastic sensitivity and Flex make private SQL counts practical, with join support, real query results, and clear limits on protection."
canonical: "https://research.elamur.ai/free/en/papers/johnson-2018-practical-differential-privacy-sql-queries/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/johnson-2018-practical-differential-privacy-sql-queries/)

[home](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2018](https://md.research.elamur.ai/free/en/papers/2018/) / Towards practical differential privacy for SQL queries

# Towards practical differential privacy for SQL queries

Paper · 2018 · Noah Johnson, Joseph P. Near and Dawn Xiaodong Song

**Authors:** Noah Johnson, Joseph P. Near and [Dawn Xiaodong Song](https://md.research.elamur.ai/free/en/authors/dawn-xiaodong-song/) · **Year:** 2018 · **Venue:** Proceedings of the VLDB Endowment · **Licence:** [arXiv — non-exclusive license to distribute](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

[**257** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W3004550542) · [Proceedings of the VLDB Endowment](https://openalex.org/S4210226185) · [licence](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

- [PDF](https://arxiv.org/pdf/1706.09479)
- [DOI 10.1145/3187009.3177733](https://doi.org/10.1145/3187009.3177733)
- [arXiv 1706.09479](https://arxiv.org/abs/1706.09479)
- [OpenAlex](https://openalex.org/W3004550542)

Citations: OpenAlex, 2026-10-14.

## Deep dive: Towards practical differential privacy for SQL queries

How elastic sensitivity and Flex make private SQL counts practical, with join support, real query results, and clear limits on protection. · about 35 minutes to read

**In this deep dive**

1. [Summary](#dd-summary)
2. [Ideas worth borrowing](#dd-ideas-worth-borrowing)
3. [How Mova uses it](#dd-how-mova-uses-it)
4. [The problem and its context](#dd-the-problem-and-its-context)
5. [The method, step by step](#dd-the-method-step-by-step)
6. [Experiments and results](#dd-experiments-and-results)
7. [What the ablations show](#dd-what-the-ablations-show)
8. [Limitations](#dd-limitations)
9. [What came after](#dd-what-came-after)

### Summary

A database can reveal information about a person even when an analyst asks only for statistics. Restricting who can open the database does not control what an authorized analyst learns from it, and removing obvious identifiers does not reliably prevent re-identification. Differential privacy addresses this problem by limiting how much a released answer can depend on a protected contribution. The difficulty is making that guarantee work for the SQL queries people actually write. A join can repeat the influence of a sensitive record across many output rows, while a privacy system that requires a replacement database engine may be difficult to adopt. “Towards practical differential privacy for SQL queries” tackles these mathematical and engineering obstacles together.

The authors begin with an empirical study of 8.1 million queries written at Uber. The workload uses several database backends, complex query structures, and joins with different relationships between their inputs. Their resulting design priorities are straightforward: preserve ordinary database execution and support equijoins, where records are matched through equal column values. Their technical contribution, elastic sensitivity, estimates how much a counting query could change after a protected database record changes. It uses the query’s structure and previously collected statistics about repeated join-key values. Instead of calculating the exact sensitivity of every query, it produces a conservative bound that is efficient to obtain.

The implemented system, Flex, combines that bound with smooth sensitivity and adds Laplace-distributed noise to the database’s original answers. Smoothing is essential because a noise scale chosen directly from sensitive data could itself reveal information. The authors prove that their construction provides the stated differential privacy guarantee. Flex analyzes SQL and perturbs results around an existing database, allowing the database to execute the original query. It supports counting and histogram queries with general equijoins, including self joins and many-to-many relationships, subject to restrictions on where join keys originate.

The evaluation uses 9862 counting queries involving sensitive trip information. Flex successfully calculates elastic sensitivity for 76% of them. Its reported average runtime overhead is 0.03%, and most supported queries in the utility study receive less than 10% error under the stated privacy settings. A comparison that disables information about public tables shows that this information substantially improves utility. The findings establish a practical route to private SQL statistics, rather than a complete privacy solution for every database query. Protection is defined for individual tuples, exact answers about small populations remain difficult, some SQL features are unsupported, and repeated queries still require privacy-budget management.

### Ideas worth borrowing

Workload evidence before interface design. The authors use actual SQL activity to decide what the privacy mechanism must support. This changes the target from a convenient collection of mathematical operators to the combinations people use in practice. The presence of different database engines becomes a design constraint, while the prevalence of equijoins justifies concentrating technical effort on them. The reusable lesson is to distinguish an elegant demonstration from an interface that covers an existing workload. Similar studies can guide a query optimizer, a program analyzer, or a security tool toward the cases that determine whether adoption is realistic.

Separate conservative analysis from exact execution. Flex does not need to reproduce a database’s execution machinery. It derives a sensitivity bound from the query and lets the existing backend calculate the answer. This division works because the privacy analysis needs a safe upper bound, rather than a complete simulation of every intermediate relation. The pattern is useful whenever a property can be checked outside the system that performs the expensive computation. It also clarifies the engineering contract: the analyzer must understand enough semantics to justify its bound, while the database remains responsible for evaluating the query.

Summarize the source of amplification. For an equijoin, a record’s influence depends on how many records on the other side can share its key. Elastic sensitivity captures this through maximum-frequency statistics. These statistics are much smaller and more reusable than the underlying tables, yet they retain information directly relevant to the privacy risk. The broader idea is to identify the particular database property that drives a worst case, then summarize that property explicitly. Such summaries are valuable when inspecting all data during every analysis would be too expensive.

Track shared origins through intermediate results. A join between differently named relations may still be a self join if both relations depend on the same base table. Flex therefore carries sets of ancestor tables through its analysis. This prevents aliases and subqueries from disguising shared dependencies. The idea applies wherever a local change can propagate along several paths and later meet itself. A transparent dependency analysis should follow origins through transformations, rather than infer independence from surface names.

Treat public information as a precise exemption. Flex can tighten its bound when a joined table is public, because changes to that table do not need protection. It still accounts for the table’s ability to repeat private records through matching keys. This is a useful distinction: public information may be harmless to disclose while remaining important to the sensitivity of a computation. An exemption should remove the obligation that no longer applies, without removing other effects that the exempted object has on protected data.

Make uncertainty about utility diagnosable. The authors investigate high-error queries rather than treating all poor answers as the same failure. Their categories separate queries targeting individuals, queries whose filters isolate small groups, and queries whose join structure may produce loose bounds. That distinction matters because improving an approximation cannot eliminate privacy costs inherent in the requested statistic. In other systems that return cautious answers, a useful diagnostic should identify whether the difficulty comes from the task itself, missing information, or an overly conservative analysis.

### How Mova uses it

For Mova, the small transparent language system implemented in Rust, the clearest application would be a carefully delimited statistics interface over sensitive records. Elastic sensitivity offers a way to analyze a formal query before releasing its result. It could help Mova explain which operations amplify the influence of a protected row, which assumptions support the calculation, and why a requested statistic receives noise or is rejected. These are prospective uses. There is no established Mova implementation of Flex or elastic sensitivity to describe here.

A plausible integration would begin after a user’s request has been expressed as a supported query. The privacy calculation would operate on that query’s explicit structure. If Mova offered [semantic parsing](https://md.research.elamur.ai/free/en/concepts/semantic-parsing/) from a request into SQL, correct interpretation and correct privacy enforcement would remain separate obligations. A valid privacy bound for a query would not establish that the query captures the user’s intended question. Conversely, understanding the request would not establish that the answer is safe to release. Keeping those obligations visible would fit Mova’s emphasis on transparency.

The paper suggests what an inspectable analysis record might contain. For each relation, Mova could retain the base tables that contribute to it. For each join, it could record the equality condition, the maximum-frequency statistics used, and whether the inputs share an ancestor. The final record could distinguish the unsmoothed elastic bound from the smoothed quantity used to select noise. Such an explanation would describe the justification for a release. It should not expose protected database statistics merely to make the explanation more detailed.

A small implementation could also benefit from the system boundary demonstrated by Flex. Mova would not need to become a database engine to explore the idea. A query analyzer, a database execution interface, and a result-release component could remain distinct pieces. The difficult work would still include faithfully implementing the supported SQL semantics, maintaining valid database metrics, and ensuring that every released answer passes through the privacy mechanism. The paper supplies a reason to investigate that architecture; it does not establish that any particular Rust implementation already meets those obligations.

The tuple-level privacy definition would require an especially explicit explanation in Mova. A user might reasonably understand “private statistics” as protection for a whole person, including every record associated with them. Flex’s analysis does not automatically provide that interpretation. If a person contributes several protected tuples, Mova would need a separately justified treatment of those contributions before presenting the guarantee as person-level protection. Transparency here means stating the protected unit in language users can understand, instead of leaving it implicit in an implementation.

Histogram labels and repeated questions would also belong in the design from the beginning. Mova could use public, enumerable categories to construct a complete set of histogram bins, including categories absent from the current data. It would need another supported arrangement when labels are sensitive or cannot be enumerated. It would also need a privacy accountant for repeated releases. A system that explains each individual query clearly could still overspend its overall privacy budget if it treats questions independently.

The most useful borrowing is therefore architectural and methodological. Mova could adopt explicit query analysis, conservative bounds, visible assumptions, and careful rejection of unsupported requests. Whether it should adopt the particular elastic-sensitivity calculation would depend on its eventual data interface and query workload. The paper’s own approach supports that ordering: identify the real requirements, specify the protected contribution, and only then choose the mechanism.

### The problem and its context

#### Why ordinary database protections are insufficient

The paper starts from a tension inside organizations that hold sensitive information. Analysts need flexible access to records to investigate business questions, improve services, and detect problems. At the same time, the organization must limit privacy risks to the people represented in those records. SQL is central to this tension because it gives analysts a general way to select, combine, and summarize data.

Access control answers whether an analyst may use a database. Once access is granted, it does not by itself constrain what the analyst can infer. The authors point to insider incidents as evidence that authorized access can still lead to privacy breaches. Anonymization attempts to preserve useful data while removing identifying information, but the paper describes re-identification attacks as a reason not to rely on that strategy as a general guarantee.

Differential privacy changes the question. Instead of asking whether released records look anonymous, it asks whether the distribution of released answers changes too much when a protected contribution changes. Randomness becomes part of the release mechanism. A useful statistic should remain informative about a population while making the participation or contents of a particular protected record difficult to distinguish.

The paper argues that this promise had not yet translated into general SQL analytics. Some deployments and mechanisms concentrated on specific collection tasks or restricted classes of queries. Earlier empirical evaluations also tended to use narrowly defined workloads, such as histograms or range queries. The authors wanted to understand the consequences of privacy enforcement for diverse queries already used in an operational environment.

#### Why joins change the privacy calculation

A count over a single table has a direct relationship to the rows being counted. Joins complicate that relationship. A record from one table can match several records from another, so changing the original record can affect several joined rows. If both sides contain repeated keys, a many-to-many join can amplify this effect further.

The relevant distinction is not merely whether the query contains a join. A one-to-one relationship behaves differently from a one-to-many relationship, and a self join allows a change in a base table to affect both inputs. Nested joins can carry earlier amplification into later operations. A privacy analysis that ignores these differences may either fail to protect the data or add more noise than necessary.

Global sensitivity considers the largest possible answer change over all neighboring databases. For general joins, that quantity may lack a finite bound unless additional restrictions are imposed. Local sensitivity instead considers the actual database and its neighbors. It can be finite even when the corresponding global problem is difficult, but calculating it directly is expensive.

The authors illustrate the practical obstacle by estimating that exhaustive neighbor evaluation in their environment would require more than 1 billion query executions for each original query. A usable system therefore needs a shortcut. Elastic sensitivity supplies one by conservatively analyzing how joins propagate changed records.

#### Requirements derived from observed SQL

The workload study covers 8.1 million queries submitted at Uber between March 2013 and August 2016. The underlying information includes trips, riders, drivers, and customer support activity. Queries serve several operational purposes, which makes the study broader than an evaluation built around a single statistical task.

The authors observe more than 6 database backends, including Presto, Hive, MySQL, and Postgres. That observation motivates compatibility with existing infrastructure. Requiring a special execution engine would exclude environments where different backends serve different performance and scaling needs.

SQL joins appear in 62.1% of the workload. Equality-based matching accounts for 76% of join conditions, and a separate analysis finds that 65.9% of queries containing joins use only equijoins. The workload also contains multiple joins, self joins, and each major relationship between joined keys. Some queries reach 95 joins. These observations motivate support for arbitrarily nested equijoins rather than a small collection of join templates.

Aggregation appears in 34% of all queries. The paper restricts its main target to this statistical portion of the workload and concentrates on counts, the most common aggregation described in the study. Queries returning raw records present a different problem and fall outside the work’s scope.

The workload is also syntactically and operationally varied. Most queries contain fewer than 100 clauses, but some contain thousands. Outputs may contain hundreds of thousands of rows across hundreds of columns. A practical approach must therefore avoid assuming that useful SQL consists only of short expressions with tiny outputs.

#### What earlier mechanisms offered

The paper evaluates earlier approaches against these requirements. PINQ supports private counting through an augmented query language, but its join behavior groups matching keys. For relationships with repeated keys, this can count distinct join keys rather than preserve the ordinary SQL count of matching results. Its additional operators also prevent direct compatibility with standard database execution.

wPINQ extends that approach by attaching weights to records and reducing weights during joins. This controls sensitivity while allowing more general equijoins. The tradeoff is that weights must be carried through computation. The implementation described in the paper uses a dedicated runtime, and an existing database would need changes to propagate those weights.

Restricted sensitivity relies on constraints that bound key frequencies over all permitted databases. A unique key can provide such a bound for the appropriate side of a join. Many-to-many relationships are harder because neither side necessarily has a globally bounded repetition count. The authors also note the absence of an implementation demonstrating compatibility with existing databases.

DJoin addresses a distributed setting involving several parties. It expresses joins through intersections and consequently supports one-to-one relationships instead of the general multiplicities of ordinary joins. It also needs cryptographic operations during execution. These are meaningful solutions to their respective settings, but they do not jointly meet the paper’s database-compatibility and broad-equijoin requirements.

Other related systems cover different boundaries. Fuzz handles private functional programs but lacks support for the relevant multiplicities of joins. Airavat supports MapReduce computations while requiring analyst-supplied output bounds. Sample-and-aggregate approaches partition data before combining results, which the paper argues disrupts join semantics. Elastic sensitivity is positioned as a complementary contribution: a tractable way to bound local effects for the SQL operations that dominate the observed workload.

### The method, step by step

The method has two connected layers. Elastic sensitivity analyzes how a protected change could propagate through a query. Flex turns that analysis into a private release by smoothing the bound and selecting an appropriate noise distribution. The database itself continues to evaluate the original SQL.

From an ordinary SQL query to a private release The steps in order.

#### Specify neighboring databases and the protected contribution

The mathematical setup represents a database as a vector whose entries contain tuples. Neighboring databases differ in a protected entry. For the multi-table setting, the authors treat the tables as disjoint portions of the same overall collection of tuples.

```
d(x, y) = |{i : xᵢ ≠ yᵢ}|
```

Here, x and y are databases, i identifies an entry, and xᵢ and yᵢ are the tuples stored at that entry. The vertical bars count the positions where the contents differ. The distance d therefore measures how many entries have changed.

The paper uses bounded differential privacy: a neighboring database is formed through a tuple change, rather than by changing the number of tuples. In the multi-table interpretation, the changed tuple belongs to a selected table. This choice matters when translating the mathematical guarantee into an operational claim. The protected unit is a tuple, and the paper explicitly cautions that a person may contribute more than one.

The formal privacy condition limits how different the release probabilities can be for neighboring inputs.

```
Pr[K(x) ∈ S] ≤ e^ε Pr[K(y) ∈ S] + δ
```

K is the randomized release mechanism, and S is any set of possible released outputs. Pr denotes probability over the mechanism’s randomness. The databases x and y are neighbors. The parameter ε controls the multiplicative allowance between output probabilities, while δ supplies the additive allowance. The inequality must hold across the relevant neighboring inputs and output sets.

The condition concerns the mechanism as a whole. It is not a statement that every noisy answer is close to the true answer. Privacy and numerical accuracy are different properties, and the evaluation measures utility separately.

#### Distinguish global sensitivity from local sensitivity

Sensitivity measures how strongly an answer can respond to a protected change. Global sensitivity searches across every neighboring pair in the permitted database space.

```
GS_f = max_{x,y : d(x,y)=1} ‖f(x) − f(y)‖
```

The function f is the query, and GS_f is its global sensitivity. The norm measures the size of the output change, including when an output contains several values. The maximization ranges over neighboring databases x and y.

For joins, considering every possible database can produce an unusably large or unbounded result. Local sensitivity fixes the actual input and searches only its neighbors.

```
LS_f(x) = max_{y : d(x,y)=1} ‖f(x) − f(y)‖
```

LS_f(x) is the local sensitivity of f at database x. The database y ranges over neighbors of x. Unlike global sensitivity, this quantity depends on the particular data being analyzed.

The paper also uses stability to describe transformations that produce relations rather than final numeric answers. A transformation is stable when its effect on changed rows can be bounded. Local stability fixes the actual database, making it the relational counterpart of local sensitivity. This distinction lets the analysis follow a query through selections, projections, and joins before it reaches a count.

Smoothing requires information beyond the immediate neighborhood.

```
A_f⁽ᵏ⁾(x) = max_{y : d(x,y)≤k} LS_f(y)
```

The quantity A_f⁽ᵏ⁾(x) is the greatest local sensitivity encountered within distance k of x. The symbol k describes how far the surrounding database may differ from the true one. This broader envelope is what the elastic analysis must safely dominate.

#### Collect the statistics that bound join multiplicity

For each relevant join column, the analysis needs the largest frequency of any value in that column. If a key value occurs repeatedly, a matching record from another relation can be repeated that many times in the join output.

The paper denotes this maximum frequency by mf. It is collected through an ordinary database query that groups records by the column, counts occurrences, and selects the largest count. This collection happens separately from enforcement for an individual analyst query. The statistics can then be reused.

The base-table bound grows with distance from the current database.

```
mf_k(a, t, x) = mf(a, t, x) + k
```

The symbol a denotes an attribute, t is a base table, and x is the actual database. The observed maximum frequency is mf(a, t, x). Its distance-k upper bound is mf_k(a, t, x). The added k allows for changed entries that could increase the frequency of a popular value.

For intermediate relations, the analysis propagates maximum-frequency bounds through the query. A join can increase how frequently an attribute value appears because each row carrying that value may acquire several matches. The proof bounds this effect by multiplying appropriate frequency bounds from the inputs.

Selections and projections receive conservative treatment. A filter can remove matching records, but the analysis does not assume that it removes enough to improve the bound. Projection preserves the relevant row-count argument in the paper’s relational treatment. This makes the analysis simple and safe, while also explaining why restrictive queries may receive loose estimates.

#### Analyze relational structure and shared ancestors

Flex builds on the Presto SQL parser. After [parsing](https://md.research.elamur.ai/free/en/concepts/parsing/), it resolves aliases and performs dataflow analysis over the query structure. The analysis carries maximum-frequency information and sets of ancestor tables through intermediate expressions.

The ancestor set records which original tables may contribute records to a relation. A join is treated as a self join when its inputs share an ancestor. This includes cases where different aliases or subqueries eventually refer back to the same underlying table.

That distinction determines which changes can occur together. If the inputs come from disjoint base tables, changing a protected tuple affects one input or the other. If they overlap, the same underlying change may affect both sides. The latter case needs additional terms in its bound.

Let E_R⁽ᵏ⁾ denote elastic stability for a relation at distance k. A base table has the paper’s unit stability. For a non-self equijoin, the recurrence chooses the larger possible effect from changing either input.

```
E_R⁽ᵏ⁾(r₁ ⋈_{a=b} r₂, x) = max(mf_k(a,r₁,x) E_R⁽ᵏ⁾(r₂,x), mf_k(b,r₂,x) E_R⁽ᵏ⁾(r₁,x))
```

The relations r₁ and r₂ are joined where attribute a equals attribute b. The symbol ⋈ denotes that join. The first product bounds changes entering through r₂ and being repeated by matching keys in r₁. The second product treats the opposite direction. Because the ancestor sets are disjoint, the recurrence takes the maximum instead of assuming both inputs change together.

For a self join, both inputs may change, and changed records may also match each other.

```
E_R⁽ᵏ⁾(r₁ ⋈_{a=b} r₂, x) = mf_k(a,r₁,x) E_R⁽ᵏ⁾(r₂,x) + mf_k(b,r₂,x) E_R⁽ᵏ⁾(r₁,x) + E_R⁽ᵏ⁾(r₁,x) E_R⁽ᵏ⁾(r₂,x)
```

The symbols retain the same meanings. The first two products account for changed records on one side matching existing records on the other. The final product accounts for matches between changed records from both sides. This recurrence is more expensive in sensitivity because shared origins create additional paths of influence.

The elastic stability of a final count is inherited from the relation it counts. A grouped count produces a histogram. Under the bounded-change setting, a changed contribution can affect different bins, so the paper uses an additional factor in the histogram bound.

```
E⁽ᵏ⁾(Count_G(r), x) = 2 E_R⁽ᵏ⁾(r, x)
```

E⁽ᵏ⁾ is elastic sensitivity for the final query, Count_G is a count grouped by attributes G, and r is its input relation. The factor 2 accounts for the histogram effect described in the proof. This is why a grouped count cannot simply reuse the scalar-count rule without adjustment.

The supported algebra includes selections, projections, equijoins, counts, and grouped counts. Aggregation may occur inside a query under the paper’s stated restrictions, including the restriction against arbitrary modifications of aggregate results. Join conditions may also include extra conjunctive predicates. The equality term supplies a usable upper bound because additional constraints can remove matches without creating more of them.

#### Use public tables without ignoring their multiplicities

If a joined table is genuinely public, its records do not need the same protection as private records. Flex can then avoid treating changes to that public table as protected possibilities.

This does not make the public table irrelevant. If its join key repeats, it can still duplicate records from the private input. The optimized bound therefore multiplies the private relation’s stability by the public table’s maximum join-key frequency.

The cities table supplies the paper’s motivating example of public information. The designation is specific to the application. A table should not receive this treatment merely because its contents seem ordinary; the privacy argument depends on the table being outside the protected information.

#### Follow the graph-triangle example

The worked example counts triangles using repeated references to an edges table. Its SQL joins edges through source and destination columns and adds ordering conditions. The repeated use of the same base table makes it a demonstration of the self-join recurrence.

For the ca-HepTh dataset, the example uses a maximum-frequency statistic of 65 and sets ε to 0.7. Applying the recurrence to the initial self join yields the expression reported by the authors.

```
E_R⁽ᵏ⁾(e₁ ⋈ e₂, x) = (65+k) + (65+k) + 1 = 131 + 2k
```

The names e₁ and e₂ are aliases of the edges table, and k remains the distance from the actual database. The terms involving 65 reflect possible matches through the relevant edge attributes. The remaining term comes from changes that can meet across the self join.

The next join reuses the edges table again. Propagating the earlier bound produces the final elastic-sensitivity polynomial.

```
E⁽ᵏ⁾(q,x) = (65+k)(131+2k) + (65+k) + (131+2k) = 2k² + 199k + 8711
```

The symbol q denotes the triangle-counting query. The polynomial describes its bound as a function of distance k. These coefficients are the paper’s worked calculation, not measurements of observed answer error.

The example shows why analysis must retain more than a single sensitivity value. The mechanism needs to know how the bound can increase in nearby databases before selecting a safe scale for noise.

#### Smooth the data-dependent bound

Elastic sensitivity is not itself the final release rule. Because it depends on the data, using it directly as a noise scale could disclose information. Flex instead combines distance-dependent elastic sensitivity with exponentially decreasing weights.

```
β = ε / (2 ln(2/δ))
```

The parameter β controls the rate of exponential decay. The privacy parameters are ε and δ, and ln is the natural logarithm.

```
S = max_{k=0,1,…,n} e^(−βk) E⁽ᵏ⁾(q,x)
```

S is the smoothed bound, n is the database size, and E⁽ᵏ⁾(q,x) is the query’s elastic sensitivity at distance k. The maximization searches the permitted distances. The exponential factor discounts increasingly distant databases while retaining enough information about them to support the privacy proof.

Flex then perturbs the original answer.

```
Release = q_ℓ(x) + Lap(2S/ε)
```

The term q_ℓ(x) is the query result for the specified histogram labels ℓ, or the corresponding supported counting output. Lap denotes noise drawn from a Laplace distribution with the indicated scale. S is the smoothed bound, and ε is the privacy parameter used in the mechanism.

In the triangle example, δ is 10⁻⁸. The authors report S as 8896.95, reached at k equal to 19. Their resulting Laplace scale is written as 17793.9 divided by 0.7. The example demonstrates the complete path from join frequencies to a release scale; it does not establish that triangle counts generally have low error.

The correctness argument proceeds through upper bounds. The authors first establish that their propagated frequency estimates dominate possible frequencies in nearby databases. They then show that elastic stability dominates local relational effects, including the separate self-join cases. This yields the main sensitivity inequality.

```
A_q⁽ᵏ⁾(x) ≤ E⁽ᵏ⁾(q,x)
```

The left side is the actual local-sensitivity envelope for query q within distance k. The right side is the computable elastic bound. The inequality permits a privacy mechanism to use the approximation safely even when it is loose. Combining it with the cited smooth-sensitivity results gives Flex’s stated differential privacy guarantee.

#### Avoid searching every possible distance

The definition of S ranges up to database size, which would be inefficient on a large database. Flex uses the form of elastic sensitivity to shorten that search.

The authors establish that elastic stability is a polynomial in k with non-negative coefficients. Its degree is bounded using the number of joins.

```
degree(E_R⁽ᵏ⁾(r,x)) ≤ j(r)²
```

The function j(r) counts joins in relational expression r. The degree is the largest power of k needed by the elastic-stability polynomial. The bound connects the smoothing search to query structure rather than directly to database size.

The polynomial increases with distance, while the smoothing multiplier decreases exponentially. Beyond the paper’s derived cutoff, the product cannot increase.

```
k > j(r)² / β ⇒ S(k) is non-increasing
```

Here, S(k) is the exponentially weighted elastic bound at distance k. The symbols j(r) and β retain their earlier meanings. This result makes it sufficient to search a query-dependent range rather than continuing through every possible database distance.

#### Account for histogram labels and repeated releases

A histogram reveals more than its numeric counts. The appearance of a label can disclose that some corresponding data exists. Flex therefore assumes a specified set of labels rather than returning only categories observed in the private data.

For public labels drawn from a finite, enumerable domain, Flex can build that set automatically. It includes missing categories with a true count of 0 before applying noise. City names and product categories are examples discussed by the authors. If the labels are protected or cannot be enumerated, the analyst must supply them under the supported arrangement.

The paper also explains how elastic sensitivity could support propose-test-release. An analyst proposes a sensitivity threshold b, and the system finds the earliest distance where the elastic bound reaches that threshold.

```
k* = argmin_k {E⁽ᵏ⁾(q,x) ≥ b}
```

The symbol k* is the selected distance, q is the query, and b is the proposed bound. The system adds Laplace noise to the distance test and checks it against a threshold based on ln² n. If the test passes, it releases an answer with noise scaled using b. This is an alternative use of the sensitivity analysis, distinct from the smooth-sensitivity mechanism evaluated as Flex.

Finally, a sequence of private answers needs accounting across the sequence. Flex leaves the specific strategy open. The paper discusses basic composition, stronger composition bounds, and workload-oriented approaches that could use Flex as a lower-level counting interface. The absence of a prescribed accountant is a system boundary, not an exemption from cumulative privacy loss.

### Experiments and results

#### Workload coverage and runtime

The main evaluation dataset contains 9862 queries executed during October 2016. The authors selected counting queries, including histograms, that examined sensitive trip data. They retained the original answers so that noisy outputs could be compared with the non-private results.

The implementation runs with Java 8 on Mac OSX. The test machine has a 2. An Intel Core i7 running at 2 GHz, paired with 8GB of memory. These conditions describe the reported implementation measurements; the study does not establish that every deployment will have the same absolute timings.

Flex calculates elastic sensitivity successfully for 76% of the evaluation queries. Unsupported query structures account for 14.14% of the workload. Parsing failures account for 6.58%, and the remaining error category accounts for 3.21%. The parser failures are attributed to gaps in coverage of the SQL dialects present in the workload. Expanding grammar support could address those failures, whereas mathematically unsupported operations require more than a parser change.

The average parsing-and-analysis cost is 7.03 milliseconds per query. Result perturbation adds an average of 4.86 milliseconds. Database execution averages 42.4 seconds, leading to the reported 0.03% overhead. The practical finding is that analysis and perturbation are inexpensive relative to the database work in this workload.

That measurement should be read alongside the architecture. Maximum-frequency collection is a separate task, and those metrics must remain valid as data changes. The runtime result concerns the query-processing path evaluated by the authors; it does not make metric maintenance unnecessary.

#### Utility across different populations

The authors define a query’s population size as the number of distinct trips involved in producing its answer. This measures how narrowly a query targets the underlying data. A query over a small group has fewer contributions over which the effect of an individual record can be diluted.

For each output cell, the evaluation measures relative percent error against the original answer. It then summarizes a query by the median of its cell errors. A histogram therefore contributes a single median-error measure even though its bins may differ in population and difficulty.

The principal utility experiment sets ε to 0.1 and uses the following expression for δ.

```
δ = n^(−ε ln n)
```

The symbol n is the database size, ε is the selected privacy parameter, and ln denotes the natural logarithm. This is the parameterization stated for the experiment.

The authors report results separately for queries containing joins and queries without them. In both groups, median error generally falls as population size rises. Their main utility conclusion is that a majority receive error below 10%, with broadly comparable magnitudes across the groups.

There is also a higher-error cluster among join queries. These queries contain many-to-many joins involving private tables and receive no benefit from the public-table optimization. The error trend still improves with population size. For populations larger than 5 million, the reported median error falls below 10%.

The paper relates this pattern to scale-ε exchangeability, a term from earlier evaluation work. The relevant observation is that increasing the population can improve utility under a fixed privacy setting. The experiments support that behavior for the evaluated queries; they do not imply that every SQL expression will become useful under every available dataset size.

#### A separate SQL benchmark

The authors repeat the utility analysis using TPC-H. This benchmark provides synthetic business data distributed across 8 tables and a workload of 22 SQL queries. The database is populated using the default scale factor of 1.

The evaluation selects the counting queries, described as five queries, including three with joins. These include grouped aggregation and features such as filters, ordering, and subqueries. Queries that return raw records or use other aggregation functions are excluded from this experiment.

Customer- and supplier-related tables are treated as private. The metadata tables region, nation, and part are public. The privacy settings match the earlier experiment, with ε equal to 0.1 and δ defined through the same database-size expression.

The reported trend again connects larger populations with lower error. Queries with more joins tend to have higher error. This experiment broadens the evidence beyond the operational trip-data workload, but it remains a selected counting subset of TPC-H instead of an evaluation of its complete query set. The paper names an accompanying release of experiment code and data.

#### Privacy budget and the public-table optimization

For later experiments, the authors exclude queries whose population size is below 100. They explain that such queries are inherently difficult to answer accurately while protecting individual information. The restriction changes the population to which the subsequent utility percentages apply.

The privacy-budget experiment evaluates ε values of 0.1, 1, and 10. Larger ε values produce lower median error, as expected from the mechanism’s noise scaling. At ε equal to 0.1, roughly half of the retained queries have median error below 1%; the reported share is 49.8%.

The public-table comparison holds the general setup fixed and enables or disables the optimization. Its effect is summarized below.

Real counting queries, share with median error below 1.0% Recognizing public tables moves more queries into the highest-utility group.

**The numbers**

| System or setting | queries % |
| --- | --- |
| Flex with public-table optimization disabled | 28.5 |
| Flex with public-table optimization enabled (this paper) | 49.8 |

The optimization applies to 23.4% of the evaluation queries. The authors report that much of the improvement comes from queries previously in the group with error greater than 100%, while intermediate error groups change relatively little. The benefit is therefore concentrated among queries for which treating public data as protected would create a particularly costly bound.

#### Comparison with wPINQ

wPINQ is the comparison mechanism because it supports the relevant range of equijoin relationships. Its programs are written in C#, so the authors do not run it directly over the entire SQL dataset. Instead, they choose representative patterns and manually translate selected queries.

They identify common patterns separately for histogram and non-histogram counts. The six selected queries represent 8.6% of join patterns in the workload. The input includes the public cities table and random samples of 1.5 million records from each private table. Downloading the complete private tables, containing over 2 billion records, was not feasible.

Each wPINQ program runs 100 times. The comparison uses ε equal to 0.1, computes non-private reference answers on the sampled data, and collects Flex’s frequency metrics from that same sample. Public-table joins receive special treatment in wPINQ so that the comparison does not unnecessarily protect public records.

Flex has lower median error for programs 1, 2, 3 and 6. The reported improvement is more than 90% for programs 2 and 3 and nearly 50% for programs 1 and 6. wPINQ performs better for programs 4 and 5. Both mechanisms exceed 900% error for program 5, whose median population size is 1.

The comparison therefore supports a qualified conclusion: Flex can preserve useful accuracy while retaining ordinary database execution, but it does not dominate wPINQ on every selected query. The authors do not evaluate the additional synthetic-data post-processing discussed in the wPINQ work because that procedure is not automated.

### What the ablations show

#### Public-table information explains a substantial utility gain

The clearest component ablation is the public-table experiment. The same general evaluation procedure is run with the optimization enabled and disabled. This isolates the effect of recognizing that some joined relations do not require protection.

Its significance is broader than the improvement in the highest-utility group. The mechanism changes which neighboring modifications it must consider. If a table is public, the analysis need not protect against changes to it, but it must still account for how its keys duplicate private rows. The result demonstrates the practical value of making the protection boundary explicit.

The concentration of improvements among previously high-error queries is also informative. A conservative analysis can be disproportionately expensive when it includes hypothetical changes that the application does not require it to protect. Correctly removing those possibilities can alter the usable range of the system, rather than merely polish already accurate answers.

#### Join comparisons test the central design objective

The split between queries with joins and those without joins is an analysis rather than a matched ablation. The groups contain different queries, so their comparison does not isolate the causal cost of adding a join to an otherwise unchanged expression.

It nevertheless addresses the paper’s principal engineering objective. The similar relationship between population size and error indicates that join support does not automatically destroy utility. The separate higher-error cluster shows where that broad success has limits: many-to-many joins on private data can create large frequency-based bounds.

The TPC-H analysis adds another setting in which that pattern can be inspected. It offers evidence that the method is not useful only for a single organization’s query conventions. Its selected query subset, however, is too narrow to establish general behavior across all benchmark operations.

#### High-error inspection separates different causes

The authors manually examine a random sample of 50 high-error queries. They classify 8% as using information specific to individuals in a filter or histogram grouping. Such queries may directly request information about a driver or another narrowly identified subject.

A further 72% are categorized as statistics over small populations created by filtering or grouping. These queries need not explicitly name a person. A combination of conditions can still leave a group whose answer depends heavily on very few records. This explains why filtering out queries with total population below 100 does not remove every difficult output.

The remaining 20% involve many-to-many joins with large maximum-frequency statistics and no applicable public-table benefit. Here, the bound itself may be a substantial source of error. These queries are not necessarily intrinsically as sensitive as the elastic estimate suggests.

That distinction matters for future improvements. The first categories illustrate the privacy cost of the question being asked. The last category suggests an opportunity for tighter analysis. The study does not measure exact local sensitivity for those queries, so it cannot quantify how much of their error a better bound would remove.

#### Budget variation and baseline comparison answer different questions

Varying ε tests the expected tradeoff between privacy parameters and utility. It confirms that the mechanism’s practical behavior changes in the anticipated direction. It does not establish that increasing ε is the appropriate response to every inaccurate query, since that choice also changes the guarantee.

The wPINQ comparison examines an alternative way to control join sensitivity. Its mixed outcomes show that preserving SQL execution and using local bounds can be competitive with weighted computation, while also exposing queries where the bound is less favorable.

There is no experiment that replaces elastic sensitivity with exact local sensitivity across the operational workload. As a consequence, the paper establishes soundness mathematically and usefulness empirically, but does not provide a workload-wide measurement of the approximation gap.

### Limitations

#### The authors’ stated limits on supported queries

The main mechanism does not handle arbitrary non-equijoins. A condition comparing one column as greater than another cannot be bounded using equality-key frequencies alone. The authors explain that supporting such operations would require different information, potentially collected from the database for each query.

That would change an important engineering property. The current analysis reuses precomputed summaries and avoids additional database interactions during sensitivity enforcement. Extending the query language may therefore require a different balance between coverage and overhead.

Join keys must also come directly from original database columns. The paper illustrates a rejected structure in which subqueries compute counts and then use those computed values as join keys. Maximum-frequency metrics for original columns do not describe those newly produced values.

The workload study finds that 98.5% of joins satisfy the original-column criterion. This supports the practical relevance of the restriction in that environment, but it does not remove it. A workload built around computed keys could behave differently.

The core evaluation concerns counts and histograms. Other aggregations are discussed as extensions, rather than demonstrated with the same operational evidence. It would be inaccurate to read the SQL framing as a claim of support for every SQL aggregation.

#### Proposed aggregation extensions have different utility prospects

For sums and averages, the authors introduce an allowed value range for a column. This range is the difference between its permitted maximum and minimum. It must be enforced, rather than merely estimated from the current data, for the associated guarantee to hold.

```
E⁽ᵏ⁾(Aggregate_a(r),x) = Range(a,r) E_R⁽ᵏ⁾(r,x)
```

Aggregate_a denotes the proposed sum or average over attribute a in relation r. Range(a,r) is the enforced allowed range, and E_R⁽ᵏ⁾ is the relation’s elastic stability. The formula combines how many contributions may change with how much an affected contribution may matter.

The authors expect a favorable case for sums without join amplification. With joins, the bound assumes that duplicated contributions can take worst-case values. That may substantially overstate the actual change.

For averages, the proposed bound does not capture the usual reduction in influence as more records contribute. The paper suggests that an additional lower bound on the number of averaged records could help. Obtaining that information would require further query analysis and more database metrics.

Maximum and minimum have a different difficulty. The permitted range bounds their sensitivity, but extreme values can remain highly revealing. The authors describe robust alternatives from earlier work while noting that those alternatives do not fit their standard-SQL compatibility target. These discussions define research directions, not completed extensions with reported performance.

#### Metric validity is a continuing obligation

The authors explicitly warn that maximum-frequency statistics must be refreshed when relevant frequencies change. Reusing an outdated value that is too small can invalidate the privacy argument.

The architecture is therefore particularly suitable when queries occur much more often than updates. Database triggers are suggested as a possible way to maintain metrics under frequent changes. The evaluation does not establish the maintenance cost or operational reliability of that approach across update-heavy deployments.

A careful reader should consequently distinguish inexpensive query-time analysis from inexpensive total deployment. The reported overhead supports the former in the tested workload. The latter also depends on collection, updates, integration, and the correctness of the surrounding release path.

#### Tuple protection does not automatically protect a whole person

The authors state this limitation directly. Their neighboring relation protects changes to individual tuples. If someone contributes several tuples, the guarantee cannot simply be relabeled as protection for all information about that person.

This is especially important when the data contains repeated activity, such as trip records. Population size in the evaluation counts unique trips. It does not establish a bound on how many records any person contributes or demonstrate a separate person-level mechanism.

The bounded replacement setting is another part of the formal contract. A deployment must align its interpretation of neighboring databases with the proof it uses. Informal language about participation should not obscure what changes the mechanism was actually analyzed to protect.

#### Histogram outputs need a supported label policy

The authors explicitly identify bin enumeration as necessary to avoid disclosure through output structure. Returning a label only when private data contains it can leak information even if its accompanying count is noisy.

Automatic enumeration is limited to finite domains whose labels are non-protected. Other cases require analyst-specified labels within the supported mechanism. This constrains the convenience of unrestricted `GROUP BY` queries, particularly when the grouping attribute itself contains sensitive values.

A careful reader should also note that a useful median error does not describe every bin. The evaluation takes the median across output cells. Some bins can therefore have poor utility even when the query’s median appears favorable. The high-error inspection reinforces this distinction between a query’s overall population and the smaller groups within its output.

#### The evidence has a defined scope

The authors regard their large operational workload as representative of broader SQL use. Its size and variety support a serious practical test, but the main workload still comes from one organization. The additional TPC-H experiment provides another domain, while remaining restricted to selected counts.

The 76% analysis success rate also matters. Utility conclusions concern queries for which the mechanism can produce supported results; they should not be read as evidence that all submitted queries can be answered privately by Flex. Parser improvements could broaden coverage, but unsupported mathematical structures require additional methods.

The wPINQ experiment uses selected patterns and sampled records. It cannot establish a universal accuracy ordering. Its omission of the additional synthetic-data procedure further limits what it says about every possible use of wPINQ.

The paper’s parameter description also leaves a reporting ambiguity in the privacy-budget experiment. It describes δ as fixed while displaying an expression that includes ε. Without a more explicit account of how that parameter was handled across the sweep, the result is best read as the authors’ reported utility trend, rather than a fully resolved comparison of parameter effects.

#### Sound bounds can still be unnecessarily large

Elastic sensitivity is designed to err conservatively. It may combine maximum frequencies that do not occur together, and it does not fully exploit filters that remove records. The resulting bound can substantially exceed exact local sensitivity.

This is a practical limitation, not a contradiction of the correctness theorem. The theorem establishes that the bound is large enough for privacy. It does not establish that the resulting noise is the smallest safe amount.

The authors identify many-to-many queries with large frequency metrics as a likely case of this problem. The evaluation shows useful answers for many queries, while leaving open how much additional utility a tighter tractable analysis could recover.

#### Deployment still needs accounting and constraint handling

Flex does not choose the overall privacy-budget policy. The authors discuss compatible accounting methods, but a deployed service must select and enforce one. Repeated individually private answers do not provide an unlimited sequence of releases at the original guarantee.

The related-work discussion also raises database constraints such as key uniqueness. The authors describe prior concerns about constraints affecting privacy and identify tractable handling of common constraints as future work. Their frequency analysis should therefore not be mistaken for a complete resolution of every semantic assumption imposed by a database schema.

Together, these limits explain the paper’s cautious framing. Flex demonstrates a workable mechanism around ordinary SQL execution. Its practical success depends on a clearly specified protected unit, supported queries, valid metrics, controlled releases, and an honest account of utility.

### What came after

The later research record is not established here, so there is no supported sequence of follow-up papers to attribute to elastic sensitivity. The article’s own report of adoption at Uber concerns the work’s practical use at the time, rather than evidence about subsequent research.

The paper does identify concrete directions for work that could build on it. Tighter bounds could improve many-to-many queries whose maximum-frequency estimates are overly conservative. Additional database summaries could extend support to non-equijoins, computed keys, or averages with a useful lower bound on their input population. Update-aware metric maintenance could broaden the environments in which the architecture is convenient.

Another direction is to use Flex as a private counting interface beneath workload-level methods. The authors discuss compatibility with existing approaches that allocate privacy across several questions or construct reusable private approximations. These are proposed connections grounded in the mechanism’s interface, rather than demonstrated later developments.

The lasting contribution established by the paper is a particular combination: measure the real query workload, preserve database execution, bound join amplification through reusable statistics, and smooth that bound before release. It makes the distance between a formal privacy definition and an operational SQL service concrete, including the assumptions that still have to be maintained.

## Cite

Cite as Noah Johnson, Joseph P. Near and Dawn Xiaodong Song. 2018. Towards practical differential privacy for SQL queries. Proceedings of the VLDB Endowment.

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.1145/3187009.3177733](https://doi.org/10.1145/3187009.3177733) · [arXiv 1706.09479](https://arxiv.org/abs/1706.09479)

```bibtex
@inproceedings{johnson2018practical,
  title = {{Towards practical differential privacy for SQL queries}},
  author = {Noah Johnson, Joseph P. Near and Dawn Xiaodong Song},
  booktitle = {Proceedings of the VLDB Endowment},
  year = {2018},
  doi = {10.1145/3187009.3177733},
  eprint = {1706.09479},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.1145/3187009.3177733}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
