Executing SQL over encrypted data in the database-service-provider model

Hakan HacigümüşB. IyerChen LiS. Mehrotra

article2002SIGMOD1,389 citationsSIGMOD Test of Time Award

Proposes an algebraic query-splitting framework that pairs coarse-grained server-side index processing with fine-grained client-side decryption, enabling efficient execution of complex SQL queries over untrusted cloud databases while preserving data privacy.

Listen

Modern organizations increasingly rely on third-party service providers to host and manage database workloads. However, outsourcing sensitive enterprise data introduces severe privacy risks, as untrusted providers or compromised servers could expose confidential records. Conventional solutions either require the provider to decrypt data during processing—compromising confidentiality—or force the client to download and decrypt entire databases locally, creating unacceptable network and computational bottlenecks.

The article develops and evaluates a framework that executes structured query language operations directly over encrypted databases hosted by untrusted providers. The primary objective is to maximize query processing on the remote server while ensuring that neither plaintext data nor exact values are revealed, leaving only minimal post-processing for the client.

To achieve this, the article introduces a data storage and query transformation model. Plaintext records are encrypted in bulk using standard encryption algorithms, while individual attribute domains are partitioned into coarse discrete intervals, or buckets, with assigned index values stored alongside the ciphertext. When a user issues a query, an algebraic rewriting framework splits it into two components: a server-side query that operates on bucket identifiers to filter candidates without decryption, and a lightweight client-side query that decrypts returned candidate rows and eliminates false positives. The authors validated this architecture using standard industry benchmarks across multiple database scales and bucket configurations.

The findings show that bucket-based query splitting effectively offloads the majority of query filtering to the remote database provider. Increasing the number of attribute buckets significantly sharpens server-side filtering, leading to steep reductions in network transmission volume and client post-processing time. Across benchmark queries, client decryption and residual filtering accounted for most client-side latency, while overall response times remained within practical operational thresholds compared to centralized architectures.

These results demonstrate that organizations can achieve strong data confidentiality without sacrificing the economic and management benefits of outsourced database services. By delegating coarse candidate filtering to untrusted infrastructure, enterprises can lower infrastructure overhead and maintain data security without prohibitive network penalties.

The article recommends adopting bucket-based coarse indexing when deploying outsourced database architectures. System designers should tune partition granularities according to query patterns to balance security and performance. Future work should focus on developing automated, cost-based optimizers to select optimal bucket partitions and extend algebraic rewriting to support more advanced analytical functions.

Cover for Executing SQL over encrypted data in the database-service-provider model

Abstract

Rapid advances in networking and Internet technologies have fueled the emergence of the “software as a service” model for enterprise computing. Successful examples of commercially viable software services include rent-a-spreadsheet, electronic mail services, general storage services, disaster protection services. “Database as a Service” model provides users power to create, store, modify, and retrieve data from anywhere in the world, as long as they have access to the Internet. It introduces several challenges, an important issue being data privacy. It is in this context that we specifically address the issue of data privacy.

There are two main privacy issues. First, the owner of the data needs to be assured that the data stored on the service-provider site is protected against data thefts from outsiders. Second, data needs to be protected even from the service providers, if the providers themselves cannot be trusted. In this paper, we focus on the second challenge. Specifically, we explore techniques to execute SQL queries over encrypted data. Our strategy is to process as much of the query as possible at the service providers’ site, without having to decrypt the data. Decryption and the remainder of the query processing are performed at the client site. The paper explores an algebraic framework to split the query to minimize the computation at the client site. Results of experiments validating our approach are also presented.

Table of Contents

  • 1. INTRODUCTION
  • 2. RELATION ENCRYPTION AND STORAGE MODEL
  • 2.1 Partition Functions
  • 2.2 Identification Functions
  • 2.3 Mapping Functions
  • 2.4 Storing Encrypted Data
  • 2.5 Decryption Functions
  • 4. IMPLEMENTING RELATIONAL OPERATORS OVER ENCRYPTED RELATIONS
  • 5. ALGEBRAIC FRAMEWORK FOR QUERY SPLITTING
  • 5.1 Heuristic Rules to Separate Queries
  • 6. EXPERIMENTAL EVALUATION
  • 6.1 Experiment 1
  • 6.2 Experiment 2
  • 7. CONCLUSIONS
  • 8. REFERENCES

