Database query method and apparatus, storage medium, and computer program product
By deploying database executors in TEE and REE, and running them in parallel with shared memory, the overhead of execution environment switching and scheduling is eliminated, the execution plan is optimized, and the problem of database query performance degradation in existing technologies is solved, achieving efficient database querying.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TSINGHUA UNIVERSITY
- Filing Date
- 2024-12-06
- Publication Date
- 2026-06-09
Smart Images

Figure CN122173521A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of database technology, and in particular to a database query method, apparatus, storage medium, and computer program product. Background Technology
[0002] Cloud databases have been widely adopted in recent years, and their ability to protect data confidentiality is a crucial consideration for cloud vendors' customers when migrating to the cloud. To achieve a "usable but not visible" level of confidentiality for data in cloud databases, the conventional approach is to encrypt the data. However, encrypted data, by simultaneously hiding various related information, creates difficulties for data computation during database queries. Therefore, secure data computation can currently be performed in a trusted execution environment (TEE) using trusted hardware. The entire database query process typically includes computations outside the TEE, in addition to the computations within the TEE. This latter computation occurs in an execution environment called a rich execution environment (REE). How to leverage TEEs and REEs for secure and efficient database queries is a hot research topic in the industry. Summary of the Invention
[0003] This application provides a database query method, apparatus, storage medium, and computer program product, which can eliminate the overhead of switching execution environments and the overhead of calling between TEE and REE, thereby improving database query efficiency. The technical solution is as follows:
[0004] Firstly, a database query method is provided, wherein both the TEE and REE contain a database executor, and the REE includes a first memory shared by the TEE and REE for data exchange; the method includes:
[0005] Based on the database query request, a logical plan tree is determined, which includes multiple logical plan nodes representing the operations required to respond to the database query request. The logical plan tree is then transformed into a physical plan tree, which includes multiple physical plan nodes, the execution environment of which is either a TEE or an REE. According to the physical plan tree, the TEE plan and the REE plan are determined. Using the first memory, the TEE plan is executed through the database executor in the TEE, and the REE plan is executed through the database executor in the REE, to obtain the database query results.
[0006] In this application, both the TEE and REE contain a database executor (hereinafter referred to as the executor). Thus, both the TEE and REE can execute their respective sub-plans without switching execution environments, eliminating the overhead of execution environment switching. Based on this, there is data interaction between the TEE executor and the REE executor, but no calling relationship, thereby eliminating scheduling overhead. Furthermore, the use of shared memory (i.e., first memory) enables efficient cooperation between the TEE executor and the REE executor, improving database query efficiency.
[0007] The TEE plan includes one or more TEE sub-plans, and the REE plan includes one or more REE sub-plans. These TEE sub-plans are stored in a TEE thread pool, and these REE sub-plans are stored in an REE thread pool. At least one non-blocking execution node exists in both the TEE and REE plans. During the execution of a non-blocking execution node, the TEE thread pool and the REE thread pool operate in a non-blocking manner. In other words, this solution supports the parallel execution of TEE threads and REE threads. Thus, the TEE executor and the REE executor can employ different degrees of parallelism, ensuring that data in shared memory is processed promptly, enabling efficient cooperation between TEE and REE.
[0008] The data in the first memory is maintained using a lock-free queue, so that both REE and TEE can write data to or read data from the first memory without locking, thereby improving execution efficiency.
[0009] In one possible implementation, the logical plan tree is transformed into a physical plan tree, which includes: transforming the logical plan tree into a physical plan tree based on the available resources of the TEE. That is, the transformation of the logical plan tree fully considers the available resources of the TEE so that the resulting physical plan tree satisfies the available resources of the TEE.
[0010] Among them, the available resources of TEE include at least the available memory of TEE.
[0011] In one possible implementation, based on the available resources of the TEE, the logical plan tree is transformed into a physical plan tree, including: for each first logical plan node among the plurality of logical plan nodes, according to the transformation rules from logical plan to physical plan, the first logical plan node is transformed into a physical sub-plan in the physical plan tree, and the input data attribute of the first logical plan node is REE ciphertext; for each second logical plan node among the plurality of logical plan nodes, according to the transformation rules from logical plan to physical plan, the second logical plan node is transformed into at least one first candidate physical sub-plan, and the cost of executing each first candidate physical sub-plan in the REE is determined, and the input data attribute of the second logical plan node is REE ciphertext. The at least one first candidate physical sub-plan is different from the TEE plaintext. According to the input data attribute conversion rules, the at least one first candidate physical sub-plan is converted to obtain at least one second candidate physical sub-plan. Based on the available resources of the TEE, the cost of executing each second candidate physical sub-plan in the TEE is determined. The input data attribute of the second candidate physical sub-plan is REE ciphertext. The candidate physical sub-plan with the lowest execution cost among the multiple candidate physical sub-plans is determined as the physical sub-plan in the physical plan tree obtained after converting the second logical plan node. The multiple candidate physical sub-plans include the at least one first candidate physical sub-plan and the at least one second candidate physical sub-plan.
[0012] In other words, for the logical plan nodes involving data confidentiality (i.e., the first logical plan nodes), they must be securely executed in the TEE regardless of the circumstances. For these logical plan nodes, a conventional transformation according to the logical plan to physical plan transformation rules is sufficient. For the logical plan nodes not involving data protection (i.e., the second logical plan nodes), a conventional transformation according to the logical plan to physical plan transformation rules is first performed to determine the cost of executing the resulting candidate physical sub-plans in the REE. Then, by adjusting the input data attribute transformation rules to create candidate physical sub-plans that can be executed in the TEE, the cost of adjusting them for execution in the TEE is determined. Finally, by comparing the costs, it is determined whether to execute them in the REE using conventional techniques or adjust them for execution in the TEE to reduce the overall execution cost.
[0013] As can be seen, this scheme can enumerate as many combinations as possible to determine the execution environment of each execution node, thereby finding the physical plan tree with the lowest execution cost.
[0014] Specifically, according to the input data attribute conversion rules, the at least one first candidate physical sub-plan is converted to obtain at least one second candidate physical sub-plan. This includes: for each of the at least one first candidate physical sub-plans, inserting TEE decryption operator nodes between the child nodes of the first candidate physical sub-plan to convert the first candidate physical sub-plan into a second candidate physical sub-plan. In other words, the attribute conversion of the input data is achieved through TEE decryption operator nodes.
[0015] Specifically, based on the available resources of the TEE, the cost of executing each second candidate physical sub-plan in the TEE is determined, including: based on the available resources of the TEE and the cost of executing the second candidate physical sub-plan in the REE, the cost of executing the second candidate physical sub-plan in the TEE is determined through cost transformation relationship.
[0016] In one possible implementation, the aforementioned cost transformation relationship is represented by a cost transformation function, which includes a first parameter and a second parameter. The first parameter represents the additional computational overhead incurred by executing the second candidate physical sub-plan in the TEE, and the second parameter represents the overhead of page replacement in the TEE when the resources used during the execution of the second candidate physical sub-plan exceed the available resources of the TEE. The cost estimation in this scheme fully considers the overhead of memory encryption engine and TEE page replacement when memory overhead is high, resulting in more accurate cost estimation and facilitating the search for the optimal physical plan tree.
[0017] In one possible implementation, the cost transformation function is cost. TEE =cost REE *(α+β*I), where cost TEE Cost represents the cost of executing the second candidate physics sub-plan within the TEE. REE I represents the cost of executing the corresponding first candidate physical sub-plan in the REE, where α is the first parameter and β is the second parameter. If the resources used to execute the second candidate physical sub-plan in the TEE exceed the available resources of the TEE, I takes the value of 1; if the resources used to execute the second candidate physical sub-plan in the TEE do not exceed the available resources of the TEE, I takes the value of 0. This cost conversion function avoids introducing too many hardware cost parameters related to the TEE platform, and the empirical coefficients (i.e., α and β) are easy to measure and highly usable.
[0018] Before determining the cost of executing the second candidate physical sub-plan in the TEE through the cost transformation relationship, the cost transformation relationship can be determined through some samples.
[0019] In one possible implementation, before determining the cost of executing the second candidate physical sub-plan in the TEE through cost transformation relationships, the method further includes: generating multiple input data samples of the target operation based on the size of available resources in the TEE, wherein the target operation is the operation indicated by the second candidate physical sub-plan; using each of the multiple input data samples, executing the target operation in the TEE to determine the TEE execution cost corresponding to each input data sample, and executing the target operation in the REE to determine the REE execution cost corresponding to each input data sample; and determining the cost transformation relationship based on the TEE execution cost and REE execution cost corresponding to the multiple input data samples.
[0020] Secondly, a database query apparatus is provided, which has the function of implementing the database query method behavior described in the first aspect above. The database query apparatus includes one or more modules, which are used to implement the database query method provided in the first aspect above.
[0021] Thirdly, a computer device is provided, comprising a processor and a memory, the memory being used to store a program for executing the database query method provided in the first aspect, and to store data related to implementing the database query method provided in the first aspect. The processor is configured to execute the program stored in the memory.
[0022] In one possible implementation, the computer device may further include a communication bus for establishing a connection between the processor and the memory.
[0023] Fourthly, a computer-readable storage medium is provided, wherein instructions are stored therein, which, when executed on a computer, cause the computer to perform the database query method described in the first aspect.
[0024] Fifthly, a computer program product containing instructions is provided, which, when run on a computer, causes the computer to execute the database query method described in the first aspect.
[0025] The technical effects achieved by the second, third, fourth, and fifth aspects mentioned above are similar to those achieved by the corresponding technical means in the first aspect, and will not be repeated here. Attached Figure Description
[0026] Figure 1 This is a flowchart of a database query method provided in an embodiment of this application;
[0027] Figure 2 This is a schematic diagram illustrating an input data attribute conversion method provided in an embodiment of this application;
[0028] Figure 3 This is a schematic diagram of an execution plan splitting provided in an embodiment of this application;
[0029] Figure 4 This is a schematic diagram of the system architecture of a database query method provided in an embodiment of this application;
[0030] Figure 5 This is a schematic diagram illustrating the collaborative operation of a TEE and a REE provided in an embodiment of this application;
[0031] Figure 6 This is a flowchart of another database query method provided in the embodiments of this application;
[0032] Figure 7 This is a schematic diagram of the structure of a database query device provided in an embodiment of this application;
[0033] Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0034] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0035] To facilitate understanding, some terms used in the embodiments of this application will be introduced first.
[0036] 1. Database system
[0037] A database system, often simply called a database, typically comprises storage and computational components. The storage component primarily stores various types of data, such as data from different industries stored in the cloud. The computational component handles the computations or operations performed during database queries, such as form scanning, conditional filtering, sorting, joins, and grouping / aggregation. The computational component typically includes a query optimizer and a database executor. The query optimizer optimizes the operations required for data query requests. These operations are usually represented by a logical plan tree. During the database query process, the logical plan tree needs to be transformed into a physical plan tree so that the computer can execute the physical operations indicated by the physical plan tree. The query optimizer helps find the optimal physical plan tree during this transformation. The database executor typically executes the physical plan tree to obtain the database query results. The database executor usually includes a scheduler and executors. The scheduler schedules the various physical sub-plans in the physical plan tree, and the executors execute these physical sub-plans under the scheduler's guidance.
[0038] 2. Implementation Plan
[0039] A data structure that describes the execution order of various operations during query calculations in a database system. These operations can also be called computations or calculations. An execution plan includes, for example, the logical plan indicated by a logical plan tree, and the physical plan indicated by a physical plan tree. A logical plan can also be called a logical execution plan, and a physical plan can also be called a physical execution plan.
[0040] 3. Execution plan node (referred to as execution node)
[0041] An execution plan is a computational component that receives input data from its child nodes and outputs the computation result. Execution plan nodes include, for example, the execution plan node in the logical plan tree (referred to as the logical plan node) and the execution plan node in the physical plan tree (referred to as the physical plan node).
[0042] 4. Non-blocking
[0043] Blocking and non-blocking refer to the states of the caller (program) while waiting for a return result (or input). In blocking mode, the current thread is suspended until the result is returned, and returns after receiving the result. In non-blocking mode, the caller does not block the current thread if the result cannot be obtained immediately. Therefore, in the non-blocking case, the caller needs to periodically poll to check the processing status. The existence of non-blocking system calls can be used to achieve thread-level input / output (I / O) concurrency, which reduces memory consumption and process switching overhead compared to I / O concurrency achieved through multiple processes.
[0044] In the database query system, some execution plan nodes are non-blocking nodes. In this embodiment, the non-blocking nodes are used to achieve thread-level I / O concurrency, enabling the TEE thread pool and the REE thread pool to run in non-blocking mode, i.e., in parallel, thereby improving the utilization of the system processor cores.
[0045] 5. Lock-free queue
[0046] A lock-free queue is a concurrent data structure that allows multiple threads to perform concurrent operations without locks.
[0047] The following section introduces the background knowledge involved in the embodiments of this application.
[0048] In recent years, TEE-related technologies have developed, and various mainstream processor platforms have corresponding TEE designs, such as Intel SXG, Arm Trustzone, and AMD SEV. Taking Intel SXG as an example, Intel SXG allocates an independent memory area for the TEE, encrypting and verifying the contents within it. When data is loaded from memory into the processor cache, it is decrypted. The decrypted data is then processed to obtain modified data, which can be called dirty data. When the modified dirty data is written back from the processor cache to memory, it is encrypted, thus preventing attackers from obtaining the plaintext content of the data in memory.
[0049] Programs using SGX to protect data processing are split into an untrusted part executing outside the TEE and a trusted part executing within the TEE. While data processing can be safely performed within the TEE, it typically only supports a subset of the standard library and cannot natively support most system calls (such as mutexes, file I / O, etc.). The execution environment outside the TEE, because it can utilize the entire operating system and language libraries, is called a Rich Execution Environment (REE). The TEE restricts calls from the REE to methods within the TEE, requiring a switch in the execution environment via the `ecall` instruction. Conversely, system calls or execution of REE code from within the TEE require a switch in the execution environment via the `ocall` instruction. This switching process incurs significant overhead. Furthermore, the memory resources managed by the TEE are called the enclave page cache (EPC), whose capacity is limited. Available resources are determined at allocation time. In SGX v1, the available memory in the TEE is less than 128MB (megabytes). When memory usage exceeds this limit, the TEE performs page replacement operations on the EPC, which significantly degrades system performance. While SGX v2 offers significant improvements, supporting TEEs with tens of gigabytes to 512GB of memory depending on hardware configuration, the total resources are shared by all instances, which remains limited in multi-tenant cloud scenarios.
[0050] To leverage TEE technology for cloud-based data computation, the database field has undertaken various attempts. These include: Technique 1 extends encrypted data type plugins, delegating encrypted comparison and numerical computation to the TEE; Technique 2 migrates existing databases entirely to the TEE by individually supporting the system calls used or by leveraging the operating system library; Technique 3 uses a separate REE database and a TEE database, with encrypted subquery requests sent from the REE database to the TEE database for encrypted data computation.
[0051] One related technique involves calling a TEE (Transaction Execution Environment) when performing basic operations (comparison, numerical calculations) on ciphertext fields. This type of method supports encrypted data computation by extending database plugins. Basic ciphertext operations are implemented using a TEE. The main steps are: using the EEnter command to switch the execution environment from REE to TEE, then decrypting the operation parameters, calculating and encrypting the result, and finally using the EEXit command to switch the execution environment back from TEE to REE. When database queries involve ciphertext operations, operations on ciphertext data types in the expression will call the aforementioned plugin, which in turn calls the TEE to complete the ciphertext computation.
[0052] While the first related technology has relatively low intrusion into the database, it has two significant disadvantages. First, it involves numerous TEE calls, and the environment switching time overhead for each call to a basic operator in the TEE far exceeds the execution time. Second, this solution cannot perceive the relationships between basic operations. For example, when calculating a multi-operand expression, the intermediate results repeatedly enter and exit the TEE, resulting in significant redundant encryption and decryption overhead. This leads to severe performance degradation when executing slightly more complex queries, such as analytical queries.
[0053] Related technology two involves migrating the entire database to a TEE. This approach typically delegates system calls to the REE operating system via ocall to migrate the database, or runs the database on a library operating system (such as libOS). Because this approach doesn't specifically modify the database design to suit the TEE hardware characteristics, it suffers from the following drawbacks: First, system calls require switching execution environments, incurring significant switching overhead. Second, this approach also uses the TEE for calculations on plaintext fields, resulting in additional computational overhead due to the TEE's memory encryption engine. Third, since plaintext data consumes TEE memory resources, this approach is more prone to TEE memory shortages, leading to severe TEE memory page swapping. These drawbacks result in significant performance degradation for related technology two.
[0054] The third related technology involves deploying a separate database in both the TEE and REE to perform computations on ciphertext and plaintext respectively. The database in the REE receives user database query requests (such as Structured Query Language (SQL) queries) and, based on whether each part of the query plan involves ciphertext computation, extracts ciphertext subqueries from the query plan. When executing query computations, if the REE database depends on the ciphertext computation results from the TEE, it drives the TEE database to execute the ciphertext subquery; similarly, if the TEE database executes a ciphertext subquery and depends on the plaintext computation results from the REE, it drives the REE database to execute the plaintext subquery, recursively processing the data in this way. Finally, after the data is processed distributed between the TEE and REE, the computation results are returned to the user.
[0055] While related technology three considers that plaintext computation should be performed in the REE to reduce additional overhead, both the TEE and REE are synchronous calls. The intermediate data processed by one side needs to be fully materialized into results, and it cannot effectively utilize the multi-core parallel capabilities of modern processors, resulting in low processor resource utilization. In addition, the execution plan generation method used in related technology three simply applies the plaintext database, without considering the additional computational overhead of the TEE, resulting in poor performance of the generated execution plan.
[0056] Considering the shortcomings of related technologies, the technical problems to be solved by the embodiments of this application include at least the following.
[0057] 1. Current TEE-based encrypted databases do not systematically consider the characteristics of TEE hardware, nor do they fully utilize the features of modern multi-core processors, resulting in the processor core constantly switching execution environments between TEE and REE, causing serious performance degradation.
[0058] 2. Current technology does not have an execution cost model designed for TEE, resulting in a lack of reliable guidance for query optimization.
[0059] 3. Current technologies generally mechanically apply the query optimization process of plaintext databases. In encrypted database scenarios, the execution environment (also known as the execution location) of the execution plan node is related to its input attributes, which are either TEE plaintext or REE ciphertext. Current technologies cannot efficiently enumerate legal execution plans to determine the quality of each execution plan node in TEE or REE execution.
[0060] The database query method provided in the embodiments of this application will be described next.
[0061] In this embodiment, both the TEE and REE include database executors, or in other words, both the TEE and REE are deployed with database executors. Thus, both the TEE and REE can execute their corresponding sub-plans without switching execution environments, eliminating the overhead of execution environment switching. The TEE executor and REE executor are controlled by their respective schedulers; they interact with each other but have no calling relationship, thereby eliminating scheduling overhead. As mentioned above, the database includes not only the database executor but also storage and a query optimizer. It should be understood that the TEE in this embodiment does not need to deploy a complete database to achieve the technical solution of this embodiment. Similarly, the REE may or may not deploy a complete database; however, this embodiment does not limit this. The database executor in the TEE can be simply referred to as the TEE executor, and the database executor in the REE can be simply referred to as the REE executor.
[0062] Furthermore, in this embodiment, the REE includes a first memory, which is shared by the TEE and the REE for data interaction, such as exchanging intermediate results. That is, utilizing shared memory (i.e., the first memory) enables the TEE executor and the REE executor to work together efficiently, improving database query efficiency.
[0063] Figure 1 This is a flowchart illustrating a database query method provided in an embodiment of this application. This method can be applied to computer devices. Please refer to... Figure 1 The method includes the following steps.
[0064] Step 101: Based on the database query request, determine the logical plan tree, which includes multiple logical plan nodes, each representing the operation required to respond to the database query request.
[0065] The database query request can be triggered by user operation or by other events, such as a timed query event. This application embodiment does not limit this.
[0066] A database query request may specify the table or data to be queried, or the statistical results of the table, etc. This application embodiment does not limit the specific content of the database query request.
[0067] A computer device determines a logical plan tree based on a database query request. The logical plan tree includes multiple logical plan nodes, which represent the execution order of these nodes. Each logical plan node represents the operation required by the database query request; the operation represented by each node can be called a logical operation. There are many ways for the computer device to determine the logical plan tree, and this application does not limit this approach. For specific details, please refer to related technologies.
[0068] Step 102: Convert the logical plan tree into a physical plan tree. The physical plan tree includes multiple physical plan nodes, and the execution environment of each physical plan node is TEE or REE.
[0069] In this embodiment of the application, after obtaining the logical plan tree, the computer device converts the logical plan tree into a physical plan tree, so that the computer device can execute the physical operations indicated by each physical plan node in the physical plan tree. The execution environment of any physical plan node is either TEE or REE; that is, the physical plan tree includes physical plan nodes with an execution environment of TEE and physical plan nodes with an execution environment of REE.
[0070] In this embodiment, the computer device can convert the logical plan tree into a physical plan tree based on the available resources of the TEE. That is, the conversion of the logical plan tree fully considers the available resources of the TEE, so that the resulting physical plan tree satisfies the available resources of the TEE. The available resources of the TEE are related to the TEE hardware conditions; therefore, this embodiment fully considers the TEE hardware conditions when converting the logical plan tree. This will be described in detail below.
[0071] The available resources of the TEE include at least the available memory of the TEE. In some embodiments, the available resources of the TEE also include the number of available cores of the TEE, the type of available cores of the TEE, etc.
[0072] The process of transforming a logical plan tree into a physical plan tree based on available TEE resources in a computer device includes the following four steps.
[0073] Step a1: For each first logical plan node among the multiple logical plan nodes, transform the first logical plan node into a physical sub-plan in the physical plan tree according to the transformation rules from logical plan to physical plan. The input data attribute of the first logical plan node is REE ciphertext.
[0074] The input data attribute being REE ciphertext indicates that the input data is, for example, ciphertext data output from the REE, and this ciphertext data will be further securely computed within the TEE. The first logical plan node is the part of the logical plan node involved in data protection (or data privacy), that is, the logical plan node that must be securely executed within the TEE regardless of circumstances. For this part of the logical plan node, the computer device can convert it according to the transformation rules from logical plan to physical plan, such as conversion according to relevant technologies.
[0075] The transformation rules from logical plan to physical plan include one or more of the following: table join order selection rules, table filter condition movement rules, and table join algorithm selection rules. This application does not specifically limit the transformation rules; however, relevant technologies can be consulted for details.
[0076] In one possible implementation, according to the transformation rules from logical plan to physical plan, the first logical plan node can be transformed into one or more candidate physical sub-plans. If there is only one candidate physical sub-plan, then that candidate physical sub-plan is the physical sub-plan in the physical plan tree obtained by transforming the first logical plan node. If there are multiple candidate physical sub-plans, then after estimating the execution cost of these multiple candidate physical sub-plans in the TEE, the physical sub-plan with the lowest execution cost among these multiple candidate physical sub-plans is determined as the physical sub-plan in the final physical plan tree. These multiple candidate physical sub-plans are different; for example, they may represent different physical operations, and / or the execution order of the represented physical operations may be different.
[0077] The specific implementation method for estimating the cost of executing these multiple candidate physical sub-plans in the TEE is not limited in the embodiments of this application. For example, the cost of executing each candidate physical sub-plan in the TEE can be determined according to the TEE cost formula, and relevant technologies can be referred to for details.
[0078] As an example, the computer device estimates the cost of executing each of the various candidate physical sub-plans in the TEE based on statistical information from the first logical plan node. This includes cardinality estimation based on statistical information, and determining the cost of executing the candidate physical sub-plan in the TEE based on the estimated cardinality. The statistical information represents the amount of input data from the first logical plan node. For specific implementation details regarding cardinality estimation, please refer to relevant technologies.
[0079] Step a2: For each second logical plan node among the multiple logical plan nodes, according to the transformation rules from logical plan to physical plan, the second logical plan node is transformed into at least one first candidate physical sub-plan, and the cost of executing each first candidate physical sub-plan in the REE is determined. The input data attribute of the second logical plan node is TEE plaintext, and the at least one first candidate physical sub-plan is different.
[0080] The input data attribute being TEE plaintext indicates that the input data is, for example, plaintext data output from a TEE, which will be further computed in the REE. The second logical plan node refers to the part of the logical plan node that does not involve data privacy; that is, the logical plan node to be executed in the REE according to relevant technologies. For this part of the logical plan node, the computer device first transforms it according to the transformation rules from logical plan to physical plan to obtain at least one first candidate physical sub-plan. Then, the computer device determines the cost of executing each first candidate physical sub-plan in the REE. These at least one candidate physical sub-plans are different, for example, in terms of the physical operations they represent, and / or in terms of the execution order of the physical operations they represent.
[0081] The computer equipment can determine the cost of executing each first candidate physical sub-plan in the REE according to the REE cost formula. For details, please refer to relevant technologies. This application does not limit this aspect.
[0082] Step a3: According to the input data attribute conversion rules, transform the at least one first candidate physical sub-plan to obtain at least one second candidate physical sub-plan. Based on the available resources of TEE, determine the cost of executing each second candidate physical sub-plan in TEE. The input data attribute of the second candidate physical sub-plan is REE ciphertext.
[0083] In other words, for logical plan nodes that are to be executed in the REE according to relevant technologies, it is necessary to further transform the at least one first candidate physical subplan according to the input data attribute transformation rules to obtain at least one second candidate physical subplan with input data attributes of REE ciphertext. In other words, by transforming the input data attributes, the first candidate physical subplan is transformed into a second candidate physical subplan that can be executed in the TEE. Each first candidate physical subplan is transformed into one second candidate physical subplan, meaning there is a one-to-one correspondence between the at least one first candidate physical subplan and the at least one second candidate physical subplan.
[0084] After obtaining at least one second candidate physical sub-plan, the computer device determines the cost of executing each second candidate physical sub-plan in the TEE based on the available resources of the TEE. That is, for a physical plan node that is to be executed in the REE according to the relevant technology, what is the TEE execution cost if it is adjusted to be executed in the TEE?
[0085] In one possible implementation, the at least one first candidate physical sub-plan is transformed according to the input data attribute transformation rules to obtain at least one second candidate physical sub-plan. This includes: for each of the at least one first candidate physical sub-plans, inserting TEE decryption operator nodes between the first candidate physical sub-plans and their child nodes to transform the first candidate physical sub-plan into a second candidate physical sub-plan. In simpler terms, by inserting TEE decryption operator nodes, the input data attributes are transformed to adjust the plan nodes that were originally to be executed in the REE to be executed in the TEE.
[0086] Figure 2 This is a schematic diagram illustrating an input data attribute conversion method provided in an embodiment of this application. See also... Figure 2 The transformation from (a) to (b) represents adjusting the execution environment of a physical plan node, originally intended for execution in the REE, to the TEE by inserting a TEE decryption operator node. As can be seen from (a) and (b), inserting a TEE decryption operator node modifies the input data attributes of the physical plan node. These input data attributes also affect the input / output data attributes of other related physical plan nodes. Therefore, under normal circumstances, the transformation from (c) to (d) is also required to transform the input data attributes of other related physical plan nodes by inserting a TEE decryption operator node, ensuring the correct execution logic of the entire physical plan tree. In other words, in this embodiment, the execution environment of certain physical plan nodes is adjusted from the REE to the TEE by inserting a TEE decryption / encryption operator node.
[0087] Before the conversion, the execution plan node represented by (a) could only search for sub-plans whose output data attribute was TEE plaintext, and the execution plan node represented by (c) could only search for sub-plans whose output data attribute was REE ciphertext. After the conversion, the execution plan node represented by (b) can search for sub-plans whose output data attribute is REE ciphertext, and the execution plan node represented by (d) can search for sub-plans whose output data attribute is TEE plaintext.
[0088] In one possible implementation, the cost of executing each second candidate physical sub-plan in the TEE is determined based on the available resources of the TEE, including: determining the cost of executing the second candidate physical sub-plan in the TEE based on the available resources of the TEE and the cost of executing the second candidate physical sub-plan in the REE through a cost transformation relationship.
[0089] In some embodiments, the aforementioned cost transformation relationship is characterized by a cost transformation function, which includes a first parameter and a second parameter. The first parameter represents the additional computational overhead (mainly including the added TEE encryption / decryption overhead) incurred by executing the second candidate physical sub-plan in the TEE. The second parameter represents the overhead incurred by page replacement in the TEE when the resources used during the execution of the second candidate physical sub-plan exceed the available resources of the TEE. The cost estimation in the embodiments of this application fully considers the overhead caused by the memory encryption engine and TEE page replacement when memory overhead is high, resulting in a more accurate cost estimation, which is beneficial for searching the optimal physical plan tree.
[0090] In one possible implementation, the cost transformation function is cost. TEE =cost REE *(α+β*I), where cost TEE Cost represents the cost of executing the second candidate physics sub-plan within the TEE. REE I represents the cost of executing the corresponding first candidate physical sub-plan in the REE, where α represents the first parameter and β represents the second parameter. If the resources used in executing the second candidate physical sub-plan in the TEE exceed the available resources of the TEE, I takes the value of 1; if the resources used in executing the second candidate physical sub-plan in the TEE do not exceed the available resources of the TEE, I takes the value of 0.
[0091] It should be understood that the cost of executing the corresponding first candidate physical sub-plan in the REE is the cost of executing the corresponding first candidate physical sub-plan obtained in step a2 in the REE. The corresponding first candidate physical sub-plan refers to the first candidate physical sub-plan corresponding to the second candidate physical sub-plan.
[0092] In the aforementioned cost conversion function, I acts as an indicator function, denoted as I representing the resources used during the execution of the second candidate physical sub-plan in the TEE. mem The available resources of the TEE are denoted as I. size , then I mem Greater than I size The instruction that TEE execution costs are relatively high, I mem Not greater than I size This indicates that the cost of TEE execution is relatively low.
[0093] The aforementioned cost transformation function can be considered a linear function, and experiments have shown that its performance is already very good. Furthermore, this cost transformation function avoids introducing too many hardware cost parameters related to the TEE platform, and the empirical coefficients (i.e., α and β) are easy to measure and highly usable.
[0094] Of course, in other possible implementations, quadratic or even higher-order functions can be used as cost transformation functions. Besides being represented by cost transformation functions, the cost transformation relationship can also be represented by a trained neural network model in some embodiments, that is, the relationship between REE execution costs and TEE execution costs can be implicitly represented by this neural network model. In other embodiments, the cost transformation relationship can also be represented by a cost transformation relationship table, which may include the correspondence between multiple REE execution costs and multiple TEE execution costs, or the correspondence between multiple REE execution cost ranges and multiple TEE execution costs. This application does not limit this; the cost transformation relationship table can be determined by the aforementioned cost transformation function, or it can be determined by other methods, which this application also does not limit.
[0095] Before determining the cost of executing the second candidate physical sub-plan in the TEE through the cost transformation relationship, the computer equipment can first determine the cost transformation relationship through some samples.
[0096] In one possible implementation, the computer device generates multiple input data samples for a target operation based on the available resources of the TEE (Technical Equipment Environment). This target operation is an operation indicated by a second candidate physical sub-plan, and is considered a physical operation. Using each of these multiple input data samples, the computer device executes the target operation in the TEE to determine the TEE execution cost corresponding to each input data sample, and also executes the target operation in the REE (Resource Equipment Environment) to determine the REE execution cost corresponding to each input data sample. Based on the TEE execution cost and REE execution cost corresponding to the multiple input data samples, the computer device determines a cost transformation relationship.
[0097] For each physical operation, the computer device can pre-determine it as a target operation and determine the corresponding cost transformation relationship according to the above method. That is, for each physical operation, the computer device will obtain a corresponding cost transformation relationship. These physical operations include, for example, encryption, decryption, conditional filtering, index access, sorting, hash joining, hash table construction, and hash table access. In determining the cost of executing the second candidate physical sub-plan in the TEE, the cost transformation relationship corresponding to the physical operation indicated by the second candidate physical sub-plan can be determined from multiple cost transformation relationships first, and then the cost of executing the second candidate physical sub-plan in the TEE can be determined according to this cost transformation relationship.
[0098] In one possible implementation, generating multiple input data samples for the target operation based on the available TEE resources can be achieved by randomly generating multiple input data samples based on the available TEE resources. The size of each input data sample can be matched with K times the size of the available TEE resources, where K can be equal to 1, greater than 1, or less than 1 but greater than 0. For example, K can take values of 1 / 8, 1 / 4, 1 / 2, 1, 2, 4, 8, or other values.
[0099] For example, input data samples are randomly generated sequentially according to 1 / 8, 1 / 4, 1 / 2, 1, 2, 4, and 8 times the size of the available resources of the TEE to obtain multiple input data samples. That is, the multiple input data samples include input data samples that match 1 / 8, 1 / 4, 1 / 2, 1, 2, 4, and 8 times the size of the available resources of the TEE.
[0100] The execution cost in this application embodiment may include execution time and / or resource consumption. Taking execution time as an example, the computer device uses each of the multiple input data samples to perform a target operation in the TEE to determine the TEE execution time corresponding to each input data sample, and performs the target operation in the REE to determine the REE execution time corresponding to each input data sample. Based on the TEE execution time and REE execution time corresponding to the multiple input data samples, the computer device determines the cost transformation relationship.
[0101] Taking the cost transformation relationship as represented by a cost transformation function as an example, a computer device can determine the cost transformation function by fitting based on the TEE execution time and REE execution time corresponding to the multiple input data samples. This application does not limit the specific fitting method; for example, it could be the least squares method.
[0102] Taking the cost transformation relationship represented by a trained neural network model as an example, a computer device can train the neural network model based on the TEE execution time and REE execution time corresponding to the multiple input data samples to obtain the trained neural network model. The embodiments of this application do not limit the structure, framework, training method, etc., of the neural network model. In one possible implementation, the neural network model is a convolutional neural network model.
[0103] In the above implementation, the execution cost of TEE is determined through cost transformation relationship. In some other possible implementations, the execution cost of TEE can also be determined directly based on the statistical information of the second logical plan node, through neural network model or other mapping relationship.
[0104] Step a4: The candidate physical sub-plan with the lowest execution cost among the multiple candidate physical sub-plans is determined as the physical sub-plan in the physical plan tree obtained after transforming the second logical plan node. The multiple candidate physical sub-plans include at least one first candidate physical sub-plan and at least one second candidate physical sub-plan.
[0105] That is, by comparing the execution cost of each first candidate physical sub-plan originally to be executed in the REE with the execution cost of each second candidate physical sub-plan adjusted to be executed in the TEE, it is determined which specific rule in the transformation rules from logical plan to physical plan should be followed to perform the logical operation to physical operation transformation, and whether the physical operation originally to be executed in the REE should be adjusted to be executed in the TEE.
[0106] After steps a1 to a4, the logical plan tree will be transformed into a physical plan tree, and the execution environment of each physical execution node in the physical plan tree has been determined.
[0107] In one possible implementation, steps a1 to a4 above are achieved by performing a depth-first traversal of the logical plan tree. That is, by performing a depth-first traversal of each logical plan node in the logical plan tree, the logical plan tree is gradually converted into a physical plan tree. This will be described in detail below.
[0108] Starting from the root node of the logical plan tree, a depth-first traversal is performed on the logical plan tree to transform it into a physical plan tree. Specifically, when any of the multiple logical plan nodes is reached during the traversal, the following steps are performed on that logical plan node to transform it.
[0109] Step b1: According to the transformation rules from logical plan to physical plan, transform the logical plan node into the i-th type of physical sub-plan, where the i-th type of physical sub-plan includes at least one physical plan node.
[0110] It should be understood that, taking the transformation of the logical plan node according to the transformation rule from logical plan to physical plan as an example, there are a total of N physical sub-plans. Step b1 will be executed N times, where i is a positive integer not greater than N, and the value of i increases successively.
[0111] The logical plan node may be a first logical plan node in step a1 or a second logical plan node in step a2. If the input data attribute of the logical plan node is REE ciphertext, then proceed to step b21. In this case, the logical plan node is actually a first logical plan node in step a1. If the input data attribute of the logical plan node is TEE plaintext, then proceed to step b22. In this case, the logical plan node is actually a first logical plan node in step a1.
[0112] Step b21: Determine the cost of executing the i-th physical sub-plan in the TEE through cost estimation.
[0113] Step b22: Determine the cost of executing the i-th physical sub-plan in the REE through cost estimation.
[0114] After executing step b21, increment the value of i by 1 and return to execute step b1 until i = N, to obtain the cost of executing the Nth physical sub-plan in the TEE. Then, execute step b3.
[0115] Step b3: Determine the physical sub-plan with the lowest execution cost among the above N physical sub-plans as the physical sub-plan in the final physical plan tree obtained after transforming the logical plan node.
[0116] After completing step b22, proceed to step b4.
[0117] Step b4: According to the input data attribute conversion rules, the i-th physical sub-plan (actually a first candidate physical sub-plan in step a2) is converted to obtain the i-th physical sub-plan after execution environment conversion (actually a second candidate physical sub-plan in step a3).
[0118] Specifically, the execution environment can be transformed by inserting TEE encryption / decryption operator nodes, which is also the transformation of input data attributes.
[0119] Step b5: Based on the available resources in the TEE, determine the cost of executing the physical sub-plan after the i-th execution environment transformation in the TEE.
[0120] After executing step b5, increment the value of i by 1 and return to execute step b1 until i = N, to obtain the cost of executing the Nth physical sub-plan in the REE, and the physical sub-plan after the Nth execution environment transformation. Then, execute step b6.
[0121] Step b6: Determine the physical sub-plan with the lowest execution cost among the above N*2 physical sub-plans as the physical sub-plan in the final physical plan tree obtained after transforming the logical plan node.
[0122] The N*2 physical sub-plans here include the N physical sub-plans mentioned above that have not undergone execution environment transformation, as well as the N physical sub-plans that have undergone execution environment transformation.
[0123] After executing step b6, continue traversing the next logical plan node until all logical plan nodes have been executed, thus obtaining the physical plan tree.
[0124] As can be seen, the above process of transforming the logical plan tree into a physical plan tree involves multiple layers of recursive nesting. The outermost layer is a depth-first traversal process, targeting each logical plan node in the logical plan tree. The number of iterations in this process is determined by the total number of logical plan nodes in the logical plan tree. The second layer is a process of transforming the currently traversed logical plan node according to the transformation rules from logical plan to physical plan. For each logical plan node, the number of iterations in this process is determined by the total number of physical subplans that the logical plan node may be transformed into. The third layer, for logical plan nodes with input data attributes of TEE plaintext, requires further transformation of the input data attributes of the physical subplans obtained in the second layer to determine the cost if it is adjusted to be executed in the TEE.
[0125] For the third layer, if a physical sub-plan includes multiple physical plan nodes, there may be a fourth layer. In the fourth layer, these multiple physical plan nodes are traversed (e.g., depth-first traversal) to transform the input data attributes of each physical plan node to determine its cost if it were executed in the TEE. In other words, this application embodiment seeks the physical plan tree with the lowest execution cost by enumerating as many combinations as possible.
[0126] It should be noted that steps b1 to b6 above can also be flexibly adjusted according to the actual situation, and this application embodiment does not limit this. For example, the cost of executing N physical sub-plans in the REE can be determined by executing step b22 multiple times, and then the cost of executing N physical sub-plans after the execution environment transformation in the TEE can be determined by executing steps 4 and 5 multiple times.
[0127] Besides converting the logical plan tree into a physical plan tree as described above, other methods can also be used. For example, the depth-first traversal can be changed to a breadth-first traversal, or the conversion can be performed using relevant technologies.
[0128] Step 103: Determine the TEE plan and REE plan according to the physical plan tree.
[0129] In other words, the computer device splits the physical plan tree into TEE plans and REE plans; in other words, it performs execution plan splitting. This application does not limit the specific splitting method. For example, according to the target execution environment of each physical plan node, the physical plan nodes in the physical plan tree are classified and integrated to split the physical plan tree into one or more REE sub-plans and one or more TEE sub-plans. A TEE plan includes the one or more TEE sub-plans, and an REE plan includes the one or more REE sub-plans.
[0130] In one possible implementation, after classifying and integrating the physical plan nodes in the physical plan tree to split the physical plan tree into one or more REE sub-plans and one or more TEE sub-plans, TEE / REE data exchange nodes are inserted at the splitting points. For example, a TEE data exchange node is inserted on the side of the corresponding TEE sub-plan at the splitting point, and an REE data exchange node is inserted on the side of the corresponding REE sub-plan, i.e., paired TEE / REE data exchange nodes are inserted to facilitate subsequent data interaction via shared memory. The TEE sub-plans after the insertion of TEE data exchange nodes are identified as TEE sub-plans within TEE plans, and the REE sub-plans after the insertion of REE data exchange nodes are identified as REE sub-plans within REE plans.
[0131] Figure 3 This is a schematic diagram illustrating an execution plan splitting method provided in an embodiment of this application. See also... Figure 3 Before the execution plan is split, the five physical plan nodes in the physical plan tree can be divided into three groups through classification and integration. Figure 3 The numbers 1, 2, and 3 are represented respectively. After splitting the execution plan, three physical sub-plans are obtained, which include one TEE sub-plan and two REE sub-plans. Figure 3 As can be seen, during the execution plan splitting process, ENC output nodes, TEE read nodes, and REE read nodes are added at the splitting positions of the above three groups. Among them, the ENC output nodes, TEE read nodes, and REE read nodes are TEE / REE data exchange nodes.
[0132] Step 104: Using the first memory, execute the TEE plan through the database executor in the TEE and the REE plan through the database executor in the REE to obtain the database query results. The first memory is shared by the TEE and REE for data exchange.
[0133] As described above, both the TEE and REE in this embodiment include a database executor, and the REE includes a first memory, which is shared memory. Based on this, after the execution plan is split, the computer device utilizes the first memory to execute the TEE plan through the database executor in the TEE, and executes the REE plan through the database executor in the REE, to obtain the database query results.
[0134] The TEE plan includes one or more TEE sub-plans, and the REE plan includes one or more REE sub-plans. In one implementation, the one or more TEE sub-plans are stored in a TEE thread pool, and the one or more REE sub-plans are stored in an REE thread pool. At least one non-blocking execution node exists in both the TEE and REE plans. During the execution of the non-blocking execution node, the TEE thread pool and the REE thread pool operate in a non-blocking manner. That is, this embodiment supports the parallel execution of TEE threads and REE threads, and the TEE executor and REE executor can employ different degrees of parallelism to ensure that data in shared memory is processed in a timely manner, thereby enabling efficient cooperation between TEE and REE.
[0135] For example, during the execution of a non-blocking execution node by the REE, after obtaining partial intermediate results, these intermediate results can be cached in the first memory. This allows the TEE to simultaneously retrieve these intermediate results from the first memory and use them as input data for a physical plan node in a TEE sub-plan, enabling the simultaneous execution of that physical plan node. It can be seen that the embodiments of this application can fully utilize the characteristics of non-blocking execution nodes, enabling the REE and TEE to leverage the multi-core nature of modern processors and improve execution efficiency.
[0136] It should be understood that a non-blocking execution node may or may not exist in a TEE plan, and similarly, a non-blocking execution node may or may not exist in an REE plan. This application embodiment does not limit this.
[0137] In this embodiment, the data in the first memory is maintained using a lock-free queue, so that both REE and TEE can write data to or read data from the first memory without locking, thereby improving execution efficiency.
[0138] Please refer to the following. Figure 4 The database query method provided in the embodiments of this application will be explained and illustrated again by way of example.
[0139] Figure 4 This is a schematic diagram of the system architecture of a database query method provided in an embodiment of this application. See also... Figure 4 The system architecture includes at least the following parts.
[0140] Query parser: Responsible for receiving SQL query requests to the encrypted database and converting them into an initial logical plan tree to be optimized based on system information.
[0141] Query Optimizer: The unified query optimization is responsible for efficiently searching the overall execution plan (i.e., the physical plan tree). During the unified query optimization phase, starting from the root node of the initial logical plan tree, it iteratively performs execution plan transformation, cost calculation, cost upper bound update, and rule selection (including classic transformation rules and input data attribute transformation rules) to search for the optimal overall execution plan. This includes searching the execution location (TEE or REE) of each execution plan node, the order of multi-table joins, and determining the execution plan node where filter conditions reside. In the execution plan splitting phase, the physical plan nodes in the physical plan tree are categorized according to whether they are executed in a TEE or REE. Based on this, the overall execution plan is split, and data exchange nodes are inserted at the splitting points to divide the overall execution plan into sub-plans that can be executed in either a TEE or REE. The query optimizer sends the final TEE sub-plans to the TEE executor and the REE sub-plans to the REE executor.
[0142] Cost Model Module: During unified query optimization by the query optimizer, cost estimation is required for the candidate physical plan tree obtained through iterative search. Based on the input candidate physical plan tree and with the aid of statistical information, the cost model module estimates the cost of each physical plan node executed in the TEE / REE, and thus estimates the total execution cost of the candidate physical plan tree. Specifically, the cost model module can recursively calculate the cost (denoted as cost) of each subtree in the candidate physical plan tree. subtree The cost of each subtree is then compared with the cost of the root node of the execution plan (denoted as cost). op The total execution cost (denoted as cost) of the candidate physical plan tree is obtained by summing the results.
[0143] The TEE and REE collaborative execution module: The split TEE and REE sub-plans obtained by the query optimizer are sent to the TEE thread pool and REE thread pool respectively for scheduling and execution. Data exchange nodes are implemented in both the TEE and REE executors, divided into output and read types. They appear in pairs within the TEE / REE executors and are responsible for data interaction. Specifically, the TEE and REE executors interact through shared memory held by the data exchange nodes in the REE, enabling collaborative, environment-switching-free asynchronous calls between executors to complete the entire query process and obtain the final database query results.
[0144] The aforementioned system architecture enables efficient computation of SQL queries on encrypted databases. This process mainly consists of two parts. First, query optimization is performed based on the input database query request to obtain the physical plan tree with the lowest total cost, which is then split into sub-plans executed by the TEE and REE respectively. Second, an executor cooperating with the TEE receives the sub-plans obtained in the first part and schedules the query through a thread pool. The TEE and REE executors interact with each other via shared memory, enabling asynchronous mutual calls between them, thereby eliminating the overhead of switching execution environments, and ultimately obtaining the SQL query result.
[0145] As described above, the query optimization in this application mainly includes two parts: unified query optimization and query plan splitting. Compared with related technologies, this application adds a new type of transformation rule in unified query optimization, namely, input data attribute conversion rule. For plaintext intermediate results of plan nodes in the TEE, the input data attribute conversion rule adds a TEE encryption node to convert them into ciphertext intermediate results in the REE; for ciphertext intermediate results of plan nodes in the REE, it adds a TEE decryption node to convert them into plaintext intermediate results in the TEE. By converting the data types of input / output data, the query optimizer is able to efficiently enumerate the execution scenarios of each execution node in the TEE or REE, obtaining the optimal execution plan (i.e., the physical plan tree). In the execution plan splitting process, this application integrates adjacent execution nodes located in the same execution position according to their execution location (in the TEE or REE), thereby dividing the entire execution plan into several sub-plans that execute only in the TEE and several sub-plans that execute only in the REE.
[0146] In the cost estimation process, given a candidate physical plan tree, the cardinality of each physical plan node is first estimated using statistical information. This estimated cardinality is then substituted into the REE cost formula to calculate the cost. REE If a physical plan node is an REE node, meaning its input data attribute is REE ciphertext, then its cost is _cost_. REE If the physical plan node is a TEE node, meaning its input data attribute is TEE plaintext, then its cost is [cost value]. TEE =cost REE *(α+β*I). After determining the cost of all physical plan nodes, we can proceed according to... Figure 4 The cost model formula further estimates the total execution cost of the candidate physical plan trees. This cost estimation is used to prune the query plan, accelerating the search for the optimal physical plan tree.
[0147] Figure 5This is a schematic diagram illustrating the collaborative operation of a TEE and a REE according to an embodiment of this application. See also... Figure 5 The TEE / REE sub-program reads input data from the data source or from the shared memory of the data exchange node, performs corresponding calculations based on the read input data, and returns the results to the user or writes them to the shared memory through the data exchange node for transmission to another execution environment for processing. Pairs of data exchange nodes share a lock-free shared memory block queue. One party (TEE / REE executor) writes new data, and the other party (REE / TEE executor) reads the newly written data, thus achieving data interaction.
[0148] In this context, shared memory utilizes one or more lock-free queues. Figure 5 Taking two examples (using two lock-free queues as an example), each queue maintains multiple shared memory blocks. Threads 1, 2, and 3 in the TEE thread pool perform hash joins and execute sequentially, reading the required data from the memory blocks maintained by the lock-free queues. Multiple threads in the REE thread pool do the same, also performing hash joins to read the required data from the memory blocks maintained by the lock-free queues. Furthermore, threads in the TEE / REE thread pools use a filter table to write data to the free memory blocks maintained by the lock-free queues for transmission to another execution environment. This filter table records information about whether each shared memory block is free.
[0149] Figure 6 This is a flowchart of another database query method provided in the embodiments of this application. Figure 6 Any of the steps in the illustrated method can be adapted for use in conjunction with any of the foregoing embodiments. See also Figure 6 The method includes the following steps.
[0150] Step c1: Establish cost transformation relationships before starting the database (e.g., an encrypted database). For example, before initially starting the database, determine the cost transformation function `cost` through testing. TEE =cost REE The values of the two parameters α and β in *(α+β*I).
[0151] Step c2: The database receives SQL query requests input by the user during operation.
[0152] Step c3: The query parser parses the SQL query request into a logical plan tree to be optimized. This step is a basic preprocessing step during database querying.
[0153] Step c4: Unify query optimization to obtain the optimal execution plan. That is, iteratively transform and estimate the cost of the logical plan tree, updating the minimum execution cost and the optimal physical plan tree. For specific implementation details, please refer to the relevant descriptions in the examples above; they will not be repeated here.
[0154] Step c5: Execution plan splitting to obtain TEE sub-plans and REE sub-plans. That is, the physical plan nodes in the optimal physical plan tree are classified and integrated according to their execution environment (i.e., execution location). Splitting occurs at the execution location boundaries, and paired TEE / REE data exchange nodes are inserted. One side is the output node (i.e., write node), and the other side is the read node (i.e., read node). These paired data exchange nodes interact with each other via shared memory. This ultimately results in one or more TEE sub-plans and one or more REE sub-plans.
[0155] Step c6: Each sub-plan is sent to the TEE or REE thread pool according to its execution position. The thread pool is responsible for scheduling each sub-plan so that the corresponding executor can execute it. Through the collaborative operation of TEE and REE, the database query results are finally obtained.
[0156] Step c7: The encrypted execution result (i.e., the database query result) is returned to the user.
[0157] In summary, in this embodiment, both the TEE and REE include a database executor. Thus, both the TEE and REE can execute their corresponding sub-plans without switching execution environments, eliminating the overhead of execution environment switching. The TEE executor and REE executor interact with each other but do not have a calling relationship, thereby eliminating scheduling overhead. The REE includes a first memory segment, which is shared by the TEE and REE for data interaction, such as exchanging intermediate results. That is, utilizing shared memory (i.e., the first memory) enables the TEE executor and REE executor to cooperate efficiently, improving database query efficiency.
[0158] Figure 7 This is a schematic diagram of the structure of a database query device 700 provided in an embodiment of this application. The device 700 can be implemented as part or all of a computer device by software, hardware, or a combination of both. This computer device can be described later. Figure 8 The computer device or other computer device shown. In the embodiments of this application, both the TEE and REE include a database executor, and the REE includes a first memory, which is shared by the TEE and REE for data exchange. See also Figure 7 The device 700 includes: a first determining module 701, a conversion module 702, a second determining module 703, and an execution module 704.
[0159] The first determining module 701 is used to determine a logical plan tree based on a database query request. The logical plan tree includes multiple logical plan nodes, which represent the operations required to respond to the database query request.
[0160] The conversion module 702 is used to convert the logical plan tree into a physical plan tree. The physical plan tree includes multiple physical plan nodes, and the execution environment of the physical plan nodes is TEE or REE.
[0161] The second determination module 703 is used to determine the TEE plan and REE plan according to the physical plan tree;
[0162] Execution module 704 is used to utilize the first memory to execute the TEE plan through the database executor in the TEE and the REE plan through the database executor in the REE to obtain database query results.
[0163] In one possible implementation, the TEE plan includes one or more TEE sub-plans, and the REE plan includes one or more REE sub-plans. The one or more TEE sub-plans are stored in the TEE thread pool, and the one or more REE sub-plans are stored in the REE thread pool. There is at least one non-blocking execution node in the TEE plan and the REE plan. During the execution of the non-blocking execution node, the TEE thread pool and the REE thread pool operate in a non-blocking manner.
[0164] In one possible implementation, the data in the first memory location is maintained using a lock-free queue.
[0165] In one possible implementation, the conversion module 702 is specifically used for:
[0166] Based on the available resources of TEE, the logical plan tree is transformed into a physical plan tree.
[0167] In one possible implementation, the available resources of the TEE include at least the available memory of the TEE.
[0168] In one possible implementation, the conversion module 702 is specifically used for:
[0169] For each first logical plan node among the multiple logical plan nodes, according to the transformation rules from logical plan to physical plan, the first logical plan node is transformed into a physical sub-plan in the physical plan tree, and the input data attribute of the first logical plan node is REE ciphertext;
[0170] For each of the multiple logical plan nodes, according to the transformation rules from logical plan to physical plan, the second logical plan node is transformed into at least one first candidate physical sub-plan, and the cost of executing each first candidate physical sub-plan in the REE is determined. The input data attribute of the second logical plan node is TEE plaintext, and the at least one first candidate physical sub-plan is different.
[0171] According to the input data attribute conversion rules, the at least one first candidate physical sub-plan is converted to obtain at least one second candidate physical sub-plan. Based on the available resources of TEE, the cost of executing each second candidate physical sub-plan in TEE is determined. The input data attribute of the second candidate physical sub-plan is REE ciphertext.
[0172] The candidate physical sub-plan with the lowest execution cost among multiple candidate physical sub-plans is determined as the physical sub-plan in the physical plan tree obtained after transforming the second logical plan node. The multiple candidate physical sub-plans include at least one first candidate physical sub-plan and at least one second candidate physical sub-plan.
[0173] In one possible implementation, the conversion module 702 is specifically used for:
[0174] For each of the at least one first candidate physical sub-plans, a TEE decryption sub-node is inserted between the first candidate physical sub-plan and its sub-nodes to transform the first candidate physical sub-plan into a second candidate physical sub-plan.
[0175] In one possible implementation, the conversion module 702 is specifically used for:
[0176] Based on the available resources of the TEE and the cost of executing the second candidate physical sub-plan in the REE, the cost of executing the second candidate physical sub-plan in the TEE is determined through cost transformation relationships.
[0177] In one possible implementation, the cost transformation relationship is characterized by a cost transformation function, which includes a first parameter and a second parameter. The first parameter represents the additional computational overhead of executing the second candidate physical sub-plan in the TEE, and the second parameter represents the overhead of performing page replacement in the TEE when the resources used in executing the second candidate physical sub-plan in the TEE exceed the available resources of the TEE.
[0178] In one possible implementation, the cost transformation function is cost. TEE =cost REE *(α+β*I), where cost TEE Cost represents the cost of executing the second candidate physics sub-plan within the TEE. REE I represents the cost of executing the corresponding first candidate physical sub-plan in the REE, where α represents the first parameter and β represents the second parameter. If the resources used in executing the second candidate physical sub-plan in the TEE exceed the available resources of the TEE, I takes the value of 1; if the resources used in executing the second candidate physical sub-plan in the TEE do not exceed the available resources of the TEE, I takes the value of 0.
[0179] In one possible implementation, the device 700 further includes:
[0180] The sample generation module is used to generate multiple input data samples for the target operation based on the available resources of the TEE. The target operation is the operation indicated by the second candidate physical sub-plan.
[0181] The third determination module is used to perform a target operation in the TEE to determine the TEE execution cost corresponding to each input data sample using each of the multiple input data samples, and to perform a target operation in the REE to determine the REE execution cost corresponding to each input data sample.
[0182] The fourth determination module is used to determine the cost transformation relationship based on the TEE execution cost and REE execution cost corresponding to the multiple input data samples.
[0183] In this embodiment, both the TEE and REE include a database executor. Thus, both the TEE and REE can execute their corresponding sub-plans without switching execution environments, eliminating the overhead of execution environment switching. The TEE and REE executors interact with each other but do not have a calling relationship, thereby eliminating scheduling overhead. The REE includes a first memory segment, which is shared by the TEE and REE for data interaction, such as exchanging intermediate results. That is, utilizing shared memory (i.e., the first memory) enables the TEE and REE executors to work efficiently together, improving database query efficiency.
[0184] It should be noted that the database query device provided in the above embodiments is only illustrated by the division of the above functional modules when performing database queries. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the database query device and the database query method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0185] Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. This computer device can be used to perform the above-described... Figures 1 to 6 The database query method in the embodiment includes a computer device comprising one or more processors 801, a communication bus 802, a memory 803, and one or more communication interfaces 804.
[0186] The processor 801 is a general-purpose central processing unit (CPU), a natural network processor (NP), a microprocessor, or one or more integrated circuits for implementing the solutions of this application, such as an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. In some embodiments, the PLD is a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0187] The communication bus 802 is used to transmit information between the aforementioned components. In some embodiments, the communication bus 802 is divided into an address bus, a data bus, a control bus, etc. For ease of illustration, Figure 8 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0188] The memory 803 may be a read-only memory (ROM), random access memory (RAM), electrically erasable programmable read-only memory (EEPROM), optical disc (including compact disc read-only memory (CD-ROM), compressed optical disc, laser disc, digital versatile optical disc, Blu-ray disc, etc.), magnetic disk storage medium, or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto. The memory 803 exists independently and is connected to the processor 801 via a communication bus 802, or the memory 803 is integrated with the processor 801.
[0189] Communication interface 804 uses any transceiver-like device for communicating with other devices or communication networks. Communication interface 804 includes a wired communication interface and / or a wireless communication interface. The wired communication interface may be, for example, an Ethernet interface. The Ethernet interface can be an optical interface, an electrical interface, or a combination thereof. The wireless communication interface may be a wireless local area network (WLAN) interface, a cellular network communication interface, or a combination thereof.
[0190] In some embodiments, the computer device includes multiple processors, such as Figure 8 The processors 801 and 805 shown are illustrated. Each of these processors is either a single-core processor or a multi-core processor. Here, a processor refers to one or more devices, circuits, and / or processing cores used to process data (such as computer program instructions).
[0191] In some embodiments, the computer device further includes an output device 806 and an input device 807. The output device 806 communicates with the processor 801 and can display information in various ways. For example, the output device 806 may be a liquid crystal display (LCD), a light-emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector. The input device 807 communicates with the processor 801 and can receive user input in various ways. For example, the input device 807 may be a mouse, keyboard, touchscreen device, or sensing device.
[0192] In some embodiments, memory 803 stores program code 810 for executing the scheme of this application, and processor 801 is capable of executing the program code 810 stored in memory 803. The program code includes one or more software modules, and the computer device can implement the above-described scheme through processor 801 and program code 810 in memory 803. Figure 1 The database query method provided in this embodiment. For example, in the computer device including... Figure 7 In the case of the database query device shown, the program code may include Figure 7 One or more of the first determining module, the transformation module, the second determining module, and the execution module in the process.
[0193] The database query method provided in this application can be applied to a wide variety of database systems, including database systems in various industries. For database query requests with data confidentiality requirements, any possible implementation of this solution can be applied to reduce the execution cost of database queries and improve database query performance.
[0194] The device architecture and business scenarios described in the embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in the embodiments of this application. As those skilled in the art will know, with the evolution of device architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0195] This application also provides a computer-readable storage medium storing instructions that, when run on a computer, cause the computer to perform the steps of the database query method shown in the above-described method embodiments.
[0196] This application also provides a computer program product containing instructions that, when run on a computer, causes the computer to perform the steps of the database query method shown in the above-described method embodiments. Alternatively, this application also provides a computer program that, when run on a computer, causes the computer to perform the steps of the database query method shown in the above-described method embodiments.
[0197] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer, or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital versatile disc (DVD)), or a semiconductor medium (e.g., solid state disk (SSD)). It is worth noting that the computer-readable storage medium mentioned in the embodiments of this application can be a non-volatile storage medium; in other words, it can be a non-transient storage medium.
[0198] It should be understood that "at least one" as mentioned herein refers to one or more, and "multiple" refers to two or more. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. In addition, in order to clearly describe the technical solutions of the embodiments of this application, the terms "first," "second," etc., are used in the embodiments of this application to distinguish identical or similar items with substantially the same function and effect. Those skilled in the art will understand that the terms "first," "second," etc., do not limit the quantity or execution order, and the terms "first," "second," etc., are not necessarily different.
[0199] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, data stored, data displayed, etc.) and signals involved in the embodiments of this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0200] The above descriptions are embodiments provided in this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A database query method, characterized in that, Both the Trusted Execution Environment (TEE) and the Rich Execution Environment (REE) contain a database executor. The REE includes a first memory, which is shared by the TEE and the REE for data exchange. The method includes: Based on the database query request, a logical plan tree is determined. The logical plan tree includes multiple logical plan nodes, which represent the operations required to respond to the database query request. The logical plan tree is transformed into a physical plan tree, which includes multiple physical plan nodes. The execution environment of each physical plan node is the TEE or the REE. Based on the physical plan tree, determine the TEE plan and REE plan; Using the first memory, the TEE plan is executed by the database executor in the TEE, and the REE plan is executed by the database executor in the REE, to obtain the database query results.
2. The method as described in claim 1, characterized in that, The TEE plan includes one or more TEE sub-plans, and the REE plan includes one or more REE sub-plans. The one or more TEE sub-plans are stored in the TEE thread pool, and the one or more REE sub-plans are stored in the REE thread pool. At least one non-blocking execution node exists in the TEE plan and the REE plan. During the execution of the non-blocking execution node, the TEE thread pool and the REE thread pool operate in a non-blocking manner.
3. The method as described in claim 1 or 2, characterized in that, The data in the first memory is maintained using a lock-free queue.
4. The method according to any one of claims 1-3, characterized in that, The step of converting the logical plan tree into a physical plan tree includes: Based on the available resources of the TEE, the logical plan tree is transformed into the physical plan tree.
5. The method as described in claim 4, characterized in that, The available resources of the TEE include at least the available memory of the TEE.
6. The method as described in claim 4 or 5, characterized in that, The process of converting the logical plan tree into the physical plan tree based on available TEE resources includes: For each first logical plan node among the plurality of logical plan nodes, according to the transformation rules from logical plan to physical plan, the first logical plan node is transformed into a physical sub-plan in the physical plan tree, and the input data attribute of the first logical plan node is REE ciphertext; For each second logical plan node among the plurality of logical plan nodes, according to the transformation rules from logical plan to physical plan, the second logical plan node is transformed into at least one first candidate physical sub-plan, and the cost of executing each first candidate physical sub-plan in the REE is determined. The input data attribute of the second logical plan node is TEE plaintext, and the at least one first candidate physical sub-plan is different. According to the input data attribute conversion rules, the at least one first candidate physical sub-plan is converted to obtain at least one second candidate physical sub-plan. Based on the available resources of the TEE, the cost of executing each second candidate physical sub-plan in the TEE is determined. The input data attribute of the second candidate physical sub-plan is REE ciphertext. The candidate physical sub-plan with the lowest execution cost among multiple candidate physical sub-plans is determined as the physical sub-plan in the physical plan tree obtained after transforming the second logical plan node. The multiple candidate physical sub-plans include at least one first candidate physical sub-plan and at least one second candidate physical sub-plan.
7. The method as described in claim 6, characterized in that, The step of transforming the at least one first candidate physical sub-plan according to the input data attribute transformation rules to obtain at least one second candidate physical sub-plan includes: For each of the at least one first candidate physical sub-plans, a TEE decryption operator sub-node is inserted between the first candidate physical sub-plan and its sub-nodes to transform the first candidate physical sub-plan into the second candidate physical sub-plan.
8. The method as described in claim 6 or 7, characterized in that, The determination of the cost of executing each second candidate physical sub-plan within the TEE based on the available resources of the TEE includes: Based on the available resources of the TEE and the cost of executing the second candidate physical sub-plan in the REE, the cost of executing the second candidate physical sub-plan in the TEE is determined through a cost transformation relationship.
9. The method as described in claim 8, characterized in that, The cost transformation relationship is characterized by a cost transformation function, which includes a first parameter and a second parameter. The first parameter represents the additional computational overhead of executing the second candidate physical sub-plan in the TEE, and the second parameter represents the overhead of performing page replacement in the TEE when the resources used in executing the second candidate physical sub-plan in the TEE exceed the available resources of the TEE.
10. The method as described in claim 9, characterized in that, The cost transformation function is cost. TEE =cost REE *(α+β*I), where the cost TEE This represents the cost of executing the second candidate physical sub-plan within the TEE. REE I represents the cost of executing the corresponding first candidate physical sub-plan in the REE, where α represents the first parameter and β represents the second parameter. When the resources used in executing the second candidate physical sub-plan in the TEE exceed the available resources of the TEE, I is 1; when the resources used in executing the second candidate physical sub-plan in the TEE do not exceed the available resources of the TEE, I is 0.
11. The method according to any one of claims 8-10, characterized in that, Before determining the cost of executing the second candidate physical sub-plan in the TEE through cost transformation relationships, the method further includes: Based on the available resources of the TEE, multiple input data samples of the target operation are generated, wherein the target operation is the operation indicated by the second candidate physical sub-plan. Using each of the multiple input data samples, the target operation is performed in the TEE to determine the TEE execution cost corresponding to each input data sample, and the target operation is performed in the REE to determine the REE execution cost corresponding to each input data sample; Based on the TEE execution cost and REE execution cost corresponding to the multiple input data samples, the cost transformation relationship is determined.
12. A database query device, characterized in that, Both the Trusted Execution Environment (TEE) and the Rich Execution Environment (REE) contain a database executor. The REE includes a first memory, which is shared by the TEE and the REE for data exchange. The device includes: The first determining module is used to determine a logical plan tree based on a database query request. The logical plan tree includes multiple logical plan nodes, which represent the operations required to respond to the database query request. A conversion module is used to convert the logical plan tree into a physical plan tree, wherein the physical plan tree includes multiple physical plan nodes, and the execution environment of the physical plan nodes is the TEE or the REE; The second determining module is used to determine the TEE plan and the REE plan according to the physical plan tree; An execution module is used to utilize the first memory to execute the TEE plan through the database executor in the TEE, and to execute the REE plan through the database executor in the REE, so as to obtain database query results.
13. The apparatus as claimed in claim 12, characterized in that, The TEE plan includes one or more TEE sub-plans, and the REE plan includes one or more REE sub-plans. The one or more TEE sub-plans are stored in the TEE thread pool, and the one or more REE sub-plans are stored in the REE thread pool. At least one non-blocking execution node exists in the TEE plan and the REE plan. During the execution of the non-blocking execution node, the TEE thread pool and the REE thread pool operate in a non-blocking manner.
14. The apparatus as claimed in claim 12 or 13, characterized in that, The data in the first memory is maintained using a lock-free queue.
15. The apparatus according to any one of claims 12-14, characterized in that, The conversion module is specifically used for: Based on the available resources of the TEE, the logical plan tree is transformed into the physical plan tree.
16. The apparatus as claimed in claim 15, characterized in that, The available resources of the TEE include at least the available memory of the TEE.
17. The apparatus as claimed in claim 15 or 16, characterized in that, The conversion module is specifically used for: For each first logical plan node among the plurality of logical plan nodes, according to the transformation rules from logical plan to physical plan, the first logical plan node is transformed into a physical sub-plan in the physical plan tree, and the input data attribute of the first logical plan node is REE ciphertext; For each second logical plan node among the plurality of logical plan nodes, according to the transformation rules from logical plan to physical plan, the second logical plan node is transformed into at least one first candidate physical sub-plan, and the cost of executing each first candidate physical sub-plan in the REE is determined. The input data attribute of the second logical plan node is TEE plaintext, and the at least one first candidate physical sub-plan is different. According to the input data attribute conversion rules, the at least one first candidate physical sub-plan is converted to obtain at least one second candidate physical sub-plan. Based on the available resources of the TEE, the cost of executing each second candidate physical sub-plan in the TEE is determined. The input data attribute of the second candidate physical sub-plan is REE ciphertext. The candidate physical sub-plan with the lowest execution cost among multiple candidate physical sub-plans is determined as the physical sub-plan in the physical plan tree obtained after transforming the second logical plan node. The multiple candidate physical sub-plans include at least one first candidate physical sub-plan and at least one second candidate physical sub-plan.
18. The apparatus as claimed in claim 17, characterized in that, The conversion module is specifically used for: For each of the at least one first candidate physical sub-plans, a TEE decryption operator sub-node is inserted between the first candidate physical sub-plan and its sub-nodes to transform the first candidate physical sub-plan into the second candidate physical sub-plan.
19. The apparatus as claimed in claim 17 or 18, characterized in that, The conversion module is specifically used for: Based on the available resources of the TEE and the cost of executing the second candidate physical sub-plan in the REE, the cost of executing the second candidate physical sub-plan in the TEE is determined through a cost transformation relationship.
20. The apparatus as claimed in claim 19, characterized in that, The cost transformation relationship is characterized by a cost transformation function, which includes a first parameter and a second parameter. The first parameter represents the additional computational overhead of executing the second candidate physical sub-plan in the TEE, and the second parameter represents the overhead of performing page replacement in the TEE when the resources used in executing the second candidate physical sub-plan in the TEE exceed the available resources of the TEE.
21. The apparatus as claimed in claim 20, characterized in that, The cost transformation function is cost. TEE =cost REE *(α+β*I), where the cost TEE This represents the cost of executing the second candidate physical sub-plan within the TEE. REE I represents the cost of executing the corresponding first candidate physical sub-plan in the REE, where α represents the first parameter and β represents the second parameter. When the resources used in executing the second candidate physical sub-plan in the TEE exceed the available resources of the TEE, I is 1; when the resources used in executing the second candidate physical sub-plan in the TEE do not exceed the available resources of the TEE, I is 0.
22. The apparatus according to any one of claims 19-21, characterized in that, The device further includes: The sample generation module is used to generate multiple input data samples for the target operation based on the available resources of the TEE, wherein the target operation is the operation indicated by the second candidate physical sub-plan; The third determining module is used to perform the target operation in the TEE to determine the TEE execution cost corresponding to each input data sample using each of the multiple input data samples, and to perform the target operation in the REE to determine the REE execution cost corresponding to each input data sample. The fourth determining module is used to determine the cost transformation relationship based on the TEE execution cost and REE execution cost corresponding to the multiple input data samples.
23. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the method described in any one of claims 1-11.
24. A computer program product, characterized in that, The computer program product stores computer instructions, which, when executed by a processor, implement the method described in any one of claims 1-11.