Application of a simplification method for conjunctive normal form probabilistic constraints in load simulation

By simplifying the conjunctive normal form probabilistic constraints, the simulation problem of complex logical expressions in load simulation is solved, the simulation complexity is reduced, and the simulation efficiency is improved.

CN115935699BActive Publication Date: 2026-02-24EAST CHINA NORMAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211725929.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-30
Publication Date
2026-02-24
Estimated Expiration
2042-12-30

AI Technical Summary

Technical Problem

Existing load simulation techniques struggle to effectively handle probabilistic constraints in complex logical expressions, especially conjunctive normal form probabilistic constraints, leading to high complexity in the simulation process.

Method used

A simplification method using conjunctive normal form probabilistic constraints is adopted. By extracting disjunctive clauses and reducing effective disjunctive clauses and relational expressions, complex logical expressions are simplified into simpler expressions, thereby reducing simulation complexity.

Benefits of technology

This significantly reduces the complexity of load simulation, enabling existing parameter instantiation algorithms to handle probabilistic constraints of more complex logical expressions and improving simulation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115935699B_ABST
    Figure CN115935699B_ABST
Patent Text Reader

Abstract

The application discloses a simplification method of a conjunctive normal form probability constraint, and comprises the following steps: given a conjunctive normal form probability constraint, extracting all disjunction clauses in the conjunctive normal form expression in the SQL predicate of the probability constraint; setting the parameters in the relational expression in each disjunction clause, setting as many disjunction clauses as possible to be true, and reducing effective disjunction clauses; further, setting the parameters in the relational expression in the remaining disjunction clauses, and reducing effective relational expressions; finally, simplifying the original expression into a relational expression, a disjunction of multiple non-equivalent relational expressions, or a conjunction of multiple equivalent relational expressions; and finally obtaining the simplified probability constraint.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the fields of database technology and load simulation, and particularly relates to a method for simplifying conjunctive normal form probability constraints and its application. Background Technology

[0002] Today, traditional benchmarks (such as SSB, TPC-H, and TPC-DS) are struggling to simulate an increasing number of application scenarios. When evaluating database systems or migrating applications, the simulation and modeling of the original application scenarios become increasingly important.

[0003] Regarding this question, SIGMOD 2007's QAGen [2] A query-aware database generator was proposed. [1-7] This method analyzes query plans for specific workloads to generate a simulated database and a set of simulated queries for testing. This ensures that, when using the same query plan, simulated queries executed on the generated database and original queries executed on the original database produce the same intermediate results (i.e., the input and output of each corresponding operator are identical). This allows the database generator to obtain query performance-related characteristics. This is very helpful for database performance evaluation, especially in HTAP databases where the size of the intermediate result set is a crucial metric for query performance.

[0004] In load simulation, the most important aspect is ensuring that each operator satisfies the corresponding probabilistic constraints. Specifically, given a selection operator in the original query and its corresponding selection operator in the simulation query, the number of input rows and output rows for both operators must be equal. Previous work... [1-7] The adapted predicates are either simple relational expressions or simple logical expressions (i.e., logical expressions containing only one of the AND or OR logical operators). Adaptation for complex logical expressions (i.e., logical expressions containing both AND and OR logical operators) has not been addressed. This is because complex logical expressions often involve multiple columns of a table, and handling the join probability of multiple columns would introduce significant complexity to the database simulation process, which has been proven to be an NP-hard problem. Summary of the Invention

[0005] To address the challenge of simulating probabilistic constraints for complex logical operators whose SQL predicate conditions are complex logical expressions, this invention proposes a simplification method for conjunctive normal form (Conjunctive Normal Form) probabilistic constraints. The core idea is to disregard the probabilistic constraints of each sub-relation expression within the complex logical expression and only simulate the probabilistic constraints corresponding to the entire complex logical expression. Since most complex logical expressions in real-world production environments are in Conjunctive Normal Form, this invention targets complex logical expressions that satisfy Conjunctive Normal Form. The simplification method for complex logical expressions satisfying Conjunctive Normal Form is based on two rules in logical computation: Rule 1: CL i ←T, that is, when CL i When the output of CL is true, i ∧CL j The result depends only on CL j And not dependent on CL i Rule Two: CL i ←F, that is, when CL i When the output of CL is false, i ∨CL j The result depends only on CL j And not dependent on CL i Using this method, complex logical expressions can be simplified into a single relational expression, a conjunction of several equivalence relational expressions, or a disjunction of several non-equivalence relational expressions.

[0006] The present invention specifically includes the following steps:

