Data storage method of database, medium and product

By configuring the organization format of the database's external memory heap pages and heap tuples, it supports transaction identification with extended number of bits and performs page-level freezing, solving the problem of transaction identification xid volume rewinding, realizing normal use and smooth upgrade of the database.

CN120371831APending Publication Date: 2025-07-25CETC JINCANG (BEIJING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510421461.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-03
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

Transaction identifier xid revolving in the database causes transactions to freeze, affecting the normal use of the database, and it is difficult to effectively solve the problem in the existing technology.

Method used

By configuring the organization format of the database's external memory heap pages and heap tuples, the heap tuple supports transaction identifiers with extended bits and transfers them to memory. Combined with the page-level freezing mechanism, invalid identifiers are released to avoid transaction identifiers backflow.

Benefits of technology

Without increasing storage space, extend the service life of transaction identifier xid, avoid transaction freezing, and ensure the normal use and smooth upgrade of the database.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371831A_ABST
    Figure CN120371831A_ABST
Patent Text Reader

Abstract

The invention provides a data storage method of a database, a medium and a product. The data storage method of the database comprises the following steps: configuring organization formats of heap pages and heap tuples in an external memory of the database to enable the heap tuples to support transaction identifiers of expansion digits, converting the transaction identifiers of the heap tuples into the expansion digits and storing the expansion digits in an internal memory, according to the method and the device, the transaction identifier for expanding bits can be supported under the condition that the storage space is not increased as much as possible, so that the rollback of the transaction identifier xid is avoided, the problem that the rollback of the transaction identifier xid triggers transaction freezing is solved, and normal use of a database is guaranteed; page-level freezing can be achieved, and necessary overall freezing is changed into dispersed freezing capable of being executed in a prolonged mode; a database of transaction identifiers with default digits can be smoothly upgraded to a database of transaction identifiers with extended digits.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of databases, and particularly to a data storage method, medium and product for a database. Background Art

[0002] In a database, a transaction identifier, denoted as xid, is assigned to each transaction. The transaction identifier xid is generally a 32-bit unsigned integer, which increases sequentially. There are a total of 2 32 xids, approximately more than 4.2 billion transactions. When all the transaction identifiers xid are used up and roll back to 0 for re-counting, this phenomenon is called xid rollback. In the database, for the visibility of transactions, it can be stipulated that the difference between the latest transaction identifier xid and the oldest transaction identifier xid cannot exceed 2 31 , and if it exceeds, it is the xid rollback of the transaction identifier. Therefore, there are at most 2 31 , approximately 2.1 billion transactions in the database.

[0003] In a database, 2.1 billion transaction identifiers xid may be quickly exhausted. For example, for an application with a transactions per second (tps) of 1000, 86,400,000 transactions will be used in one day, and it only takes about 2 31 / 86,400,000 ≈ 25 days to exhaust 2.1 billion transaction identifiers xid and cause the xid rollback of the transaction identifier. The xid rollback of the transaction identifier will trigger transaction freezing, and transaction freezing will affect the normal use of the database. Therefore, the xid rollback of the transaction identifier must be concerned in the database, otherwise it will cause the database to be unavailable. Summary of the Invention

[0004] An object of the present invention is to provide a data storage method, medium and product for avoiding the rollback of transaction identifiers in a database that can solve any of the above problems.

[0005] A further object of the present invention is to support an extended-bit transaction identifier with minimal increase in storage space to avoid the rollback of the transaction identifier xid.

[0006] Another further object of the present invention is to upgrade a database with a default-bit transaction identifier to a database with an extended-bit transaction identifier.

[0007] In particular, the present invention provides a data storage method for a database, including: configuring the organization format of heap pages and heap tuples in the external storage of the database so that the heap tuples support transaction identifiers with extended bits, where the extended bits are a set multiple of the default number of bits of the transaction identifier; converting the transaction identifier of the heap tuple into the extended bits and storing it in the memory; if the data operation performed on the heap page involves adjusting the heap page, determining whether the adjustment range of the heap page exceeds a preset range; and if so, freezing the page of the heap page and releasing the transaction identifiers occupied by invalid heap tuples.

[0008] Optionally, the step of configuring the organization format of heap pages and heap tuples in the external storage of the database includes: adding an identification base with extended bits to the page of the heap page to store the base part of the transaction identifiers with extended bits of all heap tuples in this page, and the transaction identifier with the default number of bits in each heap tuple serves as the offset of the transaction identifier with extended bits.

[0009] Optionally, the step of converting the transaction identifier of the heap tuple into the extended bits includes: calculating the sum of the identification base and the offset as the transaction identifier with extended bits of the heap tuple.

[0010] Optionally, the data operations involving adjusting the heap page include: insert operation, update operation, delete operation, and the step of adjusting the heap page includes: adjusting the identification base of the heap page.

[0011] Optionally, the preset range is (xid_base - max_xid, xid_base + min_xid), where xid_base is the identification base of the current heap page, max_xid is the maximum value of the offsets of all heap tuples in the current heap page, and min_xid is the minimum value of the offsets of all heap tuples in the current heap page.

[0012] Optionally, after the step of releasing the transaction identifiers occupied by invalid heap tuples, it further includes: attempting to perform the adjustment of the identification base on the page of the heap page again. If the adjustment is successful, the data operation involving adjusting the identification base on the heap page is successful; if the adjustment fails, the data operation involving adjusting the identification base on the heap page fails.

[0013] Optionally, after upgrading the database with transaction identifiers of the default number of bits to a database with transaction identifiers of extended bits, when reading the heap page of the ordinary table into the memory for the first time, the page format conversion is performed.

[0014] Optionally, the default number of bits is 32 bits, the set multiple is 2, and the extended bits are 64 bits.

[0015] According to another aspect of the present invention, there is also provided a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the above data storage methods for the database are implemented.

[0016] According to another aspect of the present invention, there is also provided a computer program product, including a computer program, characterized in that when the computer program is executed by a processor, it realizes the steps of the data storage method of the database in any one of the above.

[0017] In the data storage method of the database of the present invention, by configuring the organization format of heap pages and heap tuples in the external storage of the database, the heap tuples support transaction identifiers with extended bits, and the extended bits are a set multiple of the default number of bits of the transaction identifier. The transaction identifier of the heap tuple is converted to the extended bits and stored in the memory, which can support transaction identifiers with extended bits with little increase in storage space, so as to avoid the rollback of the transaction identifier xid, and further solve the problem that the rollback of the transaction identifier xid triggers transaction freezing, ensuring the normal use of the database.

[0018] Furthermore, in the data storage method of the database of the present invention, if the data operation in the heap page involves adjusting the heap page, it is judged whether the adjustment range of the heap page exceeds a preset range. When the judgment result is yes, the page of the heap page is frozen, and the transaction identifiers occupied by invalid heap tuples are released, which can realize page-level freezing and change the necessary overall freezing into extendable and scattered freezing.

[0019] Even further, the data storage method of the database of the present invention can upgrade the database with transaction identifiers of default bits to a database with transaction identifiers of extended bits. When the heap page of the ordinary table is read into the memory for the first time after the upgrade, the page format conversion can be performed, and smooth upgrade can be realized.

[0020] According to the following detailed description of specific embodiments of the present invention in conjunction with the drawings, those skilled in the art will be more clear about the above and other objects, advantages and features of the present invention. Description of the Drawings

[0021] Some specific embodiments of the present invention will be described in detail hereinafter with reference to the drawings in an exemplary but non-limiting manner. The same reference numerals in the drawings denote the same or similar components or parts. Those skilled in the art should understand that these drawings are not necessarily drawn to scale. In the drawings:

[0022] Figure 1 is a schematic flowchart of the data storage method of the database according to an embodiment of the present invention;

[0023] Figure 2 is a detailed flowchart of the data storage method of the database according to an embodiment of the present invention;

[0024] Figure 3 is a schematic diagram of the organization format of heap tuples in the prior art;

[0025] Figure 4 is a schematic diagram of the organization format of heap pages in the prior art;

[0026] Figure 5 is a schematic diagram of the organization format of heap tuples in memory in the data storage method of a database according to an embodiment of the present invention;

[0027] Figure 6 is a schematic diagram of the organization format of heap pages in external storage in the data storage method of a database according to an embodiment of the present invention;

[0028] Figure 7 is a schematic diagram of the adjustment range of the identification base number of heap pages in the data storage method of a database according to an embodiment of the present invention;

[0029] Figure 8 is a schematic diagram of a computer program product according to an embodiment of the present invention;

[0030] Figure 9 is a schematic diagram of a computer-readable storage medium according to an embodiment of the present invention; and

[0031] Figure 10 is a schematic diagram of a computer device according to an embodiment of the present invention. Detailed implementation manners

[0032] Those skilled in the art should understand that the embodiments described below are only a part of the embodiments of the present invention, rather than all the embodiments of the present invention. This part of the embodiments is intended to explain the technical principle of the present invention, rather than to limit the protection scope of the present invention. Based on the embodiments provided by the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts should still fall within the protection scope of the present invention.

[0033] It should be noted that the logic and / or steps represented in the flowchart or described in other ways herein, for example, can be considered as a definite sequence list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other systems that can fetch and execute instructions from the instruction execution system, apparatus, or device), or in combination with these instruction execution systems, apparatus, or devices.

