Data management method and device, electronic equipment and storage medium

By building temporary tables and performing partition exchanges, the problem of low writing efficiency of database partition coverage in the existing technology is solved, and efficient data coverage and service performance are improved.

CN119557307AInactive Publication Date: 2025-03-04BEIJING OCEANBASE TECHNOLOGY CO LTD

Patent Information

Application Number
CN202510120954.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-24
Publication Date
2025-03-04
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The prior art is less efficient when overwriting the original data in the database partition, resulting in data tables being occupied and unable to provide services to the outside world.

Method used

By receiving partition coverage instructions, a temporary table is built consistent with the target data table structure, the data to be written is written to the target partition of the temporary table, and partition exchanges are performed to achieve data coverage.

Benefits of technology

Complete the writing and overwriting of the data to be written without occupying the target data table, which improves the efficiency of overwriting writing and avoids service interruptions caused by long-term occupation of the data table.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119557307A_ABST
    Figure CN119557307A_ABST
Patent Text Reader

Abstract

The invention provides a data management method and device, electronic equipment and a storage medium, and the data management method comprises the steps that a partition coverage instruction is received, a temporary table is constructed, the partition coverage instruction is used for instructing to write to-be-written data into a target partition of a target data table in a mode of covering original data, and the temporary table is constructed; the temporary table is consistent with the target data table in structure; writing the to-be-written data into a target partition of the temporary table; and performing partition exchange on the target partition of the target data table and the target partition of the temporary table.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present specification relate to the field of database technology, and in particular, to a data management method and device, an electronic device, and a storage medium. Background Art

[0002] Database partitioning is a technique for splitting large tables or indexes into smaller, more manageable parts. Partitioning refers to logically dividing the data of a large table into multiple smaller, independent fragments according to certain rules. Each partition can be processed and optimized separately, but to the outside world, they still appear as a complete table. Partitioning can significantly improve query performance, simplify data management and maintenance, and help better utilize storage resources.

[0003] When managing data in a database, some scenarios require that new data be used to overwrite the original data in one or more specific partitions in a data table, such as regularly updated data. When overwriting the original data in one or more specific partitions, related technologies are often inefficient, resulting in the data table being occupied and unable to provide external services. Summary of the invention

[0004] In view of this, one or more embodiments of the present specification provide a data management method and device, an electronic device, and a storage medium.

[0005] To achieve the above objectives, one or more embodiments of this specification provide the following technical solutions: According to a first aspect of one or more embodiments of this specification, a data management method is proposed, the method comprising: Receive a partition overwrite instruction and build a temporary table, wherein the partition overwrite instruction is used to instruct to write the data to be written into the target partition of the target data table in a manner of overwriting the original data, and the structure of the temporary table is consistent with that of the target data table; Writing the data to be written into the target partition of the temporary table; Partition exchange is performed on the target partition of the target data table and the target partition of the temporary table.

[0006] In one or more embodiments of the present specification, the step of constructing a temporary table includes: A target partition of the temporary table is constructed, wherein the structure of the target partition of the temporary table is consistent with the structure of the target partition of the target data table.

[0007] In one or more embodiments of the present specification, the structure of the temporary table includes at least: fields, primary keys, partition types, and partition rules.

[0008] In one or more embodiments of the present specification, the partition types include at least: range partition, list partition, hash partition, and key partition.

[0009] In one or more embodiments of the present specification, the partition overwrite instruction is used to instruct: writing part or all of the data in the data source table as data to be written into the target partition of the target data table in a manner of overwriting the original data.

[0010] In one or more embodiments of the present specification, the data source table is a data table in a database, or a data file outside a database.

[0011] In one or more embodiments of the present specification, the target partition includes one or more partitions; and writing the data to be written into the target partition of the temporary table includes: According to the partition type and partition rule of the temporary table, each row of the data to be written is written into a corresponding partition in the target partition.