[0007] Step 1: Extracting Disjunction Clauses. Given a conjunctive normal form probability constraint P(Conjunction) = pb, its SQL predicate Conjunction is in the form of a conjunctive normal form expression. Several disjunction clauses are extracted using the conjunctive operators in the conjunctive normal form expression. Each disjunction clause CL (clause) may be a single relational expression or a disjunctive form of several relational expressions. The disjunctive form of several relational expressions can be represented as CL = Predicate1 ∨ Predicate2 ∨ ... Predicate n Predicate i It is a relational expression.

[0008] The SQL predicate is in the form of a conjunctive normal form expression, which is the conjunctive form of multiple disjunctive clauses, namely CL1∧CL2…CL1. n .

[0009] Step 2: Reduce the valid disjunctive clauses. The disjunctive clauses in Step 1 are divided into two types. One is a relational expression, and the other is a disjunctive form of several relational expressions.

[0010] In Step 2, the form of the relational expression Predicate is xΘp, where x is a single variable or an arithmetic expression, p is a parameter, and Θ is a relational operator, including >, <, ≥, ≤, =, ≠, in, not in, like, not like. Among them, Predicate= is an equivalent relational expression, that is, the relational operator is =, in, like; Predicate ≠ is a non-equivalent relational expression, that is, the relational operator is ≠, not in, not like; Predicate <> is an unequal relational expression, that is, the relational operator is <, ≤, >, ≥.

[0011] If the disjunctive clause is a single relational expression and this relational expression is a non-equivalent relational expression or an unequal relational expression, it is simplified by Rule 1. Rule 1 means CL i ←T, that is, when the output result of CL i is true, the result of CL i ∧CL j only depends on CL j and does not depend on CL i .

[0012] The method for judging whether a single relational expression can be simplified is as follows: If the form of the relational expression is x≤p or x<p, the parameter p can be set to k (k is the upper bound of the value range of x) so that the output of the relational expression is true, indicating that the relational expression can be simplified. If the form of the relational expression is x≥p or x>p, the parameter p is set to -k (-k is the lower bound of the value range of x) so that the output of the relational expression is true, indicating that the relational expression can be simplified. If the form of the relational expression is x≠p or x not in p or x not like p, then p is set to the null value null, and the output is true, indicating that it can be simplified. Finally, all reducible disjunctive clauses are cut off.

[0013] If the disjunctive clause is a disjunctive form of several relational expressions, as long as the logical value of any one of the relational expressions can be set to true, then this disjunctive clause is cut off.

[0014] If all disjunctive clauses can be cut off, then any one disjunctive clause is retained;

[0015] Step 3: Reduce valid relational expressions. For the remaining disjunctive clauses, set boundary value parameters for each equivalence relational expression and non-equivalence relational expression therein, and determine whether the output of the relational expression is false. If it is false, it can be simplified by Rule 2, and the Rule 2 refers to CL i ←F, that is, when the output result of CL i is false, the result of CL i ∨CL j only depends on CL j and does not depend on CL i .

[0016] The specific judgment method is as follows: If the form of the relational expression is x≤p or x<p, it means that it can make the output of the relational expression false by setting the parameter p to -a (-a is the lower bound of the value range of x), proving that it can be simplified. If the form of the relational expression is x≥p or x>p, it means that it can make the output of the relational expression false by setting the parameter p to a (a is the upper bound of the value range of x), proving that it can be simplified. If the form of the relational expression is x = p or x in p or x like p, it means that it can make the output false by setting p to the null value null, proving that it can be simplified. Finally, cut off all relational expressions that can be simplified.

[0017] If the number of remaining clauses in Step 2 exceeds one, the simplification result of each disjunctive clause must be a single equivalence relational expression. Perform a conjunction operation on the single equivalence relational expressions obtained by simplifying each disjunctive clause as the finally returned relational expression. If the number of remaining clauses in Step 2 is one, the simplification result of the disjunctive clause must be a single relational expression or a disjunction of multiple non-equivalence relational expressions.

[0018] Replace the original expression with the simplified expression obtained by reducing disjunctive sub-forms and reducing relational expressions, denoted as the simplified probability constraint. The method for obtaining the simplified probability constraint is to replace the SQL predicate of the conjunctive normal form probability constraint input in Step 1 with the simplified expression, that is, replace Conjunction in P(Conjunction)=pb with the simplified expression.

[0019] The present invention also proposes an application of the above simplification method for conjunctive normal form probability constraints in load simulation.