[0034] The data storage method of the database in this embodiment can support transaction identifiers with extended digits with little increase in storage space, so as to avoid the rollback of the transaction identifier xid, and further solve the problem that the rollback of the transaction identifier xid triggers transaction freezing, ensuring the normal use of the database.

[0035] Figure 1 is a schematic flowchart of a data storage method for a database according to an embodiment of the present invention. As Figure 1 shown, the data storage method for the database generally may include the following steps:

[0036] Step S102, by configuring the organization format of heap pages and heap tuples in the external memory of the database, enabling the heap tuples to support extended-bit transaction identifiers. Specifically, the extended bit is a set multiple of the default bit number of the transaction identifier. In a preferred embodiment, the default bit number is 32 bits, the set multiple is 2, and the extended bit number is 64 bits.

[0037] Step S104, convert the transaction identifier of the heap tuple to the extended bit number and store it in the memory. As mentioned before, in the database, a transaction identifier xid will be assigned to each transaction. When the transaction identifier xid is the default 32 bits, there are a total of 2 32 transaction identifiers xid, about more than 4.2 billion transactions. In the database, for the visibility of transactions, it is generally stipulated that the difference between the latest transaction identifier xid and the oldest transaction identifier xid cannot exceed 2 31 , and if it exceeds, it is the transaction identifier xid rollback. Therefore, there are at most 2 31 in the database, about 2.1 billion transactions.

