Business data storage method and device, computer device and storage medium

By selecting either index space or heap space to store data based on data length in heap storage technology, the problem of low resource utilization in traditional heap storage technology is solved, achieving more efficient resource utilization and data storage.

CN116185305BActive Publication Date: 2026-05-12KINGDEE SOFTWARE(CHINA) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
KINGDEE SOFTWARE(CHINA) CO LTD
Filing Date
2023-03-14
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Traditional heap storage technology results in low resource utilization and wastes resources when storing data blindly.

Method used

By obtaining the initial index sequence of the target business data, the index space of the target sub-data is determined, and the data is written to the index space or the heap space according to the data length. Pointers are used for data storage to avoid unnecessary resource allocation.

Benefits of technology

It improves resource utilization, reduces unnecessary resource consumption, and enhances the efficiency and flexibility of data storage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116185305B_ABST
    Figure CN116185305B_ABST
Patent Text Reader

Abstract

The application relates to a business data storage method and device, computer equipment, a storage medium and a computer program product. The method comprises the following steps: acquiring an initial index sequence corresponding to target business data; determining target sub-data from each sub-business data contained in the target business data, and taking an index space corresponding to the target sub-data in the initial index sequence as a target index space; when a target data length corresponding to the target sub-data is less than or equal to a space data length of the target index space, writing the target sub-data into the target index space to obtain a target index sequence; and when the target data length corresponding to the target sub-data is greater than the space data length of the target index space, writing the target sub-data into a target heap space corresponding to the target business data to obtain a target pointer corresponding to the target sub-data, and writing the target pointer into the target index space to obtain the target index sequence. The method can improve resource utilization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a business data storage method, apparatus, computer equipment, storage medium, and computer program product. Background Technology

[0002] With the development of data storage technology, heap storage technology has emerged, which stores massive amounts of data of different lengths in the heap and records the index corresponding to each data. The index stores the pointer to the corresponding data in the heap, and the value of the data can be obtained by accessing the heap through the pointer.

[0003] However, using traditional heap storage technology and blindly storing data in the heap will result in low resource utilization. Summary of the Invention

[0004] Therefore, it is necessary to provide a business data storage method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve resource utilization in response to the above-mentioned technical problems.

[0005] This application provides a business data storage method. The method includes:

[0006] Obtain the initial index sequence corresponding to the target business data;

[0007] The target sub-data is determined from the various sub-business data contained in the target business data, and the index space corresponding to the target sub-data in the initial index sequence is used as the target index space;

[0008] When the length of the target data corresponding to the target sub-data is less than or equal to the length of the spatial data in the target index space, the target sub-data is written into the target index space to obtain the target index sequence.

[0009] When the length of the target data corresponding to the target sub-data is greater than the length of the space data in the target index space, the target sub-data is written into the target heap space corresponding to the target business data to obtain the target pointer corresponding to the target sub-data. The target pointer is then written into the target index space to obtain the target index sequence.

[0010] This application also provides a business data storage device. The device includes:

[0011] The index sequence acquisition module is used to acquire the initial index sequence corresponding to the target business data;

[0012] The target sub-data determination module is used to determine the target sub-data from the various sub-business data contained in the target business data, and to use the index space corresponding to the target sub-data in the initial index sequence as the target index space.

[0013] The target sub-data storage module is used to write the target sub-data into the target index space to obtain the target index sequence when the length of the target data corresponding to the target sub-data is less than or equal to the length of the spatial data of the target index space.

[0014] The target sub-data storage module is also used to write the target sub-data into the target heap space corresponding to the target business data when the length of the target data corresponding to the target sub-data is greater than the length of the space data in the target index space, to obtain the target pointer corresponding to the target sub-data, and to write the target pointer into the target index space to obtain the target index sequence.

[0015] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described business data storage method.

[0016] A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the above-described business data storage method.

[0017] A computer program product includes a computer program, which, when executed by a processor, implements the steps of the above-described business data storage method.

[0018] The aforementioned business data storage method, apparatus, computer equipment, storage medium, and computer program product obtain an initial index sequence corresponding to the target business data, determine the target sub-data from the various sub-business data contained in the target business data, and use the index space corresponding to the target sub-data in the initial index sequence as the target index space. When the length of the target data corresponding to the target sub-data is less than or equal to the length of the target index space, the target sub-data is written into the target index space to obtain the target index sequence. When the length of the target data corresponding to the target sub-data is greater than the length of the target index space, the target sub-data is written into the target heap space corresponding to the target business data to obtain the target pointer corresponding to the target sub-data, and the target pointer is written into the target index space to obtain the target index sequence. In this way, when the length of the target data corresponding to the target sub-data is less than or equal to the length of the target index space, the target sub-data is directly written into the target index space without allocating corresponding heap space for the target sub-data, which can avoid opening unnecessary resource space and effectively improve resource utilization. Attached Figure Description