[0020] The main innovation of this invention lies in significantly reducing the complexity of load simulation. Existing load simulation strategies only concern themselves with the ratio of the number of input and output tuples for each operator—that is, the percentage of tuples satisfying complex logical expressions out of the total number of input tuples—without considering the probabilistic constraints of the sub-relational expressions within those complex logical expressions. Therefore, this invention simplifies complex logical expressions to obtain simpler expressions and ultimately simpler probabilistic constraints. This allows existing parameter instantiation algorithms in the load simulation field to handle fewer probabilistic constraints, enabling current load simulation strategies to simulate the probabilistic constraints of complex logical expressions. Attached Figure Description

[0021] Figure 1 This is a schematic diagram of the probability constraint simplification of the present invention.

[0022] Figure 2 This is a flowchart of the present invention. Detailed Implementation

[0023] The present invention will be further described in detail below with reference to the specific embodiments and accompanying drawings. Except for the contents specifically mentioned below, the processes, conditions, and experimental methods for implementing the present invention are all common knowledge and general knowledge in the art, and the present invention does not have any particular limitations.

[0024] This invention relates only to a part of the overall load simulation process, namely, a simulation method for complex logical probabilistic constraints, which can be used in the subsequent parameter instantiation part. The main purpose of this invention is to provide a simplified method for existing load simulation methods.

[0025] This invention, given a conjunctive normal form probability constraint, extracts all disjunctive clauses from the conjunctive normal form expression of its SQL predicate. By setting parameters in the relational expressions of each disjunctive clause, as many disjunctive clauses as possible are made true, reducing the number of effective disjunctive clauses. Furthermore, by setting parameters in the relational expressions of the remaining disjunctive clauses, the number of effective relational expressions is reduced. Finally, the original expression is simplified to a single relational expression, or the disjunction of multiple non-equivalence relational expressions, or the conjunctive of multiple equivalence relational expressions. The simplified probability constraint is then obtained.

[0026] This invention addresses the implementation of a simplified simulation method based on probabilistic constraints, and includes the following steps:

[0027] 1. Extracting Disjunction Clauses. Given a conjunctive normal form logical expression P(Coujunction) = pb, its SQL predicate Conjunction is also a conjunctive normal form expression. By definition, a conjunctive normal form expression can be transformed into a conjunctive form of several disjunctive clauses, CL1∧CL2∧...CL1. n Among them, CLi (1≤i≤n) may be a single relational expression or a disjunctive form of multiple relational expressions, i.e., CL i =Predicate1∨...∨Predicate n .

[0028] 2. Reduce effective disjunctive clauses. Given the conjunction constructed in step one, its disjunctive clauses have two forms: one is a single relational expression, and the other is a disjunctive form of several relational expressions. Different methods are used to judge these two forms of disjunctive clauses. For a single relational expression, for non-equivalence and inequality relational expressions, if the relational operator Θ is < or ≤, the output of the simple relational expression can be made true by adjusting the parameter p to k (where k refers to the upper bound of the range of variable x); if the relational operator Θ is > or ≥, the output of the simple relational expression can be made true by adjusting the parameter p to -k (where -k refers to the lower bound of the range of variable x); if the relational operator Θ is ≠, not in, or not like, the output of the relational expression can be made true by adjusting the parameter p to null. If the relational expression can output true in this way, then by the rule... CL i From ←T, we know that the output of a given conjunctive normal form expression may not depend on the relational expression, meaning the relational expression can be simplified. Then, we eliminate all relational expressions that can be simplified.

[0029] For disjunctions of multiple relational expressions, if any one of the relational expressions can be set to true, the entire disjunction clause can be simplified. If all disjunction clauses can be simplified, one is retained arbitrarily. If the number of remaining clauses exceeds one, since the probability constraints of non-equivalence symbols are all set to true and simplified, each remaining disjunction clause must be a disjunction of an equivalence relational expression. If a disjunction clause contains any other form of relational expression, then that disjunction clause can be simplified.

[0030] 3. Reduce the number of valid relational expressions. For all remaining disjunctive clauses, simplify each relational expression, including equivalence and inequality expressions. If the relational operator Θ is < or ≤, the output of the relational expression can be made false by adjusting the parameter p to -a (where -a refers to the lower bound of the range of variable x); if the relational operator Θ is > or ≥, the output of the relational expression can be made false by adjusting the parameter p to a (where a refers to the upper bound of the range of variable x); if the relational operator Θ is =, in, or like, the output of the relational expression can be made false by adjusting the parameter p to null. If a relational expression can be made false in this way, then by the rule... CLi As we can see from F, the output of a given conjunctive normal form expression may not depend on the relational expression itself; that is, the simple relational expression can be simplified. Then, we eliminate all relational expressions that can be simplified.