[0012] In one or more embodiments of this specification, the method further includes: Delete the temporary table.

[0013] According to a second aspect of one or more embodiments of this specification, a data management device is provided, the device comprising: A construction module, used for receiving a partition overwrite instruction and constructing a temporary table, wherein the partition overwrite instruction is used for instructing to write the data to be written into the target partition of the target data table in a manner of overwriting the original data, and the structure of the temporary table is consistent with that of the target data table; A writing module, used for writing the data to be written into the target partition of the temporary table; The exchange module is used to perform partition exchange on the target partition of the target data table and the target partition of the temporary table.

[0014] In one or more embodiments of this specification, the building blocks are used to: A target partition of the temporary table is constructed, wherein the structure of the target partition of the temporary table is consistent with the structure of the target partition of the target data table.

[0015] In one or more embodiments of the present specification, the structure of the temporary table includes at least: fields, primary keys, partition types, and partition rules.

[0016] In one or more embodiments of the present specification, the partition types include at least: range partition, list partition, hash partition, and key partition.

[0017] In one or more embodiments of the present specification, the partition overwrite instruction is used to instruct: writing part or all of the data in the data source table as data to be written into the target partition of the target data table in a manner of overwriting the original data.

[0018] In one or more embodiments of the present specification, the data source table is a data table in a database, or a data file outside a database.

[0019] In one or more embodiments of the present specification, the target partition includes one or more partitions; the writing module is used to: According to the partition type and partition rule of the temporary table, each row of the data to be written is written into a corresponding partition in the target partition.

[0020] In one or more embodiments of the present specification, the device further includes a deletion module, configured to: Delete the temporary table.

[0021] According to a third aspect of one or more embodiments of this specification, a computer program product is provided, comprising a computer program / instruction, which implements the steps of the method described in the first aspect when executed by a processor.

[0022] According to a fourth aspect of one or more embodiments of this specification, an electronic device is provided, including: processor; a memory for storing processor-executable instructions; The processor implements the method as described in the first aspect by running the executable instructions.

[0023] According to a fifth aspect of one or more embodiments of the present specification, a computer-readable storage medium is provided, on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the method described in the first aspect are implemented.

[0024] The technical solutions provided by the embodiments of this specification may have the following beneficial effects: The data management method provided in the embodiment of the present specification can construct a temporary table consistent with the structure of the target data table after receiving a partition overwrite instruction for instructing to write the data to be written into the target partition of the target data table in a manner of overwriting the original data, and write the data to be written into the target partition of the temporary table, and perform a partition exchange between the target partition of the target data table and the target partition of the temporary table. Thus, the writing of the data to be written into the temporary table is completed without occupying the target data table, and the overwriting of the original data in the target partition of the target data table by the data to be written can be completed only by exchanging the partitions between the target data table and the temporary table, which is extremely efficient and will not occupy the target data table for a long time, thereby improving service performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 is a flow chart of a data management method provided by an exemplary embodiment.

[0026] Figure 2 It is a schematic diagram of building a temporary table provided by an exemplary embodiment.

[0027] Figure 3 is a schematic diagram of building a temporary table provided by another exemplary embodiment.

[0028] Figure 4 is a schematic diagram of writing data into a temporary table provided by another exemplary embodiment.

[0029] Figure 5 is a schematic diagram of partition switching provided by another exemplary embodiment.

[0030] Figure 6 It is a structural schematic diagram of a device provided by an exemplary embodiment.

[0031] Figure 7 is a block diagram of a data management device provided by an exemplary embodiment. DETAILED DESCRIPTION

[0032] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of this specification. Instead, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.

[0033] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may be combined into a single step for description in other embodiments.

[0034] When overwriting the original data in one or more specific partitions, related technologies often use DML (Data Manipulation Language), that is, first deleting the original data in the partition row by row, and then inserting new data into the partition row by row, resulting in low efficiency.