[0019] Figure 1 This is an application environment diagram of a business data storage method in one embodiment;

[0020] Figure 2 This is a flowchart illustrating a business data storage method in one embodiment;

[0021] Figure 3This is a flowchart illustrating the process of determining the length of spatial data in one embodiment;

[0022] Figure 4 This is a schematic diagram of business data storage in one embodiment;

[0023] Figure 5 This is a schematic diagram of business data storage in another embodiment;

[0024] Figure 6 This is a structural block diagram of a business data storage device in one embodiment;

[0025] Figure 7 This is a structural block diagram of a business data storage device in another embodiment;

[0026] Figure 8 This is an internal structural diagram of a computer device in one embodiment;

[0027] Figure 9 This is a diagram of the internal structure of a computer device in another embodiment. Detailed Implementation

[0028] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0029] The business data storage method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or located on the cloud or other network servers. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can be smart TVs, smart in-vehicle devices, etc. Portable wearable devices can be smartwatches, smart bracelets, head-mounted devices, etc. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers. Terminal 102 and server 104 can be directly or indirectly connected via wired or wireless communication, which is not limited herein.

[0030] Both the terminal and the server can be used independently to execute the business data storage method provided in the embodiments of this application.

[0031] For example, the terminal obtains the initial index sequence corresponding to the target service data. The terminal determines the target sub-data from the various sub-service data contained within the target service data, and uses the index space corresponding to the target sub-data in the initial index sequence as the target index space. When the length of the target data corresponding to the target sub-data is less than or equal to the length of the target index space, the terminal writes the target sub-data into the target index space, obtaining the target index sequence. When the length of the target data corresponding to the target sub-data is greater than the length of the target index space, the terminal writes the target sub-data into the target heap space corresponding to the target service data, obtaining the target pointer corresponding to the target sub-data, and writes the target pointer into the target index space, obtaining the target index sequence.

[0032] Terminals and servers can also work together to execute the business data storage methods provided in the embodiments of this application.

[0033] For example, a terminal sends a service data storage request carrying a target service data identifier to a server. The server obtains the initial index sequence corresponding to the target service data based on the target service data identifier. The server determines the target sub-data from the various sub-service data contained in the target service data, and uses the index space corresponding to the target sub-data in the initial index sequence as the target index space. When the length of the target data corresponding to the target sub-data is less than or equal to the length of the space data in the target index space, the server writes the target sub-data into the target index space, obtaining the target index sequence. When the length of the target data corresponding to the target sub-data is greater than the length of the space data in the target index space, the server writes the target sub-data into the target heap space corresponding to the target service data, obtains the target pointer corresponding to the target sub-data, writes the target pointer into the target index space, and obtains the target index sequence. The server returns the service data storage result to the terminal.

[0034] In one embodiment, such as Figure 2 As shown, a business data storage method is provided. Taking the application of this method to a computer device as an example, the computer device can be a terminal or a server. The method can be implemented independently by the terminal or server, or through interaction between the terminal and the server. The business data storage method includes the following steps:

[0035] Step S202: Obtain the initial index sequence corresponding to the target business data.

[0036] In this context, "business data" refers to a business object containing a large amount of sub-business data to be stored. For example, a business object could be an information registration form, where the data in each cell constitutes the sub-business data; a business object could be a document, where each piece of data to be stored constitutes the sub-business data; and so on. "Target business data" refers to the business data that needs to be stored. "Index sequence" refers to the sequence of index spaces corresponding to each sub-business data within the target business data. "Initial index sequence" refers to the index sequence corresponding to the target business data before storage operations are performed on the target sub-data.

[0037] For example, when storing target business data using a heap storage scheme, the first step is to allocate corresponding storage space for the target sub-data in the heap, then write the target sub-data into the corresponding storage space in the heap, and finally write the pointer corresponding to that storage space into the target index space of the target business data in the initial index sequence. However, when the target business data contains a large amount of sub-business data of variable length, i.e., the data length of the sub-business data is not fixed, and there are a large number of sub-business data with a data length less than or equal to the index space length, blindly storing the sub-business data in the heap will result in a waste of resources. Therefore, when performing storage operations on the target business data, the computer device first obtains the initial index sequence corresponding to the target business data, and then compares the space data length of the target index space in the initial index sequence with the target data length of the target sub-data to determine the storage method corresponding to the target sub-data, so that the target sub-data can be stored in the appropriate storage method.

[0038] Step S204: Determine the target sub-data from the various sub-business data contained in the target business data, and use the index space corresponding to the target sub-data in the initial index sequence as the target index space.