[0031] If there is more than one remaining clause in step two, then each disjunctive clause must be a disjunction of an equivalence relation expression. Therefore, the simplified result of each disjunctive clause must be a single equivalence relation expression. A conjunction operation is performed on the single equivalence relation expression obtained from the simplification of each disjunctive clause, and this is used as the final returned relation expression. If there is only one remaining clause in step two, then the simplified result of the disjunctive clause must be a single relation expression, or a disjunction of multiple non-equivalence relation expressions.

[0032] Example

[0033] Based on the definition of the data imputation problem above, the input of this method is a conjunctive normal form expression in an SQL predicate. The implementation process of this method includes three steps: extracting disjunctive clauses, reducing the number of valid disjunctive clauses, and reducing the number of valid relational expressions. The output of this method is a simple logical probability constraint.

[0034] Extracting the disjunctive clause: As shown in the attached diagram, given a conjunctive normal form logical expression P((t1=p1∨t2>p2)∧(t3≤p3))=pb, where the SQL predicate is a conjunctive normal form expression, i.e., (t1=P1∨t2>P2)∧(t3≤P3), this conjunctive normal form expression consists of a disjunctive expression and a single relational expression, namely t1=P1∨t2>P2 and t3≤P3, respectively. P1, P2, and P3 are parameters.

[0035] Reduce effective disjunctive clauses: as shown in the appendix Figure 1 As shown in step two, for a single relational expression t3≤P3 in the two disjunctive clauses obtained in step one, setting the parameter P3 to ∞ (here referring to the upper bound of the range of variable t3) will result in the output of the relational expression being true, according to the rule. CL i As can be seen from T, the output of a given conjunctive normal form expression may not depend on the simple relational expression, so the simple relational expression can be simplified.

[0036] Reduce the number of valid relational expressions: as shown in the appendix Figure 1 As shown in step three, for the conjunction t1 = P1 ∨ t2 > P2, its two disjunctive clauses are t1 = P1 and t2 > P2. For the relational expression t2 > P2, setting P2 to ∞ (here referring to the upper bound of the range of variable t2), the output of t2 > P2 is false. Then, according to the rule... CL iAs can be seen from F, the output of a given conjunctive normal form expression may not depend on the simple relational expression, so the simple relational expression can be simplified. The simplified result is t1 = P1. Finally, the simplified probability constraint is P(t1 = P1) = pb.

[0037] References

[0038] [1]Gilad A, Patwa S, Machanavajjhala A. Synthesizing linked data under cardinality and integrity constraints, ICMD 2021.

[0039] [2] Binnig C, Kossmann D, Lo E, et al. QAGen: generating query-aware testdatabases, SIGMOD 2007.

[0040] [3].ArasuA,KaushikR,Li J.Data generation using declara-tiveconstraints,SIGMOD 2011.

[0041] [4]Lo E,ChengN,Hon W K.Generating databases for query workloads,VLDB2010.

[0042] [5]Li Y, Zhang R, Yang X, et al. Touchstone: Generating Enormous{Query-Aware}Test Databases, USENIXATC 2018.

[0043] [6] Sanghi A, Sood R, Haritsa JR, et al. Scalable and Dynamic Regeneration of Big Data Volumes, EDBT 2018.

[0044] [7] Lo E, Cheng N, Lin WWK, et al. MyBenchmark: generating databases for query workloads, VLDB 2014. The scope of protection of this invention is not limited to the above embodiments. Variations and advantages that can be conceived by those skilled in the art without departing from the spirit and scope of the inventive concept are included in this invention and are protected by the appended claims.

Claims

1. A database load simulation method based on conjunctive normal form probabilistic constraint simplification, characterized in that, Includes the following steps: Step 1: Extract disjunctive clauses: Given a conjunctive normal form probability constraint, the SQL predicate of the probability constraint is in the form of a conjunctive normal form expression. Extract the disjunctive clauses from the conjunctive normal form expression; the disjunctive clauses include disjunctions of a single relational expression or several relational expressions. Step 2: Reduce effective disjunction clauses: If the disjunction clause in Step 1 is a single relational expression, determine whether its logical value can be set to true by setting its parameter as a boundary value. If it can, reduce the disjunction clause. If the disjunction clause in Step 1 is a disjunction of several relational expressions, reduce the disjunction clause as long as the logical value of any one of the relational expressions can be set to true. If all disjunction clauses can be reduced, retain any one of the disjunction clauses. Step 3: Reduce valid relational expressions: For the remaining disjunction clauses in Step 2, each relational expression is evaluated by setting its parameters as boundary values ​​to determine if its logical value can be set to false. If it can, the relational expression is reduced. If the number of remaining clauses in Step 2 exceeds one, the simplified result of each disjunction clause must be a single equivalent relational expression. Perform a conjunction operation on the single equivalent relational expression obtained by simplifying each disjunction clause, and use it as the final returned relational expression. If there is only one clause remaining in step two, the simplified result of the disjunction clause must be a single relational expression or a disjunction of multiple non-equivalence relational expressions. Finally, the original expression is replaced with the expression simplified by reducing the disjunction and relational expressions to obtain the simplified probability constraint.