[0035] Based on the above technical problems, at least one embodiment of the present specification provides a data management method, which can improve the efficiency of overwrite writing in the scenario where the original data of one or more specific partitions in a data table is overwritten with new data, and avoid the overwrite writing process occupying the data table for a long time, resulting in the inability to provide external services.

[0036] Please follow the attached Figure 1 , which exemplarily shows the process of the method, including steps S101 to S103.

[0037] In step S101, a partition overwrite instruction is received and a temporary table is constructed, wherein the partition overwrite instruction is used to instruct to write the data to be written into the target partition of the target data table in a manner of overwriting the original data, and the structure of the temporary table is consistent with that of the target data table.

[0038] Among them, the temporary table exists only as an auxiliary table in the overwrite write scenario.

[0039] For example, the temporary table may be a hidden table, which refers to a data table that is visible in the database system but invisible to the user.

[0040] For example, the structure of the temporary table includes at least: fields, primary keys, partition types and partition rules. Fields refer to fields contained in the data table; primary keys refer to fields used as primary keys in the data table; partition types may include range partitions, list partitions, hash partitions, key partitions, etc., that is, the partition type of the target data table is one of range partitions, list partitions, hash partitions, and key partitions; partition rules refer to the rules for distinguishing which partition a data row belongs to under the partition type.

[0041] Take the data table created by the following SQL (Structured Query Language) statement 1 as an example. It contains fields c1 and c2, the primary key is c1, and the partition type is range partition. The partition rule is: if the value of the c1 field of the data row is less than 10, the data row belongs to the P0 partition; if the value of the c1 field of the data row is not less than 10 and less than 20, the data row belongs to the P1 partition; if the value of the c1 field of the data row is not less than 20 and less than 30, the data row belongs to the P2 partition; if the value of the c1 field of the data row is not less than 30, the data row belongs to the P3 partition.

[0042] SQL statement 1: create table t1_ins_overwrt (c1 int primary key, c2 int) partition byrange(c1)( partition p0 values ​​less than(10), partition p1 values ​​less than(20), partition p2 values ​​less than(30), partition p3 values ​​less than (MAXVALUE) ); The method of overwriting the original data refers to replacing the original data with the data to be written, that is, deleting the original data and writing the data to be written.

[0043] For example, the partition overwrite instruction is used to instruct: to write part or all of the data in the data source table as the data to be written into the target partition of the target data table in a manner of overwriting the original data. The data source table is a data table in the database, or a data file outside the database. The data file outside the database can be called a foreign table, and its file format can be a data table, or other data formats.

[0044] Among them, the target partition is one or more partitions of the target data table. When generating a partition overwrite instruction, if the partition determined by the partition rule of the target data table according to the data to be written is known, the determined partition can be specified as the target partition; if the partition determined by the partition rule of the target data table according to the data to be written is unknown, all partitions of the target data table can be specified as the target partition. For example, the data source table is a data table in a database, and the partition type and partition rule of the data source table and the target data table are the same, then the target partition of the target data table can be determined according to the partition of the data to be written in the data source table, that is, the partition corresponding to the partition of the data to be written in the data source table (for example, the same partition) is determined as the target partition of the target data table. For another example, the data source table is a data file outside the database, the data to be written is not partitioned, and its corresponding partition in the target data table is unknown, then all partitions of the target data table can be set as target partitions.

[0045] Take the following SQL statement 2 to create data tables t1 and t2 as an example: SQL statement 2: create table t1_ins_overwrt (c1 int primary key, c2 int) partition byrange(c1)( partition p0 values ​​less than(10), partition p1 values ​​less than(20), partition p2 values ​​less than(30), partition p3 values ​​less than (MAXVALUE)); create table t2_ins_overwrt (c1 int primary key, c2 int) partition byrange(c1)( partition p0 values ​​less than(10), partition p1 values ​​less than(20), partition p2 values ​​less than(30), partition p3 values ​​less than (MAXVALUE) ); insert into t1_ins_overwrt values ​​(12, 20), (34, 40), (45, 50); insert into t2_ins_overwrt values ​​(3, 60), (8, 80), (17, 170), (26,260), (29, 290), (142, 1420); If t1 is used as the data source table and all the data in t1 is used as the data to be written, P1 and P3 of t2 can be used as the target partitions, that is, the partition overwrite instruction is the following SQL statement 3: insert overwrite t2_ins_overwrtpartition(p1, p3) select * from t1_ins_overwrt.