[0038] In the database, 2.1 billion transaction identifiers xid may be quickly exhausted, resulting in the transaction identifier xid rollback, triggering transaction freezing and affecting the normal use of the database. And this embodiment can effectively solve the problem of xid rollback by using the extended-bit transaction identifier xid. For example, using a 64-bit transaction identifier xid, there are a total of 2 64 transaction identifiers xid. Assuming an application with a tps of 1000 processes 86,400,000 transactions per day, the 64-bit transaction identifier xid can be used for 58,000 years before exhausting the transaction identifier xid, and can postpone the xid rollback to a very distant future, which can be considered to solve the problem of xid rollback.

[0039] Step S106, if the data operation performed on the heap page involves adjusting the heap page, determine whether the adjustment range of the heap page exceeds a preset range. If so, execute step S108. Specifically, the data operations involving adjusting the heap page include: insert operation, update operation, and delete operation.

[0040] Specifically, when the judgment result in step S106 is yes, that is, when the data operation performed on the heap page involves adjusting the heap page and the adjustment range of the heap page exceeds the preset range, execute step S108.

[0041] Step S108: Freeze the pages of the heap page and release the transaction identifiers occupied by invalid heap tuples, which can achieve page-level freezing and change the necessary overall freezing into extendable and executable scattered freezing.

[0042] In the solution of this embodiment, by configuring the organization format of heap pages and heap tuples in the external storage of the database, the heap tuples support transaction identifiers with extended bits. The extended bits are a set multiple of the default number of bits of the transaction identifier. Convert the transaction identifier of the heap tuple into the extended bits and store it in the memory, which can support transaction identifiers with extended bits with minimal increase in storage space, avoid the rollback of the transaction identifier xid, and then solve the problem that the rollback of the transaction identifier xid triggers transaction freezing to ensure the normal use of the database.

[0043] If the data operation in the heap page involves adjusting the heap page, determine whether the adjustment range of the heap page exceeds the preset range. When the judgment result is yes, freeze the pages of the heap page and release the transaction identifiers occupied by invalid heap tuples, which can achieve page-level freezing and change the necessary overall freezing into extendable and executable scattered freezing.