Knowls

  1. Knowl 1 — Relation Encryption and Storage Model

    model/method

    In the database-service-provider model, each original relational table R(A1,A2,…,An)R(A_1, A_2, \dots, A_n) is stored at the untrusted service provider as an encrypted relation:

    RS(etuple,A1S,A2S,…,AnS)R^S(etuple, A_1^S, A_2^S, \dots, A_n^S)

    where etupleetuple is an encrypted string representing the entire tuple (a1,a2,…,an)(a_1, a_2, \dots, a_n) produced using a block cipher (such as AES, RSA, Blowfish, or DES), and each AiSA_i^S is an auxiliary attribute index used for query processing at the server.

    The decryption operator DD maps an encrypted relation (or the result of relational operations over encrypted relations) back to the unencrypted plaintext domain:

    D(RS)=RD(R^S) = R

    When applied, DD strips off the auxiliary index values AiSA_i^S and decrypts the encrypted tuple string etupleetuple into the plaintext attribute values (A1,A2,…,An)(A_1, A_2, \dots, A_n).

  2. Knowl 2 — Partition, Identification, and Mapping Functions for Attribute Indexing

    definition

    To enable server-side query filtering on an attribute AiA_i of relation RR without decrypting data, the domain of values Di\mathcal{D}_i of R.AiR.A_i is divided into kk non-overlapping partition intervals or sets {p1,p2,…,pk}\{p_1, p_2, \dots, p_k\} such that their union covers Di\mathcal{D}_i:

    partition(R.Ai)={p1,p2,…,pk}partition(R.A_i) = \{p_1, p_2, \dots, p_k\}

    An identification function identR.Ai(pj)ident_{R.A_i}(p_j) assigns a unique identifier (such as a collision-free hash value or integer) to each partition pjp_j such that identR.Ai(pj)≠identR.Ai(pl)ident_{R.A_i}(p_j) \neq ident_{R.A_i}(p_l) whenever j≠lj \neq l.

    The base mapping function MapR.Ai(v)Map_{R.A_i}(v) maps any attribute value v∈Div \in \mathcal{D}_i to the identifier of the partition containing vv:

    MapR.Ai(v)=identR.Ai(pj)where v∈pjMap_{R.A_i}(v) = ident_{R.A_i}(p_j) \quad \text{where } v \in p_j

    Mapping functions are classified into two types:

    1. Order-preserving: For any two values vi,vj∈Div_i, v_j \in \mathcal{D}_i, vi<vj  ⟹  MapR.Ai(vi)≤MapR.Ai(vj)v_i < v_j \implies Map_{R.A_i}(v_i) \le Map_{R.A_i}(v_j).
    2. Random: Mapping functions that are not order-preserving.

    Extended mapping functions for sets and range comparisons are defined as:

    MapR.Ai(S)={identR.Ai(pj)∣pj∩S≠∅}Map_{R.A_i}(S) = \{ident_{R.A_i}(p_j) \mid p_j \cap S \neq \emptyset\}

    MapR.Ai>(v)={identR.Ai(pj)∣pj.low≥v}Map_{R.A_i}^>(v) = \{ident_{R.A_i}(p_j) \mid p_j.\text{low} \ge v\}

    MapR.Ai<(v)={identR.Ai(pj)∣pj.high≤v}Map_{R.A_i}^<(v) = \{ident_{R.A_i}(p_j) \mid p_j.\text{high} \le v\}

    where pj.lowp_j.\text{low} and pj.highp_j.\text{high} denote the lower and upper bounds of partition pjp_j.

  3. Knowl 3 — Condition Mapping Rules for Single-Attribute Predicates

    algorithm

    Given an unencrypted query selection condition CC, the mapping function Mapcond(C)Map_{cond}(C) translates CC into an index condition over the auxiliary encrypted attributes AiSA_i^S evaluated by the server:

    • Equality (Ai=vA_i = v):

    Mapcond(Ai=v)  ⟹  AiS=MapAi(v)Map_{cond}(A_i = v) \implies A_i^S = Map_{A_i}(v)

    • Inequality (Ai<vA_i < v):

      • Order-preserving mapping: Mapcond(Ai<v)  ⟹  AiS≤MapAi(v)Map_{cond}(A_i < v) \implies A_i^S \le Map_{A_i}(v)
      • Random mapping: Mapcond(Ai<v)  ⟹  AiS∈MapAi({v′∣v′<v})Map_{cond}(A_i < v) \implies A_i^S \in Map_{A_i}(\{v' \mid v' < v\})
    • Inequality (Ai>vA_i > v):

      • Order-preserving mapping: Mapcond(Ai>v)  ⟹  AiS≥MapAi(v)Map_{cond}(A_i > v) \implies A_i^S \ge Map_{A_i}(v)
      • Random mapping: Mapcond(Ai>v)  ⟹  AiS∈MapAi({v′∣v′>v})Map_{cond}(A_i > v) \implies A_i^S \in Map_{A_i}(\{v' \mid v' > v\})
    • Composite Conditions:

    Mapcond(C1∨C2)  ⟹  Mapcond(C1)∨Mapcond(C2)Map_{cond}(C_1 \lor C_2) \implies Map_{cond}(C_1) \lor Map_{cond}(C_2)

    Mapcond(C1∧C2)  ⟹  Mapcond(C1)∧Mapcond(C2)Map_{cond}(C_1 \land C_2) \implies Map_{cond}(C_1) \land Map_{cond}(C_2)

  4. Knowl 4 — Condition Mapping Rules for Join Predicates

    algorithm

    The condition mapping function MapcondMap_{cond} translates join conditions between attributes AiA_i and AjA_j into conditions over index attributes AiSA_i^S and AjSA_j^S executed at the server:

    • Equi-join (Ai=AjA_i = A_j):

    Mapcond(Ai=Aj)  ⟹  ⋁(pk,pl)∈Φ(AiS=identAi(pk)∧AjS=identAj(pl))Map_{cond}(A_i = A_j) \implies \bigvee_{(p_k, p_l) \in \Phi} \left(A_i^S = ident_{A_i}(p_k) \land A_j^S = ident_{A_j}(p_l)\right)

    where Φ={(pk,pl)∣pk∈partition(Ai),pl∈partition(Aj),pk∩pl≠∅}\Phi = \{(p_k, p_l) \mid p_k \in partition(A_i), p_l \in partition(A_j), p_k \cap p_l \neq \emptyset\}.

    • Theta-join with Inequality (Ai<AjA_i < A_j):
      • If MapAiMap_{A_i} is order-preserving:

    Mapcond(Ai<Aj)  ⟹  ⋁p∈partition(Ai)(AiS=identAi(p)∧AjS≥MapAj(p.low))Map_{cond}(A_i < A_j) \implies \bigvee_{p \in partition(A_i)} \left(A_i^S = ident_{A_i}(p) \land A_j^S \ge Map_{A_j}(p.\text{low})\right)

    • If MapAjMap_{A_j} is order-preserving:

    Mapcond(Ai<Aj)  ⟹  ⋁p∈partition(Aj)(AjS=identAj(p)∧AiS≤MapAi(p.high))Map_{cond}(A_i < A_j) \implies \bigvee_{p \in partition(A_j)} \left(A_j^S = ident_{A_j}(p) \land A_i^S \le Map_{A_i}(p.\text{high})\right)

    • If both MapAiMap_{A_i} and MapAjMap_{A_j} are order-preserving:

    Mapcond(Ai<Aj)  ⟹  ⋁(MapAi(pk.low)≤MapAj(pl.high))Map_{cond}(A_i < A_j) \implies \bigvee \left(Map_{A_i}(p_k.\text{low}) \le Map_{A_j}(p_l.\text{high})\right)

    • If both MapAiMap_{A_i} and MapAjMap_{A_j} are random:

    Mapcond(Ai<Aj)  ⟹  ⋁(pk,pl)∈Ψ(AiS=identAi(pk)∧AjS=identAj(pl))Map_{cond}(A_i < A_j) \implies \bigvee_{(p_k, p_l) \in \Psi} \left(A_i^S = ident_{A_i}(p_k) \land A_j^S = ident_{A_j}(p_l)\right)

    where Ψ={(pk,pl)∣pk∈partition(Ai),pl∈partition(Aj),pk.high≥pl.low}\Psi = \{(p_k, p_l) \mid p_k \in partition(A_i), p_l \in partition(A_j), p_k.\text{high} \ge p_l.\text{low}\}.

  5. Knowl 5 — Split Execution of Selection and Join Operators

    model/method

    To evaluate relational selections and joins over encrypted relations, operations are split into coarse filtering executed at the server over auxiliary index attributes and exact filtering executed at the client after decryption:

    • Selection Operator (σC(R)\sigma_C(R)):

    σC(R)=σC(D(σMapcond(C)S(RS)))\sigma_C(R) = \sigma_C\left(D\left(\sigma^S_{Map_{cond}(C)}(R^S)\right)\right)

    where σS\sigma^S executes at the server using the translated condition Mapcond(C)Map_{cond}(C) over encrypted index attributes in RSR^S. The server returns a superset of candidate encrypted tuples, which the client decrypts with DD and filters with σC\sigma_C to eliminate false positives.

    • Join Operator (R⋈CTR \bowtie_C T):

    R⋈CT=σC(D(RS⋈Mapcond(C)STS))R \bowtie_C T = \sigma_C\left(D\left(R^S \bowtie^S_{Map_{cond}(C)} T^S\right)\right)

    where ⋈S\bowtie^S executes at the server over encrypted relations RSR^S and TST^S using Mapcond(C)Map_{cond}(C). The joined candidate tuples are transmitted to the client, decrypted with DD, and filtered using the original join condition σC\sigma_C.

  6. Knowl 6 — Split Execution of Grouping, Aggregation, Sorting, and Duplicate Elimination Operators

    model/method

    Relational grouping, aggregation, sorting, and duplicate elimination are divided between server-side pre-grouping on encrypted partition indices and client-side final evaluation:

    • Grouping and Aggregation (γL(R)\gamma_L(R)): For attribute list L=LG∪LAL = L_G \cup L_A, where LGL_G is the grouping attribute list and LAL_A is the aggregate functions list:

    γL(R)=γL(D(γL′S(RS)))where L′={AiS∣Ai∈LG}\gamma_L(R) = \gamma_L\left(D\left(\gamma^S_{L'}(R^S)\right)\right) \quad \text{where } L' = \{A_i^S \mid A_i \in L_G\}

    The server groups encrypted tuples by index attributes L′L' without evaluating aggregates. Because plaintext tuples belonging to the same group map to the same partition index group, the client receives pre-grouped batches, decrypts them in a single pass, and computes LAL_A without needing full in-memory re-grouping.

    • Sorting (τL(R)\tau_L(R)):

    τL(R)=τL(D(γL′S(RS)))where L′={AiS∣Ai∈L}\tau_L(R) = \tau_L\left(D\left(\gamma^S_{L'}(R^S)\right)\right) \quad \text{where } L' = \{A_i^S \mid A_i \in L\}

    If all mapping functions for attributes in LL are order-preserving, the server executes sorting τL′S\tau_{L'}^S instead of γL′S\gamma_{L'}^S, allowing the client to sort locally within pre-sorted partition buckets.

    • Duplicate Elimination (δ(R)\delta(R)):

    δ(R)=δ(D(γL′S(RS)))where L′={AiS∣Ai∈R}\delta(R) = \delta\left(D\left(\gamma^S_{L'}(R^S)\right)\right) \quad \text{where } L' = \{A_i^S \mid A_i \in R\}

  7. Knowl 7 — Split Execution of Set Difference Operator via Left-Outer Join

    model/method

    Directly evaluating the set difference R−TR - T at the server is infeasible over encrypted data. To avoid transmitting all of RSR^S and TST^S to the client, the operation is translated using a server-side left-outer join (denoted \leftouterjoinS\leftouterjoin^S) combined with grouping and client-side null-filtering:

    R−T=πR.A1,…,R.An(R′)−πT.B1,…,T.Bn(R′)R - T = \pi_{R.A_1, \dots, R.A_n}(R') - \pi_{T.B_1, \dots, T.B_n}(R')

    where

    R′=D(γL′S(RS\leftouterjoinMapcond(⋀i=1n(R.Ai=T.Bi))STS))R' = D\left(\gamma^S_{L'}\left(R^S \leftouterjoin^S_{Map_{cond}\left(\bigwedge_{i=1}^n (R.A_i = T.B_i)\right)} T^S\right)\right)

    with L′={A1S,…,AnS,B1S,…,BnS}L' = \{A_1^S, \dots, A_n^S, B_1^S, \dots, B_n^S\}.

    Server-side grouping by L′L' groups all outer-join tuples having NULL values for TST^S attributes together. When candidate tuples arrive at the client, the client only needs to decrypt and evaluate set difference for tuples where the TT component is not NULL; any RR tuple joined strictly with NULL TT attributes is immediately retained as a valid answer.

  8. Knowl 8 — Algebraic Query Splitting Framework

    algorithm

    Given an unencrypted relational query tree QQ, the algebraic query splitting procedure decomposes QQ into a server-side query QSQ^S executing over encrypted relations and a client-side query QCQ^C executing over decrypted intermediate results:

    1. Replace each plaintext base relation RR in the query tree with D(RS)D(R^S).
    2. Translate leaf selection operators σC\sigma_C into server selections σMapcond(C)S\sigma^S_{Map_{cond}(C)} positioned below DD, and retain client selections σC\sigma_C positioned above DD.
    3. Pull the decryption operators DD up above relational joins and outer joins by replacing join operators ⋈C\bowtie_C with server joins ⋈Mapcond(C)S\bowtie^S_{Map_{cond}(C)} below DD and exact join conditions σC\sigma_C above DD.
    4. Replace grouping, duplicate elimination, and sort operators with their corresponding server-side pre-grouping γL′S\gamma^S_{L'} operators below DD, retaining exact grouping/aggregation γL\gamma_L, δ\delta, or τL\tau_L above DD.
    5. The boundary defined by the topmost DD operators separates the query tree into QSQ^S (all operators below DD, sent to the server) and QCQ^C (all operators at and above DD, executed at the client).
  9. Knowl 9 — Experimental Performance of Split SQL Execution vs Partition Bucket Granularity

    empirical result

    On TPC-H benchmarks (scale factors 0.01 and 0.1, representing 10 MB and 100 MB databases on IBM DB2 v7.1 with Blowfish encryption on Pentium III 700 MHz machines):

    1. For selection queries (such as modified TPC-H Q6), increasing the number of partition buckets from 2 to 8 significantly decreases client-side execution time and network transmission cost. The client execution time drops because a finer partition granularity improves server-side filtering selectivity (reducing false positives), meaning fewer rows are transmitted and decrypted at the client.
    2. Server-side query execution time remains relatively constant as the number of buckets increases, because the query optimizer defaults to a sequential table scan due to the overall query selectivity (~18%).
    3. For join queries (such as modified TPC-H Q3 joining customer and orders), increasing the number of buckets on join attributes sharply decreases total query execution time, client execution time, and server execution time. Decryption time at the client represents the dominant component of total client-side execution time.

Coverage note — No substantial contributed material was omitted. All core mechanisms including relation encryption, attribute mapping functions, predicate condition translation, split execution of relational operators, query rewriting heuristics, and TPC-H experimental findings are covered.

References

  1. 1.AES. Advanced Encryption Standard. National Institute of Science and Technology, FIPS 197, 2001.
  2. 2.D. Song and D. Wagner and A. Perrig. Search on encrypted data. In Proc. of IEEE SRSP, 2000.
  3. 3.DES. Data Encryption Standard. FIPS PUB 46, Federal Information Processing Standards Publication, 1977.
  4. 4.H. Garcia-Molina, J. Ullman, and J. Widom. Database Systems: The Complete Book. Prentice Hall, 2002.
  5. 5.H. Hacıgşumüş, B. Iyer, C. Li, and S. Mehrotra. Executing SQL over Encrypted Data in Database-Service-Provider Model. Technical Report TR-DB-02-02, Database Research Group at University of California, Irvine, 2002.
  6. 6.H. Hacıgşumüş, B. Iyer, and S. Mehrotra. Providing Database as a Service. In Proc. of ICDE, 2002.
  7. 7.Y. E. Ioannidis and V. Poosala. Histogram-based approximation of set-valued query answers. In Proc. of VLDB, pages 174–185, 1999.
  8. 8.H. V. Jagadish, H. Jin, B. C. Ooi, and K.-L. Tan. Global optimization of histograms. In Proc. of ACM SIGMOD, 2001.
  9. 9.G. Piatatetsky-Shapiro and C. Connell. Accurate estimation of the number of tuples satisfying a condition. In Proc. of ACM SIGMOD, 1984.
  10. 10.R. L. Rivest, L. M. Adleman, and M. Dertouzos. On Data Banks and Privacy Homomorphisms. In Foundations of Secure Computation, pages 169–178, 1978.
  11. 11.R. L. Rivest, A. Shamir, and L. M. Adleman. A method for obtaining digital signatures and public key cryptosystems. Communications of the ACM, 21(2):120–126, 1978.
  12. 12.B. Schneier. Description of a new variable-length key, block cipher (blowfish), fast software encryption. In Cambridge Security Workshop Proceedings, 1994.
  13. 13.A. Silberschatz, H. F. Korth, and S. Sudarshan. Database System Concepts, 3rd Edition. McGraw-Hill Book Company, 1997.
  14. 14.TPC-H. Benchmark Specification. http://www.tpc.org.
  15. 15.M. Winslett and J. D. Ullman. Jeffrey D. Ullman speaks out on the future of higher education, startups, database theory, and more. SIGMOD Record, 30(3), 2001.

Citation

MLA
Hacigümüş, H., et al. “Executing SQL over Encrypted Data in the Database-service-provider Model”. Proceedings of the 2002 ACM SIGMOD International Conference on Management of Data, 2002, pp. 216–27, https://doi.org/10.1145/564691.564717.
APA
Hacigümüş, H., Iyer, B., Li, C., & Mehrotra, S. (2002). Executing SQL over encrypted data in the database-service-provider model. Proceedings of the 2002 ACM SIGMOD International Conference on Management of Data, 216–227. https://doi.org/10.1145/564691.564717
Chicago
Hacigümüş, H., B. Iyer, C. Li, and S. Mehrotra. 2002. “Executing SQL over Encrypted Data in the Database-service-provider Model”. Proceedings of the 2002 ACM SIGMOD International Conference on Management of Data, 216–27. https://doi.org/10.1145/564691.564717.
Harvard
Hacigümüş, H. et al. (2002) “Executing SQL over encrypted data in the database-service-provider model”, Proceedings of the 2002 ACM SIGMOD international conference on Management of data. ACM, pp. 216–227. Available at: https://doi.org/10.1145/564691.564717.
Vancouver
1. Hacigümüş H, Iyer B, Li C, Mehrotra S (2002) Executing SQL over encrypted data in the database-service-provider model. In: Proceedings of the 2002 ACM SIGMOD international conference on Management of data. ACM, pp 216–227

BibTeX

@inproceedings{Hacig_m__2002, series={SIGMOD/PODS02}, title={Executing SQL over encrypted data in the database-service-provider model}, url={http://dx.doi.org/10.1145/564691.564717}, DOI={10.1145/564691.564717}, booktitle={Proceedings of the 2002 ACM SIGMOD international conference on Management of data}, publisher={ACM}, author={Hacigümüş, Hakan and Iyer, Bala and Li, Chen and Mehrotra, Sharad}, year={2002}, month=June, pages={216–227}, collection={SIGMOD/PODS02} }
Metadata:Crossref

Access the Paper

This paper is available from its original source. Click below to access the PDF.

Open PDF