A quantum circuit-based relation table storage method

By using a quantum circuit-based approach, a quantum-compatible relational table format is generated, solving the problem of storing large relational databases in existing technologies and realizing the potential of efficient storage and quantum computing.

CN118861036BActive Publication Date: 2026-07-21ZHEJIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG UNIV
Filing Date
2024-07-19
Publication Date
2026-07-21

Smart Images

  • Figure CN118861036B_ABST
    Figure CN118861036B_ABST
Patent Text Reader

Abstract

The application discloses a relation table storage method based on a quantum circuit. The application can store a large amount of data by using a small amount of quantum bits by virtue of quantum bits and quantum gates. The application firstly generates an integer which is sequentially increased from 0 as a primary key by using a controlled Hadamard gate, and then saves the data of each row by using a multi-controlled Toffoli gate with the primary key as a control bit. The application realizes the storage of the relation table by using quantum hardware, can save a large amount of data by using a small amount of quantum bits, and is beneficial to the acceleration of big data processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a relational table storage method in the fields of relational database management systems and quantum computing, and more particularly to a relational table storage method based on quantum circuits. Background Technology

[0002] Emerging quantum computing promises to achieve exponential speedups in specific tasks by leveraging quantum phenomena. How to introduce quantum computing into different research fields is a topic of focus for many researchers. Considering that current database systems struggle to store and process large datasets on classical computers, quantum computers could be used to process big data, significantly reducing storage requirements and exponentially accelerating various database operations and analyses. However, to support relational tables in relational database management systems on quantum computers, these tables need to be represented in a quantum-compatible format. Therefore, a quantum circuit-based relational table storage method is required. Summary of the Invention

[0003] In order to address the problems and needs existing in the background technology, the purpose of this invention is to propose a relational table storage method based on quantum circuits using emerging quantum hardware.

[0004] The objective of this invention is achieved through the following technical solution:

[0005] I. A relational table storage method based on quantum circuits

[0006] Step 1: Based on the number of rows, columns, and data types of each relation table, create the primary key register, data register, and auxiliary register corresponding to each relation table. The qubits of all registers are initialized to |0>.

[0007] Step 2: Use the control Hadamard gate and auxiliary registers to encode the primary key register as a positive integer from 0 to n-1, where n represents the number of rows in the current relation table;

[0008] Step 3: Using the encoding of the primary key register as a control condition, the value of each column in the corresponding row of the data register is controlled to generate the data registers of each column, thereby obtaining the quantum circuit of the current relation table;

[0009] Step 4: Repeat steps 1-3 to generate the quantum circuits of the remaining relation tables in the database. After arranging the quantum circuits of all relation tables in the database together, the quantum circuit of the database is formed.

[0010] Step one specifically involves:

[0011] 1.1) Determine the number of qubits in the primary key register based on the number of rows in each relation table. The number of qubits satisfies the following condition: n represents the number of rows in the current relation table. This indicates the rounding up operation;

[0012] 1.2) Create c data registers based on the number of columns c in each relation table. The number of qubits in the data registers is determined by the data type in the current relation table.

[0013] 1.3) The auxiliary register includes one qubit.

[0014] The auxiliary registers corresponding to all relation tables in the database are set to one or more.

[0015] Step two specifically involves:

[0016] 2.1) Before the primary key register Add a Hadamard gate to each qubit This indicates a floor operation, where n represents the number of rows in the current relation table;

[0017] 2.2) Utilizing 0 to As a control bit, it applies to the auxiliary register. A multi-control Toveli gate is used, and an auxiliary register is used as a control bit to apply a control Hadamard gate to the qubits in the main key register that do not have a Hadamard gate added.

[0018] 2.3) Using the primary key register as the control bit, apply a multi-control bit Toveley gate to the auxiliary register.

[0019] Step three specifically involves:

[0020] 3.1) Convert the data in the current relation table to binary form;

[0021] 3.2) For the data in the r-th row and j-th column, if there is a binary bit that is 1 in its binary code, then use the value of the primary key of that row as the control bit, apply a multi-control bit Toveli gate to the qubit corresponding to the binary bit that is 1 in the data register of the j-th column, traverse all rows, apply a multi-control bit Toveli gate to the qubit corresponding to all binary bits that are 1 in the data register of the j-th column, and thus obtain the data register of the j-th column.

[0022] 3.3) Repeat 3.2) to encode the data in the remaining columns of the current relation table, obtain the data registers of each column, and thus obtain the quantum circuit of the current relation table.

[0023] II. A computer device

[0024] The device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the method.

[0025] III. A computer-readable storage medium

[0026] The medium stores a computer program that, when executed by a processor, implements the steps of the method.

[0027] IV. A computer program product

[0028] The product includes a computer program / instructions that, when executed by a processor, implement the steps of the method.

[0029] The beneficial effects of this invention are:

[0030] This invention uses quantum circuits to store relational tables in a relational database management system. It can store a large amount of data with a small number of qubits and achieve a quantum-compatible relational table format, laying the foundation for further use of quantum computing technology to manipulate relational tables. Attached Figure Description

[0031] Figure 1 This is a flowchart of the relational table storage method based on quantum circuits. Detailed Implementation

[0032] The present invention will now be described in detail with reference to the accompanying drawings.

[0033] like Figure 1 As shown, the present invention includes the following steps:

[0034] Step 1: Based on the number of rows, columns, and data types of each relation table, create the primary key register, data register, and auxiliary register corresponding to each relation table. The qubits of all registers are initialized to |0>.

[0035] Step one is as follows:

[0036] 1.1) Determine the number of qubits in the primary key register based on the number of rows in each relation table. The number of qubits satisfies the following condition: n represents the number of rows in the current relation table. This indicates the rounding up operation;

[0037] 1.2) Create c data registers based on the number of columns c in each relational table to store each column. The number of qubits in the data registers is determined by the data type in the current relational table. Assuming the i-th table has c columns, then c data registers are needed to store each row. For the data register storing the j-th column, if the data in the j-th column requires t qubits to store, the number of qubits is determined by the data type. For example, int type data may require 4 bytes of qubits to store, then t qubits are used to create the data register for the j-th column.

[0038] 1.3) The auxiliary register includes one qubit. Each relation table in the database has one or more auxiliary registers.

[0039] Step 2: Use the control Hadamard gate and auxiliary registers to encode the primary key register as a positive integer from 0 to n-1, where n represents the number of rows in the current relation table;

[0040] Step two is as follows:

[0041] 2.1) Before the primary key register Add a Hadamard gate to each qubit This indicates a floor operation, where n represents the number of rows in the current relation table;

[0042] 2.2) Utilizing 0 to As a control bit (before the main key register) (number of qubits), apply to the auxiliary register A multi-control Toveli gate is used, and an auxiliary register is used as a control bit to apply a control Hadamard gate to the qubits in the main key register that do not have a Hadamard gate added.

[0043] 2.3) Using the primary key register as a control bit, apply a multi-control bit Toveley gate to the auxiliary register to ensure that the auxiliary register is available next time.

[0044] Step 3: Using the encoding of the primary key register as a control condition, the value of each column in the corresponding row of the data register is controlled to generate the data registers of each column, thereby obtaining the quantum circuit of the current relation table;

[0045] Step three specifically involves:

[0046] 3.1) Convert the data in the current relation table to binary form;

[0047] 3.2) For the data in the r-th row and j-th column, if there is a binary bit that is 1 in its binary code, then use the value of the primary key of that row as the control bit, apply a multi-control bit Toveli gate to the qubit corresponding to the binary bit that is 1 in the data register of the j-th column, traverse all rows, apply a multi-control bit Toveli gate to the qubit corresponding to all binary bits that are 1 in the data register of the j-th column, and thus obtain the data register of the j-th column.

[0048] 3.3) Repeat 3.2) to encode the data in the remaining columns of the current relation table, obtain the data registers of each column, and thus obtain the quantum circuit of the current relation table.

[0049] Step 4: Repeat steps 1-3 to generate the quantum circuits of the remaining relation tables in the database. After arranging the quantum circuits of all relation tables in the database together, the quantum circuit of the database is formed.

[0050] Finally, it should be noted that the above embodiments and descriptions are only used to illustrate the technical solutions of the present invention and not to limit it. Those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the disclosure of the technical solutions of the present invention, and all such modifications and substitutions should be covered within the protection scope of the claims of the present invention.

Claims

1. A relational table storage method based on quantum circuits, characterized by comprising the following steps: Step 1: Based on the number of rows, columns, and data types of each relational table, create the primary key register, data register, and auxiliary register for each relational table. Initialize the qubits of all registers to [value missing]. ; Step one specifically involves: 1.1) Determine the number of qubits in the primary key register based on the number of rows in each relation table. The number of qubits satisfies the following condition: , where n represents the number of rows in the current relation table. This indicates the rounding up operation; 1.2) Create c data registers based on the number of columns c in each relation table. The number of qubits in each data register is determined by the data type in the current relation table. 1.3) The auxiliary register includes one qubit; Step 2: Use the control Hadamard gate and auxiliary registers to encode the primary key register as a positive integer from 0 to n-1, where n represents the number of rows in the current relation table; Step two specifically involves: 2.1) Before the primary key register Add a Hadamard gate to each qubit This indicates a floor operation; n represents the current row number in the relation table. 2.2) Utilizing 0 to As a control bit, it applies to the auxiliary register. A multi-control Toveli gate is used, and an auxiliary register is used as a control bit to apply a control Hadamard gate to the qubits in the main key register that do not have a Hadamard gate added. 2.3) Using the primary key register as the control bit, apply a multi-control bit Toveley gate to the auxiliary register; Step 3: Using the encoding of the primary key register as a control condition, the value of each column in the corresponding row of the data register is controlled to generate the data registers of each column, thereby obtaining the quantum circuit of the current relation table; Step three specifically involves: 3.1) Convert the data in the current relation table to binary form; 3.2) For the data in the r-th row and j-th column, if there is a binary bit that is 1 in its binary code, then use the value of the primary key of that row as the control bit, apply a multi-control bit Toveli gate to the qubit corresponding to the binary bit that is 1 in the data register of the j-th column, traverse all rows, and apply a multi-control bit Toveli gate to the qubit corresponding to all the binary bits that are 1 in the data register of the j-th column, thereby obtaining the data register of the j-th column; 3.3) Repeat 3.2) Encode the data in the remaining columns of the current relation table to obtain the data registers for each column, thereby obtaining the quantum circuit of the current relation table; Step 4: Repeat steps 1-3 to generate the quantum circuits of the remaining relation tables in the database. After arranging the quantum circuits of all relation tables in the database together, the quantum circuit of the database is formed.

2. The relation table storage method based on quantum circuits according to claim 1, wherein the auxiliary registers corresponding to all relation tables in the database are set to one or more.

3. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method of claim 1 or 2.

4. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method of claim 1 or 2.

5. A computer program product, comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method described in claim 1 or 2.