[0044] Figure 2 It is a detailed flowchart of the data storage method of the database according to an embodiment of the present invention. As Figure 2 shown, the detailed process of the data storage method of the database generally may include the following steps:

[0045] Step S202: Add an identification base with extended bits to the pages of the heap page to store the base part of the transaction identifiers with extended bits of all heap tuples on this page, and use the transaction identifier with the default number of bits in each heap tuple as the offset of the transaction identifier with extended bits, so that the heap tuples support transaction identifiers with extended bits.

[0046] Step S204: Calculate the sum of the identification base and the offset as the transaction identifier with extended bits of the heap tuple and store it in the memory.

[0047] Step S206: Determine whether the data operation in the heap page involves adjusting the identification base of the heap page. If so, execute Step S210; if not, execute Step S208. Specifically, when the judgment result of Step S206 is yes, that is, when the data operation in the heap page involves adjusting the identification base of the heap page, execute Step S210. When the judgment result of Step S206 is no, that is, when the data operation in the heap page does not involve adjusting the identification base of the heap page, execute Step S208.

[0048] Step S208: Keep the identification base of the heap page unchanged. Specifically, the data operation that does not involve adjusting the identification base of the heap page can be directly completed.

[0049] Step S210, determine whether the adjustment range of the heap page exceeds the preset range (xid_base - max_xid, xid_base + min_xid). If so, execute Step S212; if not, execute Step S220. Here, xid_base is the identification base number of the current heap page, max_xid is the maximum offset of all heap tuples in the current heap page, and min_xid is the minimum offset of all heap tuples in the current heap page.

[0050] Specifically, when the judgment result of Step S210 is yes, that is, when the adjustment range of the heap page exceeds the preset range, execute Step S212. When the judgment result of Step S210 is no, that is, when the adjustment range of the heap page does not exceed the preset range, execute Step S220.

[0051] Step S212, freeze the page of the heap page and release the transaction identifiers occupied by invalid heap tuples.

[0052] Step S214, attempt to adjust the identification base number on the page of the heap page again.

[0053] Step S216, determine whether the adjustment is successful. If so, execute Step S220; if not, execute Step S218. Specifically, when the judgment result of Step S216 is yes, that is, when the adjustment is successful, execute Step S220. When the judgment result of Step S216 is no, that is, when the adjustment is not successful, execute Step S218.

[0054] Step S218, the data operation involving the adjustment of the identification base number on the heap page fails.

[0055] Step S220, the data operation involving the adjustment of the identification base number on the heap page is successful.

[0056] Figure 3 It is a schematic diagram of the organization format of heap tuples in the prior art. Figure 4 It is a schematic diagram of the organization format of heap pages in the prior art. As Figure 3 shown, in the database of the prior art, for example, in the KingbaseES database, a page is the smallest logical unit of data management. Each page is organized into a specific structure. The page storing table data is called a heap page, and the page storing index data is called an index page.

[0057] A data item in a heap page is called a heap tuple. The structure of a heap tuple consists of a heap tuple header and tuple data. As Figure 3As shown in the figure. The t_xmin field and t_xmax field in the heap tuple header can be simply understood as the transaction identifier xid when inserting data and the transaction identifier xid when updating / deleting data, and the default is 32 bits.

[0058] The organizational structure of the heap page in the prior art is as Figure 4 shown, including a page header, a line pointers pointer area, a free space, a heap tuples area, and a special space area. The heap tuple data is stored in the heap tuples area of the heap page, and there is a corresponding line pointers pointer pointing to it. The heap tuple data stored in the heap page consists of a heap tuple header and tupledata, that is, Figure 3 the content after the t_data field in is written into the page as a heap tuple data for persistence.

[0059] Figure 5 It is a schematic diagram of the organization format of heap tuples in memory in the data storage method of a database according to an embodiment of the present invention. Figure 6 It is a schematic diagram of the organization format of heap pages in external storage in the data storage method of a database according to an embodiment of the present invention. Specifically, the following is introduced with the extended number of bits of the transaction identifier being 64 bits:

[0060] As Figure 6 shown, in the new heap page organization format in external storage in this embodiment, two 64-bit fields, namely the identification base xid_base and multi_base, are newly added to the special space area of the heap page, which store the base parts of the 64-bit xid and the 64-bit multi xid respectively. The heap tuples stored in the heap tuples area of the heap page include a heap tuple header and tupledata.

[0061] Figure 5 The t_data field in points to the heap tuple in external storage, including a heap tuple header and tupledata. The xid in each heap tuple header in external storage is 32 bits (such as the t_xmin and t_xmax fields in the heap tuple header), which stores the offset part of the real 64-bit xid of the heap tuple.

[0062] The true 64-bit xid of each heap tuple is the sum of the xid_base part of the special space of the heap page and the offset part of the xid in the heap tuple header. Such a design allows the heap tuple to support 64-bit xids with almost no additional storage space.

[0063] As Figure 5 shown, the organization format of heap tuples in memory in this embodiment, where the t_data field points to the heap tuple in external memory. Each heap tuple in memory has 6 fields, namely t_xmin, t_xmax, t_len, t_self, t_tableoid, and t_data. As Figure 5 The two newly added 64-bit t_xmin and t_xmax fields store the true 64-bit insert data xid and update / delete data xid of each heap tuple, respectively.

[0064] When loading the heap tuples of a heap page into memory, it is necessary to add the xidbase part of the special space area of the heap page and the 32-bit xid in the heap tuple header of the heap tuple to convert it into the 64-bit xid of the heap tuple in memory.

[0065] Figure 7 is a schematic diagram of the adjustment range of the identification base of a heap page in the data storage method of a database according to an embodiment of the present invention. The xid base field in the special space area of the heap page is a 64-bit xid. The xid in each heap tuple in the page is the offset part of the 64-bit xid and is 32 bits. This design requires that the true 64-bit xids of all heap tuples within the same page cannot differ by more than 2 32 , otherwise it cannot be represented by a 64-bit xid base.

[0066] When operating on data items in a heap page, such as insert operations, update operations, and delete operations, they will involve modifying the xid of the heap tuple. Therefore, these operations may adjust the identification base xid_base of the page. As Figure 7 shown, the adjustable range of xid_base in the heap page is (xid_base - max_xid, xid_base + min_xid), Figure 7 the dotted part in. xid_base is the identification base of the current heap page, max_xid is the maximum value of the offsets of all heap tuples in the current heap page, and min_xid is the minimum value of the offsets of all heap tuples in the current heap page.