[0046] Please refer to the attached Figure 2, which takes the hidden table as an example to illustrate the creation process of the temporary table. It can be seen that data partition 1 (origin_tablet_1) to data partition n (origin_tablet_n) of the target data table have corresponding partitions in the hidden table, namely data partition 1 (hidden_tablet_1) to data partition n (hidden_tablet_n). Among them, the partition type and partition condition (i.e. the condition that the data belonging to data partition i specified in the partition rule must meet) of data partition i of the target data table and data partition i (hidden_tablet_i) of the hidden table, i is an arbitrary integer not less than 1 and not greater than n.

[0047] Preferably, when constructing a temporary table, a target partition of the temporary table may be constructed, wherein the structure of the target partition of the temporary table is consistent with the structure of the target partition of the target data table. Figure 3 , which takes data partition 2 (origin_tablet_2) and data partition n (origin_tablet_n) as target partitions as examples, and exemplarily illustrates the creation process of the hidden table in the preferred example. Only two partitions, data partition 2 (hidden_tablet_2) and data partition 2 (hidden_tablet_n), of the hidden table are created. The partition type and partition condition (i.e., the conditions that the data belonging to data partition 2 specified in the partition rule must meet) of data partition 2 (origin_tablet_2) and data partition 2 (hidden_tablet_2) are consistent, and the partition type and partition condition (i.e., the conditions that the data belonging to data partition n specified in the partition rule must meet) of data partition n (origin_tablet_n) and data partition n (hidden_tablet_n) are consistent.

[0048] This preferred example can reduce the workload of constructing a temporary table, further improve the efficiency of overwriting, and reduce the space occupied in the database during the overwriting process.

[0049] In step S102, the data to be written is written into the target partition of the temporary table.

[0050] If the target partition includes multiple partitions, each row of the data to be written can be written into a corresponding partition in the target partition according to the partition type and partition rule of the temporary table.

[0051] For example, if the partition type of the temporary table is range partition, it is possible to determine the range of the partition to which the field targeted by the range partition belongs when writing each row of data to be written, and write the row of records into the determined partition.

[0052] For example, if the partition type of the temporary table is hash partition, it is possible to determine which partition the hash value of the field targeted by the hash partition corresponds to when writing each row of data to be written, and write the row to the partition determined by the record.

[0053] It should be understood that if the data source table is a data table in a database, and the partition type and partition rule of the data source table and the target data table are the same, then when writing each row of data to be written, the corresponding partition in the target data table can be determined according to its partition in the data source table. Taking the above SQL statement 3 as an example, if (12,20) in t1 is in partition P1, it will be written to partition P1 of t2; if (34, 40), (45, 50) in t1 are in partition P3, they will be written to partition P3 of t2.

[0054] Continue with Figure 3 The example shown in the figure takes data partition 2 (origin_tablet_2) and data partition n (origin_tablet_n) as the target partitions. Figure 4 , which shows the process of writing the data to be written into the target partitions data partition 2 (hidden_tablet_2) and data partition n (hidden_tablet_n) of the hidden table.

[0055] In step S103, partition exchange is performed on the target partition of the target data table and the target partition of the temporary table.

[0056] When exchanging partitions, it is not necessary to exchange the data stored in the partitions, but only to update the mapping relationship between the data table and the partition, that is, to exchange the target partition corresponding to the target data table with the target partition corresponding to the temporary table in the mapping relationship. After the partition is exchanged, the original data of the target partition in the target data table is overwritten by the data to be written, completing the overwriting.