[0039] In this context, target sub-data refers to the sub-business data identified from the various sub-business data contained within the target business data, which requires data storage operations. Index space refers to the storage space used to store pointers corresponding to sub-business data or to directly store the sub-business data. During data querying, when the data stored in the index space is a pointer, the corresponding sub-business data can be read from the heap through the pointer stored in the index space; when the data stored in the index space is sub-business data, it can be read directly from the index space. The target index space refers to the index space corresponding to the target sub-data.

[0040] For example, when the target business data has a corresponding sub-business data storage order, the computer device determines the target sub-data from among the sub-business data included in the target business data according to the sub-business data storage order. When the target business data does not have a corresponding sub-business data storage order, any one of the sub-business data to be stored among the sub-business data included in the target business data is taken as the target sub-data. Then, the index space corresponding to the target sub-data is determined in the initial index sequence, and this index space is taken as the target index space corresponding to the target sub-data.

[0041] Step S206: When the length of the target data corresponding to the target sub-data is less than or equal to the length of the spatial data in the target index space, the target sub-data is written into the target index space to obtain the target index sequence.

[0042] The target data length refers to the length of the target sub-data. For example, when the target sub-data is character data, the target data length is 1 byte; when the target sub-data is integer data, the target data length is 4 bytes, etc. The spatial data length refers to the size of the storage space occupied by the index space. For example, the spatial data length of the target index space can be 4 bytes, 8 bytes, etc. The target index sequence refers to the index sequence obtained after performing storage operations on the target sub-data, i.e., after updating the target index space in the initial index sequence based on the target sub-data.

[0043] For example, the target data length of the target sub-data is compared with the spatial data length of the target index space. When the target data length is less than or equal to the spatial data length of the target index space, the target sub-data is directly written into the target index space to obtain the updated target index sequence. The process continues to identify the target sub-data within each sub-business data contained in the target business data, and returns to the step of obtaining the initial index sequence corresponding to the target business data, until all sub-business data contained in the target business data has been written into the corresponding storage space.

[0044] In one embodiment, the security level corresponding to the target sub-data is obtained. When the target data length of the target sub-data is less than or equal to the spatial data length, and the security level of the target sub-data is less than a preset security level, the target sub-data is stored in the target index space. If the security level of the target sub-data is greater than or equal to the preset level, the target sub-data is stored in the target heap space corresponding to the target business data. A corresponding security level is set for each sub-business data contained in the target business data. The corresponding storage method is determined based on the security level and data length of different sub-business data, which improves resource utilization while ensuring data storage security.

[0045] In one embodiment, the access level corresponding to the target sub-data is obtained. The access level characterizes the frequency of access to the target sub-data; the higher the access level, the more frequently the target sub-data is accessed. The security level corresponding to the target sub-data is also obtained. When the target data length is less than or equal to the spatial data length, and the access level is greater than or equal to a preset access level, the target sub-data is stored in the target index space, thereby improving query speed and resource utilization. When the target data length is less than or equal to the spatial data length, the access level is less than the preset access level, and the security level is greater than or equal to the preset security level, the target sub-data is stored in the target heap space, thereby improving the security of the target sub-data. When the target data length is less than or equal to the spatial data length, the security level is less than the preset security level, and the access level is less than the preset access level, the target sub-data is stored in the target index space, thereby improving query speed and resource utilization. By setting corresponding security and access levels for each sub-business data included in the target business data, and determining the corresponding storage method based on the security level, access level, and data length of different sub-business data, the security and access requirements of different sub-business data are comprehensively considered during data storage, effectively improving the flexibility of data storage.

[0046] Step S208: When the length of the target data corresponding to the target sub-data is greater than the length of the space data in the target index space, the target sub-data is written into the target heap space corresponding to the target business data to obtain the target pointer corresponding to the target sub-data. The target pointer is then written into the target index space to obtain the target index sequence.

[0047] The target heap space refers to the heap storage space allocated for the target business data. The target pointer refers to the starting address of the storage space corresponding to the target sub-data in the target heap space. For example, when the target sub-data is the first sub-data stored in the target heap space, the target pointer corresponding to the target sub-data is 0. If the data length of the target sub-data is 4 bytes, the target pointer corresponding to the second sub-data stored in the target heap space is 4.

[0048] For example, by comparing the target data length of the target sub-data with the spatial data length of the target index space, when the target data length is less than or equal to the spatial data length of the target index space, the computer device allocates corresponding storage space for the target sub-data in the heap, which serves as the target heap space corresponding to the target sub-data. The target sub-data is written into the target heap space, and the target pointer corresponding to the target heap space is written into the target index space to obtain the target index sequence. The process continues to determine the target sub-data within each sub-business data contained in the target business data, returning to the step of obtaining the initial index sequence corresponding to the target business data, until all sub-business data contained in the target business data has been written into the corresponding storage space.