[0067] It can be seen that the xid_base of the heap page can be adjusted up and down, Figure 7The range within which xid_base represented by the dense dotted line in [ can be increased, and the range within which xid_base can be decreased is represented by the sparse dotted line. Beyond this range, xid_base cannot be adjusted.

[0068] When the adjustment range of the heap page xid_base exceeds the adjustable range of the page, the page will be frozen, and the xids occupied by invalid heap tuples will be released. Then, an attempt will be made to adjust xid_base on this page again. If the adjustment of xid_base on this page is successful, operations involving modifying xid on this heap page will succeed, such as insert, update, and delete operations. If the adjustment of xid_base on this page fails, operations involving modifying xid on this heap page will fail.

[0069] It should be noted that the data storage method of the database in this embodiment supports a smooth upgrade from a 32-bit xid database to a 64-bit xid database. The upgrade tool processes the system tables, and the data part of the ordinary tables is directly copied. When the heap pages of the ordinary tables are first read into memory after the upgrade, the page format conversion will be performed.

[0070] Specifically, according to the size relationship between the free space of the heap page before the upgrade and the size of adding two xid base fields (a total of 16 bytes) to the special space area of the heap page, it is divided into two cases: If the free space of the heap page before the upgrade is greater than or equal to 16 bytes, two xid base fields will be added to the special space area of the heap page. If the free space of the heap page before the upgrade is less than 16 bytes, the heap page will be converted into a temporary heap page format.

[0071] This temporary heap page format is only applicable to heap pages where the special space area of the heap page cannot accommodate two xidbase fields. Since the database service needs to be stopped during the upgrade, after the upgrade, there are no transactions before the upgrade still running in the database. For the heap page data before the upgrade, xmin in the heap tuple is meaningless, so the t_xmin field in the heap tupleheader is meaningless. Only the 32-bit xmax in the heap tuple needs to be upgraded to 64-bit xmax. Reuse the t_xmin field in the heap tuple header to store the high 32 bits of the 64-bit xmax of this heap tuple, and the t_xmax field in the heap tuple header to store the low 32 bits of the 64-bit xmax of this heap tuple.

[0072] When the database maintenance command vacuum for cleaning up deleted rows in the database is executed, the heap page can trim some invalid heap tuples and free space for the special space. If the heap page is in the temporary heap page format at this time and the space of the special space of this heap page is greater than or equal to 16 bytes, two xid base fields are added to the special space area, and the temporary heap page format is converted into the ordinary 64-bit xid heap page format.

[0073] In some other embodiments, the structure of the heap tuple header of the heap page can be modified to change the 32-bit t_xmin and t_xmax fields into 64-bit t_xmin and t_xmax fields. Although this design scheme is simple to implement, according to this scheme, in the heap tuple header of each heap tuple, the t_xmin field increases by 4 bytes and the t_xmax field increases by 4 bytes. Each heap tuple increases by 8 bytes, which will cause a huge waste of storage space. The data storage method of the database in this embodiment can effectively avoid the above defects.

[0074] The flowcharts provided in the above embodiments are not intended to indicate that the operations of the method will be executed in any specific order, or that all operations of the method are included in every case. In addition, the method may include additional operations. Within the scope of the technical idea provided by the method in the above embodiments, additional changes can be made to the above method.

[0075] This embodiment also provides a computer program product, a computer-readable storage medium, and a computer device. Figure 8 It is a schematic diagram of a computer program product 500 according to an embodiment of the present invention. Figure 9 It is a schematic diagram of a computer-readable storage medium 300 according to an embodiment of the present invention. Figure 10 It is a schematic diagram of a computer device 400 according to an embodiment of the present invention.

[0076] The computer program product 500 includes a computer program 310, and when the computer program 310 is executed by a processor 410, it implements the steps of the data storage method of the database in any one of the above. The computer-readable storage medium 300 stores the above computer program 310, and when the computer program 310 is executed by a processor 410, it implements the steps of the data storage method of the database in any one of the above embodiments. The computer device 400 may include a memory 420, a processor 410, and a computer program 310 stored on the memory 420 and running on the processor 410.

[0077] The computer program 310 for performing the operations of the present invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, configuration data of an integrated circuit, or source code or object code written in any combination of one or more programming languages and procedural programming languages.

[0078] The computer program 310 may be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider via the Internet).

[0079] In some embodiments, in order to perform aspects of the present invention, an electronic circuit, including, for example, a programmable logic circuit, a field-programmable gate array (FPGA), or a programmable logic array (PLA), may execute computer-readable program instructions by utilizing the state information of the computer-readable program instructions to personalize the electronic circuit.

[0080] For the description of this embodiment, the computer program product 500 is a related product that includes the computer program 310. For the description of this embodiment, the computer-readable storage medium 300 is a tangible device capable of retaining and storing the computer program 310, which may be any device that can contain, store, communicate, propagate, or transport the computer program 310 for use by or in connection with an instruction execution system, apparatus, or device.

[0081] More specific examples (non-exhaustive list) of the computer-readable storage medium 300 include the following: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD), memory stick, floppy disk, mechanically encoded device, and any suitable combination of the above.

[0082] The computer device 400 may include a memory 420, a processor 410, and a computer program 310 stored on the memory 420 and running on the processor 410. When the processor 410 executes the computer program 310, the steps of the data storage method for the database in any of the above embodiments are implemented.

[0083] It should be noted that the logic and / or steps represented in the flowchart or described in other ways herein, for example, can be considered as a definite sequence list of executable instructions for implementing logical functions, and can be specifically implemented in any machine-readable storage medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other systems that can fetch and execute instructions from the instruction execution system, apparatus, or device), or used in combination with these instruction execution systems, apparatus, or devices.

[0084] It should be understood that various parts of the present invention can be implemented by hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system.

[0085] The computer device 400 can be, for example, a server, a desktop computer, a laptop computer, a tablet computer, or a smartphone. In some examples, the computer device 400 can be a cloud computing node. The computer device 400 can be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Generally, program modules can include routines, programs, object programs, components, logics, data structures, etc. that perform specific tasks or implement specific abstract data types. The computer device 400 can be implemented in a distributed cloud computing environment where tasks are executed by remote processing devices linked through a communication network. In the distributed cloud computing environment, program modules can be located on local or remote computing system storage media including storage devices.