[0057] Continue with Figure 3 The example shown in the figure takes data partition 2 (origin_tablet_2) and data partition n (origin_tablet_n) as the target partitions. Figure 5, which shows the partition exchange process of exchanging data partition 2 (origin_tablet_2) with data partition 2 (hidden_tablet_2) and data partition n (origin_tablet_n) with data partition n (hidden_tablet_n) in this example; please refer to the following Tables 1 and 2, which respectively show the mapping relationship before and after the partition exchange in this example. It can be seen that the data partition 2 (origin_tablet_2) corresponding to the target data table before the exchange is updated to data partition 2 (hidden_tablet_2), and the data partition n (origin_tablet_n) corresponding to the target data table before the exchange is updated to data partition n (hidden_tablet_n).

[0058] Table 1: Mapping relationship table before partition exchange

[0059] Table 2: Mapping relationship table after partition exchange

[0060] In addition, the method may further include: deleting the temporary table. After the partition exchange is completed, the function of the temporary table has been completed, so it can be deleted to save database space.

[0061] It should be understood that if the data in the target partition of the target data table needs to be updated regularly, and all the following conditions are met at the same time each time it is updated: the data in the specific partition corresponding to the above target partition in the data source table is used as the data to be written, the data to be written is written to the target partition in an overwriting manner, the data source table is a data table in the database, and the partition type and partition rules of the data source table and the target data table are the same; then after executing step S103, the temporary table may not be deleted, but only the data in the target partition in the temporary table may be deleted row by row, and although the deletion operation occupies the temporary table, it will not affect the external service of the database. The temporary table is retained, and can be used directly each time the data in the target partition of the target data table is updated, without creating a temporary table, so as to further improve the efficiency of overwriting.

[0062] Figure 6 is a schematic structural diagram of a device provided by an exemplary embodiment. Figure 6At the hardware level, the device includes a processor 602, an internal bus 604, a network interface 606, a memory 608, and a non-volatile memory 610, and may also include hardware required for other tasks. One or more embodiments of this specification may be implemented based on software, such as the processor 602 reading the corresponding computer program from the non-volatile memory 610 into the memory 608 and then running it. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0063] Please refer to Figure 7 , the data management device can be used for Figure 6 The data management device may include: A construction module 701 is used to receive a partition overwrite instruction and construct a temporary table, wherein the partition overwrite instruction is used to instruct to write the data to be written into the target partition of the target data table in a manner of overwriting the original data, and the structure of the temporary table is consistent with that of the target data table; A writing module 702, used for writing the data to be written into the target partition of the temporary table; The exchange module 703 is used to perform partition exchange on the target partition of the target data table and the target partition of the temporary table.

[0064] In one or more embodiments of this specification, the building blocks are used to: A target partition of the temporary table is constructed, wherein the structure of the target partition of the temporary table is consistent with the structure of the target partition of the target data table.

[0065] In one or more embodiments of the present specification, the structure of the temporary table includes at least: fields, primary keys, partition types, and partition rules.

[0066] In one or more embodiments of the present specification, the partition types include at least: range partition, list partition, hash partition, and key partition.

[0067] In one or more embodiments of the present specification, the partition overwrite instruction is used to instruct: writing part or all of the data in the data source table as data to be written into the target partition of the target data table in a manner of overwriting the original data.

[0068] In one or more embodiments of the present specification, the data source table is a data table in a database, or a data file outside a database.

[0069] In one or more embodiments of the present specification, the target partition includes one or more partitions; the writing module is used to: According to the partition type and partition rule of the temporary table, each row of the data to be written is written into a corresponding partition in the target partition.

[0070] In one or more embodiments of the present specification, the device further includes a deletion module, configured to: Delete the temporary table.

[0071] One or more embodiments of the present specification also propose a computer program product, including a computer program / instruction, which implements the steps of the method provided in the first aspect when the computer program / instruction is executed by a processor.