[0049] In the aforementioned business data storage method, an initial index sequence corresponding to the target business data is obtained, and target sub-data is determined from each sub-business data contained within the target business data. The index space corresponding to the target sub-data in the initial index sequence is used as the target index space. When the length of the target data corresponding to the target sub-data is less than or equal to the length of the target index space, the target sub-data is written into the target index space to obtain the target index sequence. When the length of the target data corresponding to the target sub-data is greater than the length of the target index space, the target sub-data is written into the target heap space corresponding to the target business data to obtain the target pointer corresponding to the target sub-data. The target pointer is then written into the target index space to obtain the target index sequence. In this way, when the length of the target data corresponding to the target sub-data is less than or equal to the length of the target index space, the target sub-data is directly written into the target index space without allocating corresponding heap space for the target sub-data, which avoids opening unnecessary resource space and effectively improves resource utilization.

[0050] In one embodiment, the business data storage method further includes:

[0051] The data lengths corresponding to each sub-business data are calculated to obtain the expected data length of the target business data; the spatial data length is determined based on the expected data length.

[0052] The expected data length refers to the length of storage space required to store the various sub-business data contained in the target business data.

[0053] For example, the computer device counts the data lengths of the sub-business data contained in the target business data, calculates the sum of the data lengths of each sub-business data, and obtains the expected data length of the target business data. Based on the expected data length, the spatial data length corresponding to the index space is calculated. For example, the spatial data length corresponding to the index space of the target business data is typically 4 bytes or 8 bytes. When the spatial data length is 4 bytes, the corresponding maximum addressing range is 2. 31-1, when the spatial data length is 8 bytes, the corresponding maximum addressing range is 2. 63 -1, if the expected data length is 2 30 When dealing with bytes, the space data length can be set to 4 bytes. If the expected data length is 2 bytes... 40 When dealing with bytes, the space data length can be set to 8 bytes.

[0054] In one embodiment, the computer device determines the lengths of each candidate data segment corresponding to the index space based on the expected data length. The candidate data length refers to the spatial data length of each candidate segment corresponding to the index space. The maximum addressable range corresponding to each candidate data length is greater than the expected data length, and the maximum value of the candidate data length is 8 bytes. To improve resource utilization, the minimum value among the candidate data lengths is used as the spatial data length. For example, when the expected data length is 2... 30 When the index space has candidate data lengths of 4 bytes, 5 bytes, 6 bytes, 7 bytes, and 8 bytes respectively, the space data length is set to 4 bytes; when the expected data length is 2 bytes... 50 When the index space is set to bytes, the lengths of the candidate data are 7 bytes and 8 bytes respectively, and the space data length is set to 7 bytes.

[0055] In one embodiment, the required storage space length for the target business data can be manually set. Specifically, the required storage space length for the target business data is determined by judging the business type to which the target business data belongs. For example, when the maximum storage space required by the business type to which the target business data belongs is less than 2... 31 When the value is -1 byte, the length of the space data corresponding to the target business data can be manually set to 4 bytes; when the maximum storage space required by the business type to which the target business data belongs is greater than 2 bytes... 31 When the value is -1 byte, the length of the spatial data corresponding to the target business data can be manually set to 8 bytes; and so on.

[0056] In the above embodiments, by statistically analyzing the data lengths corresponding to each sub-business data, the expected data length corresponding to the target business data is determined, and the spatial data length corresponding to the index space is determined based on the expected data length. This can effectively save storage resources of computer equipment and improve resource utilization.

[0057] In one embodiment, such as Figure 3 As shown, determining the spatial data length based on the expected data length includes:

[0058] Step S302: Perform binary conversion on the expected data length to obtain the conversion result, and obtain the initial data length based on the conversion result.

[0059] Step S304: Obtain the reference data length, and determine the expansion length range based on the reference data length and the initial data length.

[0060] Step S306: In the sub-business data corresponding to the target business data, statistical data of sub-business data whose length is within the range of the extended length are obtained to obtain the extended sub-data volume.

[0061] Step S308: Calculate the target sub-data volume by counting the sub-business data contained in the target business data.

[0062] Step S310: When the ratio between the expanded sub-data volume and the target sub-data volume is greater than the preset ratio, the initial data length is updated based on the reference data length to obtain the spatial data length.

[0063] The conversion result refers to the result obtained after converting the expected data length into binary.

[0064] The initial data length refers to the initial spatial data length corresponding to the index space determined based on the expected data length. The reference data length refers to the data length used to expand the initial data length; the reference data length is greater than or equal to the initial data length. For example, the reference data length can typically be set to 8 bytes. The expanded length range refers to the data length range determined by the initial data length and the reference data length. The initial data length is the lower limit of the expanded length range, and the reference data length is the lower limit of the expanded length range. The expanded length range includes the reference data length. For example, when the initial data length is 2 bytes and the reference data length is 4 bytes, the expanded length range is (2, 4). The expanded sub-data volume refers to the number of sub-business data whose data length is within the expanded length range. The target sub-data volume refers to the number of sub-business data contained within the target business data.