2. The method as described in claim 1, characterized in that, In step one, the conjunctive normal form probability constraint is in the form of P(Conjunction) = pb, which means that the percentage of tuples in a certain table of the database that satisfy the SQL predicate condition Conjunction is Pb out of the total number of tuples in the table, where the predicate condition Conjunction satisfies conjunctive normal form.

3. The method as described in claim 1, characterized in that, In step one, the conjunctive normal form expression in the SQL predicate is a conjunctive form of multiple disjunctive clauses, i.e., CL1∧CL2…CL1. n .

4. The method as described in claim 1, characterized in that, In step two, the relational expression Predicate has the form xΘp, where x is a single variable or arithmetic expression, p is a parameter, and Θ is a relational operator, including >, <, ≥, ≤, =, ≠, in, not in, like, not like; where Predicate = is an equivalence relational expression, i.e., a relational expression with the relational operators =, in, and like; Predicate ≠ This is a non-equivalence relational expression, i.e., a relational expression with the relational operators ≠, NOT IN, and NOT LIKE; Predicate <> This is an inequality relation expression, that is, a relation expression with relational operators <, ≤, >, and ≥.

5. The method as described in claim 1, characterized in that, In step two, when the disjunction clause CL is a disjunction of several relational expressions, it is represented as CL = Predicate1∨Predicate2∨…Predicate n Predicate i It is a relational expression.

6. The method as described in claim 1, characterized in that, In step two, the simplification of the conjunctive normal form expression is based on rule one: That is, when CL i When the output of CL is true, i ∧CL j The result depends only on CL j And not dependent on CL i Rule Two: That is, when CL i When the output of CL is false, i ∨CL j The result depends only on CL j And not dependent on CL i .

7. The method as described in claim 1, characterized in that, In step two, the method for determining whether a disjunction clause can be simplified is as follows: if the disjunction clause is a single relational expression, then boundary value parameters are set for the inequality relational expression and the non-inequality relational expression, and it is determined whether the output of the relational expression is true. If it is true, then simplification can be performed. In step two, if the disjunction clause is a disjunction of several relational expressions, the disjunction clause can be reduced if any one of the relational expressions constituting the disjunction clause can be set to true; if all disjunction clauses can be reduced, then any one can be retained.

8. The method as described in claim 7, characterized in that, When the disjunctive clause is a single relational expression, the specific method for judging whether the relational expression can be simplified is as follows: If the form of the relational expression is x ≤ p or x < p, then the output of the relational expression is made true by setting the parameter p to the upper bound of the value range of x; if the form of the relational expression is x ≥ p or x > p, then the output of the relational expression is made true by setting the parameter p to the lower bound of the value range of x; if the form of the relational expression is x ≠ p or x not in p or x not like p, then the output is made true by setting p to the null value.

9. The method as described in claim 1, characterized in that, In step three, the method for judging whether a relational expression can be simplified is as follows: If the disjunctive clause is in the disjunctive form of several relational expressions, then boundary value parameters are set for each non-equivalent relational expression and equivalent relational expression that make up this disjunctive form, and it is judged whether the output of the relational expression is false. If it is false, then it can be simplified. The specific method for judging whether a relational expression can be simplified is as follows: If the form of the relational expression is x ≤ p or x < p, then the output of the relational expression is made false by setting the parameter p to the lower bound of the value range of x, proving that it can be simplified; if the form of the relational expression is x ≥ p or x > p, then the output of the relational expression is made false by setting the parameter p to the upper bound of the value range of x, proving that it can be simplified; if the form of the relational expression is x = p or x in p or x like p, then the output is made false by setting p to the null value, proving that it can be simplified.

10. The method as described in claim 1, characterized in that, In step three, if the number of remaining clauses in step two exceeds one, then the simplification result of each disjunctive clause must be a single equivalent relational expression, and a conjunction operation is performed on the single equivalent relational expressions obtained by simplifying each disjunctive clause as the finally returned relational expression; If the number of remaining clauses in step two is one, then the simplification result of the disjunctive clause must be a single relational expression or a disjunctive form of multiple non-equivalent relational expressions.