[0086] The computer device 400 may include a processor 410 suitable for executing stored instructions and a memory 420 that provides temporary storage space for the operation of the instructions during operation. The processor 410 can be a single-core processor, a multi-core processor, a computing cluster, or any other number of other configurations. The memory 420 can include random access memory (RAM), read-only memory, flash memory, or any other suitable storage system.

[0087] The processor 410 may be connected through a system interconnect (such as PCI, PCI-Express, etc.) to an I / O interface (input / output interface) suitable for connecting the computer device 400 to one or more I / O devices (input / output devices). The I / O devices may include, for example, a keyboard and a pointing device, where the pointing device may include a touchpad or a touch screen, etc. The I / O devices may be built-in components of the computer device 400, or may be devices externally connected to the computing device.

[0088] The processor 410 may also be linked through a system interconnect to a display interface suitable for connecting the computer device 400 to a display device. The display device may include a display screen as a built-in component of the computer device 400. The display device may also include a computer monitor, a television, a projector, etc. externally connected to the computer device 400. In addition, a network interface controller (NIC) may be suitable for connecting the computer device 400 to a network through a system interconnect. In some embodiments, the NIC may use any suitable interface or protocol (such as Internet Small Computer System Interface, etc.) to transmit data. The network may be a cellular network, a radio network, a wide area network (WAN), a local area network (LAN), or the Internet, etc. A remote device may be connected to the computing device through the network.

[0089] At this point, those skilled in the art should recognize that although multiple exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications that conform to the principles of the present invention can still be directly determined or derived from the content disclosed in the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and recognized as covering all these other variations or modifications.

Claims

1. A data storage method for a database, comprising: Configuring the organization format of heap pages and heap tuples in the external storage of the database so that the heap tuples support extended-bit transaction identifiers, where the extended bits are a set multiple of the default number of bits of the transaction identifier; Converting the transaction identifier of the heap tuple to the extended number of bits and storing it in memory; If the data operation performed in the heap page involves adjusting the heap page, determining whether the adjustment range of the heap page exceeds a preset range; And If so, freezing the page of the heap page and releasing the transaction identifiers occupied by invalid heap tuples.

2. The method according to claim 1, wherein the step of configuring the organization format of heap pages and heap tuples in the external storage of the database comprises: Adding an identifier base of the extended number of bits to the page of the heap page to store the base part of the extended-bit transaction identifiers of all the heap tuples in the page, and The transaction identifier of the default number of bits in each heap tuple serves as the offset of the extended-bit transaction identifier.

3. The method according to claim 2, wherein the step of converting the transaction identifier of the heap tuple to the extended number of bits comprises: Calculating the sum of the identifier base and the offset as the extended-bit transaction identifier of the heap tuple.

4. The method according to claim 3, wherein The data operations involving adjusting the heap page include: insert operation, update operation, delete operation, and The step of adjusting the heap page comprises: adjusting the identifier base of the heap page.

5. The method according to claim 4, wherein The preset range is (xid_base - max_xid, xid_base + min_xid), where xid_base is the identifier base of the current heap page, max_xid is the maximum value of the offsets of all the heap tuples in the current heap page, and min_xid is the minimum value of the offsets of all the heap tuples in the current heap page.

6. The method according to claim 5, wherein after the step of releasing the transaction identifiers occupied by invalid heap tuples, it further comprises: Attempting to perform an adjustment of the identifier base on the page of the heap page again. If the adjustment is successful, the data operation involving adjusting the identifier base in the heap page is successful; if the adjustment fails, the data operation involving adjusting the identifier base in the heap page fails.

7. The method according to claim 1, wherein After upgrading the database with the transaction identifier of the default number of bits to the database with the transaction identifier of the extended number of bits, when the heap page of the ordinary table is read into the memory for the first time, a page format conversion is performed.

8. The method according to claim 1, wherein The default number of bits is 32 bits, the set multiple is 2, and the extended number of bits is 64 bits.

9. A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the data storage method for the database according to any one of claims 1 to 8.

10. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the steps of the data storage method for the database described in any one of claims 1 to 8.