[0065] For example, the expected data length is converted to binary to obtain the conversion result. The initial data length corresponding to the index space is determined based on the number of bits in the conversion result. For instance, when the expected data length is 255 bytes, converting 255 to binary yields 1111 1111, which corresponds to 8 bits. Therefore, the initial data length should be greater than or equal to 1 byte. For example, the initial data length can be set to 1 byte or 2 bytes. A reference data length is obtained. When the initial data length is less than the reference data length, the expansion length range is determined based on the initial data length and the reference data length. Among the sub-business data included in the target business data, the sub-business data whose length falls within the expansion length range is statistically analyzed to obtain the expansion sub-data volume. The target sub-data volume is obtained by statistically analyzing the sub-business data included in the target business data. The ratio between the expansion sub-data volume and the target sub-data volume is calculated. When the ratio is greater than or equal to a preset ratio, the initial data length is updated with the reference data length to obtain the spatial data length. For example, the preset ratio can be set to 0.5, which means that when the data length of 50% or more of the sub-business data in the target business data is within the extended length range, the initial data length is updated with the reference data length. For example, when the reference data length is 8 bytes and the initial data length is 4 bytes, the initial data length is updated to 8 bytes.

[0066] In the above embodiments, the amount of sub-data to be expanded is determined by statistically analyzing the sub-service data within the expanded length range. When the ratio of the amount of sub-service data to be expanded to the target amount of sub-service data is greater than a preset threshold, it indicates that there is still a large amount of short-length sub-service data that needs to be stored in the heap space. At this time, the initial data length is updated based on the reference data length, so that each sub-service data whose data length is within the expanded length range can be directly written into the index space, which can further improve resource utilization.

[0067] In one embodiment, the business data storage method further includes:

[0068] In the target index sequence, the target flag bit corresponding to the target index space is updated based on the storage method corresponding to the target sub-data. The storage method includes heap space storage and index space storage, and the target flag bit is used to characterize the storage method corresponding to the target sub-data.

[0069] Here, the marker bit refers to the storage space in the index sequence used to record the storage method corresponding to each sub-data, for example, such as Figure 4As shown, the flag bit can be located before the index space, occupying 1 byte. When the flag bit corresponding to the sub-data is 1, it indicates that the sub-data is stored in the index space, i.e., pointer space storage. When the flag bit corresponding to the sub-data is 0, it indicates that the sub-data is stored in the heap space, i.e., heap storage. The target flag bit refers to the flag bit corresponding to the target sub-data in the target index sequence. Heap space storage means allocating corresponding storage space in the heap as the heap space corresponding to the sub-data, and storing the sub-data in this heap space. Index space storage means storing the sub-data directly in the corresponding index space.

[0070] For example, the computer device updates the target flag bit corresponding to the target index space based on the storage method corresponding to the target sub-data. For instance, it can be specified that when the storage method corresponding to the target sub-data is index space storage, the target flag bit corresponding to the target sub-data is set to 1, and when the storage method corresponding to the target sub-data is heap space storage, the target flag bit corresponding to the target sub-data is set to 0.

[0071] In one embodiment, the target flag bit corresponding to the target index space can be stored outside the target index sequence. For example, a flag bit sequence can be established, which stores the flag bits corresponding to each index space.

[0072] In the above embodiments, the target flag bit corresponding to the target sub-data is updated based on the storage method corresponding to the target sub-data, so that when performing data query, the storage method corresponding to the target sub-data can be determined according to the target flag bit, and then the target sub-data can be queried from the corresponding storage space based on the storage method corresponding to the target sub-data, thus ensuring the reliability of data query.

[0073] In one embodiment, the business data storage method further includes:

[0074] Obtain the sub-data query request; the sub-data query request carries the data identifier corresponding to the sub-data to be queried; based on the data identifier, obtain the current index sequence corresponding to the business data to which the sub-data to be queried belongs; based on the data identifier, determine the index space to be queried corresponding to the sub-data to be queried in the current index sequence; based on the query flag bit corresponding to the index space to be queried, determine the storage method corresponding to the sub-data to be queried; based on the storage method corresponding to the sub-data to be queried, read the sub-data to be queried from the corresponding storage space, and return the sub-data to be queried to the querying party corresponding to the sub-data query request.