[0072] One or more embodiments of the present specification also propose a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of the method described in the first aspect.

[0073] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.

[0074] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0075] Memory may include non-permanent storage in a computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0076] Computer readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0077] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0078] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0079] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0080] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this manual are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0081] It should be understood that although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of this specification, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0082] The above description is merely a preferred embodiment of one or more embodiments of the present specification and is not intended to limit one or more embodiments of the present specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present specification shall be included in the scope of protection of one or more embodiments of the present specification.

Claims

1. A data management method, the method comprising: Receive a partition overwrite instruction and build a temporary table, wherein the partition overwrite instruction is used to instruct to write the data to be written into the target partition of the target data table in a manner of overwriting the original data, and the structure of the temporary table is consistent with that of the target data table; Writing the data to be written into the target partition of the temporary table; Partition exchange is performed on the target partition of the target data table and the target partition of the temporary table.

2. The data management method according to claim 1, wherein the step of constructing a temporary table comprises: A target partition of the temporary table is constructed, wherein the structure of the target partition of the temporary table is consistent with the structure of the target partition of the target data table.

3. The data management method according to claim 1, wherein the structure of the temporary table at least comprises: Fields, primary key, partition type, and partition rule.

4. The data management method according to claim 3, wherein the partition type at least comprises: Range partition, list partition, hash partition, key partition.

5. The data management method according to claim 1, wherein the partition overwrite instruction is used to instruct: writing part or all of the data in the data source table as the data to be written into the target partition of the target data table in a manner of overwriting the original data. 6 . The data management method according to claim 5 , wherein the data source table is a data table in a database, or a data file outside a database.

7. The data management method according to claim 1, wherein the target partition includes one or more partitions; and the step of writing the data to be written into the target partition of the temporary table comprises: According to the partition type and partition rule of the temporary table, each row of the data to be written is written into a corresponding partition in the target partition.

8. The data management method according to claim 1, further comprising: Delete the temporary table.

9. A data management device, comprising: A construction module, configured to receive a partition overwrite instruction and construct a temporary table, wherein the partition overwrite instruction is used to instruct to write the data to be written into the target partition of the target data table in a manner of overwriting the original data, and the structure of the temporary table is consistent with that of the target data table; A writing module, used for writing the data to be written into the target partition of the temporary table; The exchange module is used to perform partition exchange on the target partition of the target data table and the target partition of the temporary table.

10. The data management device according to claim 9, wherein the building module is used for: Build the target partition of the temporary table, where The structure of the target partition of the temporary table is consistent with that of the target partition of the target data table.

11. The data management device according to claim 9, wherein the structure of the temporary table at least comprises: Fields, primary key, partition type, and partition rule.

12. The data management device according to claim 11, wherein the partition type at least comprises: Range partition, list partition, hash partition, key partition.

13. The data management device according to claim 9, wherein the partition overwrite instruction is used to instruct: writing part or all of the data in the data source table as data to be written into the target partition of the target data table in a manner of overwriting original data. 14 . The data management device according to claim 13 , wherein the data source table is a data table in a database, or a data file outside a database.

15. The data management device according to claim 9, wherein the target partition comprises one or more partitions; and the writing module is used for: According to the partition type and partition rule of the temporary table, each row of the data to be written is written into a corresponding partition in the target partition.

16. A computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 8.

17. An electronic device comprising: processor; a memory for storing processor-executable instructions; The processor implements the method according to any one of claims 1 to 8 by running the executable instructions.

18. A computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Data processing method and device applied to database table

    CN103593447A

  • Data migration method and device, computer equipment and storage medium

    CN110413593A

  • Data migration method, data migration device and computer readable storage medium

    CN116910028A

  • Method to process data and device thereof

    KR101416890B1

Cited By

  • Overwrite optimization method and apparatus for database partition table

    WO2026158560A1