[0075] Here, a sub-data query request refers to a query request corresponding to the sub-data to be queried within the target business data. The sub-data to be queried refers to the sub-business data queried by the sub-data query request. The data identifier is the identifier corresponding to the sub-data to be queried, indicating the current index sequence corresponding to the sub-data to be queried, and the index space to be queried corresponding to the sub-data to be queried within the current index sequence. The current index sequence refers to the index sequence corresponding to the business data mentioned in the sub-data to be queried. The index space to be queried refers to the index space corresponding to the sub-data to be queried within the current index sequence. The query flag bit refers to the flag bit of the index space to be queried corresponding to the sub-data to be queried. The querying party corresponding to the sub-data query request refers to the computer device issuing the sub-data query request; the querying party can be a terminal or a server.

[0076] For example, the computer device obtains a sub-data query request sent by the querying party, and based on the data identifier carried in the sub-data query request, finds the current index sequence corresponding to the business data to which the sub-data to be queried belongs, and then determines the query index space corresponding to the sub-data to be queried in the current index sequence through the data identifier. Based on the query flag bit corresponding to the query index space, the storage method corresponding to the sub-data to be queried is determined. Then, based on the storage method and the query index space, the storage space corresponding to the sub-data to be queried is determined, the sub-data to be queried is read from the corresponding storage space, and the retrieved sub-data to be queried is returned to the querying party corresponding to the sub-data query request.

[0077] In the above embodiments, the sub-data query request carries the data identifier corresponding to the sub-data to be queried. Based on the data identifier, the index space to be queried corresponding to the sub-data to be queried is determined. Then, based on the query flag bit corresponding to the index space, the storage method corresponding to the sub-data to be queried is determined. Finally, the sub-data to be queried is read from the corresponding storage space based on the storage method corresponding to the sub-data to be queried, which can ensure the reliability of data query.

[0078] In one embodiment, reading the sub-data to be queried from the corresponding storage space based on the storage method of the sub-data to be queried includes:

[0079] When the storage method corresponding to the sub-data to be queried is heap space storage, the storage space to be queried in the corresponding heap space is determined based on the pointer stored in the index space to be queried, and the sub-data to be queried is read from the storage space to be queried; when the storage method corresponding to the sub-data to be queried is index space storage, the sub-data to be queried is read from the index space to be queried.

[0080] The heap space to be queried refers to the heap storage space allocated to the target business data to which the sub-data to be queried belongs. The storage space to be queried refers to the storage space within the heap space to which the sub-data to be queried is stored.

[0081] For example, when the storage method corresponding to the sub-data to be queried is heap space storage, a pointer to the sub-data to be queried is obtained from the index space to be queried. This pointer is used to determine the storage space to be queried corresponding to the sub-data in the heap space to be queried, and the sub-data to be queried is read from the storage space to be queried. When the storage method corresponding to the sub-data to be queried is index space storage, the sub-data to be queried is read from the index space to be queried corresponding to the sub-data.

[0082] In the above embodiments, when the storage method corresponding to the sub-data to be queried is index space storage, the sub-data to be queried is directly read from the index space corresponding to the sub-business data to be queried, reducing the time overhead of locating the storage space corresponding to the data to be queried based on pointers and improving the efficiency of data query.

[0083] In one embodiment, the target business data is a target table, and the target sub-data is target cell data.

[0084] The target table refers to the table where data needs to be stored, and it contains a large number of cells of varying lengths. Target cell data refers to the data stored in the cells of the target table.

[0085] In one specific embodiment, the business data storage method of this application can be applied to storing data in a table. The business data storage method includes the following steps:

[0086] 1. Obtain the index sequence corresponding to the target table.

[0087] The computer device obtains the initial index sequence corresponding to the target table and obtains the spatial data length of the index space in the initial index sequence.

[0088] 2. Determine the target cell data and the target index space.

[0089] The computer device determines the target cell data from the individual cell data contained in the target table, and uses the index space corresponding to the target cell data in the initial index sequence as the target index space.

[0090] 3. Store target cell data

[0091] like Figure 5As shown, when the data length corresponding to the target cell is less than or equal to the spatial data length of the index space, the target cell data is written to the target index space, i.e., stored using the pointer space, and the corresponding flag bit of the target index space is updated to obtain the target index sequence. When the data length corresponding to the target cell is greater than the spatial data length of the index space, the target cell data and its corresponding data length are written to the target heap space corresponding to the target table to obtain the target pointer corresponding to the target cell data. The target pointer is then written to the target index space to obtain the target index sequence.

[0092] In the above embodiments, when the target table contains a large number of cells with a length less than or equal to the index space length, these cells are directly stored in the corresponding index space, making full use of the index space. A flag is used to indicate whether the data is stored directly in the index space or in the heap. This significantly improves resource utilization and reduces waste. Furthermore, storing cell data at the index reduces the overhead of one pointer-based lookup when querying data, thus reducing the time cost of locating the corresponding storage space in the heap based on the pointer, improving data retrieval performance, and making the program more efficient.

[0093] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0094] Based on the same inventive concept, this application also provides a business data storage device for implementing the business data storage method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more business data storage device embodiments provided below can be found in the limitations of the business data storage method described above, and will not be repeated here.

[0095] In one embodiment, such as Figure 6 As shown, a business data storage device is provided, including: an index sequence acquisition module 602, a target sub-data determination module 604, and a target sub-data storage module 606, wherein:

[0096] The target sub-data determination module is used to determine the target sub-data from the various sub-business data contained in the target business data, and to use the index space corresponding to the target sub-data in the initial index sequence as the target index space.

[0097] The target sub-data storage module is used to write the target sub-data into the target index space to obtain the target index sequence when the length of the target data corresponding to the target sub-data is less than or equal to the length of the spatial data in the target index space.

[0098] The target sub-data storage module is also used to write the target sub-data into the target heap space corresponding to the target business data when the length of the target data corresponding to the target sub-data is greater than the length of the space data in the target index space, to obtain the target pointer corresponding to the target sub-data, and to write the target pointer into the target index space to obtain the target index sequence.

[0099] The aforementioned business data storage device obtains the initial index sequence corresponding to the target business data and determines the target sub-data from the various sub-business data contained within the target business data. The index space corresponding to the target sub-data in the initial index sequence is used as the target index space. When the length of the target data corresponding to the target sub-data is less than or equal to the length of the target index space, the target sub-data is written into the target index space to obtain the target index sequence. When the length of the target data corresponding to the target sub-data is greater than the length of the target index space, the target sub-data is written into the target heap space corresponding to the target business data to obtain the target pointer corresponding to the target sub-data. The target pointer is then written into the target index space to obtain the target index sequence. In this way, when the length of the target data corresponding to the target sub-data is less than or equal to the length of the target index space, the target sub-data is directly written into the target index space without allocating corresponding heap space for the target sub-data, thus avoiding unnecessary resource allocation and effectively improving resource utilization.

[0100] In one embodiment, such as Figure 7 As shown, the business data storage device also includes:

[0101] The spatial data length determination module 702 is used to calculate the data length corresponding to each sub-business data, obtain the expected data length corresponding to the target business data, and determine the spatial data length based on the expected data length.

[0102] The target flag update module 704 is used to update the target flag bit corresponding to the target index space in the target index sequence based on the storage method corresponding to the target sub-data; the storage method includes heap space storage and index space storage, and the target flag bit is used to represent the storage method corresponding to the target sub-data.

[0103] The query request response module 706 is used to obtain a sub-data query request; the sub-data query request carries a data identifier corresponding to the sub-data to be queried; based on the data identifier, it obtains the current index sequence corresponding to the business data to which the sub-data to be queried belongs; based on the data identifier, it determines the index space to be queried corresponding to the sub-data to be queried in the current index sequence; based on the query flag bit corresponding to the index space to be queried, it determines the storage method corresponding to the sub-data to be queried; based on the storage method corresponding to the sub-data to be queried, it reads the sub-data to be queried from the corresponding storage space and returns the sub-data to be queried to the querying party corresponding to the sub-data query request.

[0104] In one embodiment, the spatial data length determination module 702 is further configured to:

[0105] The expected data length is converted into binary to obtain the conversion result, and the initial data length is obtained based on the conversion result; a reference data length is obtained, and the expansion length range is determined based on the reference data length and the initial data length; in the sub-business data corresponding to the target business data, the sub-business data whose length is within the expansion length range is statistically analyzed to obtain the expansion sub-data volume; the sub-business data included in the target business data is statistically analyzed to obtain the target sub-data volume; when the ratio between the expansion sub-data volume and the target sub-data volume is greater than a preset ratio, the initial data length is updated based on the reference data length to obtain the spatial data length.

[0106] In one embodiment, the query request response module 706 is further configured to:

[0107] When the storage method corresponding to the sub-data to be queried is heap space storage, the storage space to be queried in the corresponding heap space is determined based on the pointer stored in the index space to be queried, and the sub-data to be queried is read from the storage space to be queried; when the storage method corresponding to the sub-data to be queried is index space storage, the sub-data to be queried is read from the index space to be queried.

[0108] Each module in the aforementioned business data storage device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0109] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 8As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores initial index sequences, target sub-data, and other data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a business data storage method.

[0110] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 9 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a business data storage method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0111] Those skilled in the art will understand that Figure 8 , 9The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0112] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0113] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.

[0114] In one embodiment, a computer program product or computer program is provided, the computer product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, causing the computer device to perform the steps in the above-described method embodiments.

[0115] It should be noted that 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, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data shall comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0116] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0117] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0118] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A business data storage method, characterized in that, The method includes: Obtain the initial index sequence corresponding to the target business data; Target sub-data is determined from the various sub-business data contained in the target business data, and the index space corresponding to the target sub-data in the initial index sequence is used as the target index space; the target business data is a target table, and the target sub-data is target cell data; When the target data length corresponding to the target sub-data is less than or equal to the spatial data length of the target index space, the target sub-data is written into the target index space to obtain the target index sequence; wherein, the process of determining the spatial data length includes: determining the initial data length based on the expected data length corresponding to the target business data; Obtain the reference data length, and determine the expansion length range based on the reference data length and the initial data length; In the sub-business data corresponding to the target business data, the sub-business data whose statistical data length is within the range of the extended length are used to obtain the extended sub-data volume; The target sub-data volume is obtained by counting the sub-business data included in the target business data; When the ratio between the expanded sub-data volume and the target sub-data volume is greater than a preset ratio, the initial data length is updated based on the reference data length to obtain the spatial data length, so that each sub-business data whose data length is within the expanded length range is directly written into the index space. When the length of the target data corresponding to the target sub-data is greater than the length of the space data in the target index space, the target sub-data is written into the target heap space corresponding to the target business data to obtain the target pointer corresponding to the target sub-data. The target pointer is then written into the target index space to obtain the target index sequence.

2. The method according to claim 1, characterized in that, The process of estimating the data length corresponding to the target business data includes: The expected data length corresponding to each of the sub-business data is obtained by calculating the data length of each sub-business data. The expected data length refers to the length of the storage space required to store each sub-business data contained in the target business data.

3. The method according to claim 1, characterized in that, The step of determining the initial data length based on the expected data length corresponding to the target business data includes: The expected data length is converted into binary to obtain the conversion result, and the initial data length is obtained based on the conversion result.

4. The method according to claim 1, characterized in that, The method further includes: In the target index sequence, the target flag bit corresponding to the target index space is updated based on the storage method corresponding to the target sub-data; the storage method includes heap space storage and index space storage, and the target flag bit is used to characterize the storage method corresponding to the target sub-data.

5. The method according to claim 1, characterized in that, The method further includes: Obtain a sub-data query request; the sub-data query request carries the data identifier corresponding to the sub-data to be queried; Based on the data identifier, obtain the current index sequence corresponding to the business data to which the sub-data to be queried belongs; Based on the data identifier, determine the query index space corresponding to the query sub-data in the current index sequence; Based on the query tag bit corresponding to the query index space, determine the storage method corresponding to the query sub-data; Based on the storage method corresponding to the sub-data to be queried, the sub-data to be queried is read from the corresponding storage space, and the sub-data to be queried is returned to the querying party corresponding to the sub-data query request.

6. The method according to claim 5, characterized in that, The step of reading the sub-data to be queried from the corresponding storage space based on the storage method corresponding to the sub-data to be queried includes: When the storage method corresponding to the sub-data to be queried is heap space storage, the storage space to be queried in the corresponding heap space of the sub-data to be queried is determined based on the pointer stored in the index space to be queried, and the sub-data to be queried is read from the storage space to be queried. When the storage method corresponding to the sub-data to be queried is index space storage, the sub-data to be queried is read from the index space to be queried.

7. A business data storage device, characterized in that, The device includes: The index sequence acquisition module is used to acquire the initial index sequence corresponding to the target business data; The target sub-data determination module is used to determine target sub-data from the various sub-business data contained in the target business data, and to use the index space corresponding to the target sub-data in the initial index sequence as the target index space; the target business data is a target table, and the target sub-data is target cell data; The target sub-data storage module is used to write the target sub-data into the target index space to obtain a target index sequence when the target data length corresponding to the target sub-data is less than or equal to the spatial data length of the target index space; wherein, the process of determining the spatial data length includes: determining the initial data length according to the expected data length corresponding to the target business data; Obtain the reference data length, and determine the expansion length range based on the reference data length and the initial data length; In the sub-business data corresponding to the target business data, the sub-business data whose statistical data length is within the range of the extended length are used to obtain the extended sub-data volume; The target sub-data volume is obtained by counting the sub-business data included in the target business data; When the ratio between the expanded sub-data volume and the target sub-data volume is greater than a preset ratio, the initial data length is updated based on the reference data length to obtain the spatial data length, so that each sub-business data whose data length is within the expanded length range is directly written into the index space. The target sub-data storage module is further configured to, when the length of the target data corresponding to the target sub-data is greater than the length of the space data in the target index space, write the target sub-data into the target heap space corresponding to the target business data to obtain the target pointer corresponding to the target sub-data, and write the target pointer into the target index space to obtain the target index sequence.

8. 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 according to any one of claims 1 to 6.

9. 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 according to any one of claims 1 to 6.

10. A computer product comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.