Search

CN-116185305-B - Service data storage method, device, computer equipment and storage medium

CN116185305BCN 116185305 BCN116185305 BCN 116185305BCN-116185305-B

Abstract

The present application relates to a business data storage method, apparatus, computer device, storage medium and computer program product. The method comprises the steps of obtaining an initial index sequence corresponding to target service data, determining target sub-data from all sub-service data contained in the target service data, taking an index space corresponding to the target sub-data in the initial index sequence as a target index space, writing the target sub-data into the target index space to obtain the target index sequence when the target data length corresponding to the target sub-data is smaller than or equal to the space data length of the target index space, writing the target sub-data into a target heap space corresponding to the target service data to obtain a target pointer corresponding to the target sub-data when the target data length corresponding to the target sub-data is larger than the space data length of the target index space, and writing the target pointer into the target index space to obtain the target index sequence. The method can improve the utilization rate of resources.

Inventors

  • TAN SHAOMIN

Assignees

  • 金蝶软件(中国)有限公司

Dates

Publication Date
20260512
Application Date
20230314

Claims (10)

  1. 1. A method of storing business data, the method comprising: acquiring an initial index sequence corresponding to target service data; Determining target sub-data from all sub-service data contained in the target service data, and taking an index space corresponding to the target sub-data in the initial index sequence as a target index space, wherein the target service 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 smaller than or equal to the space data length of the target index space, writing the target sub data into the target index space to obtain a target index sequence, wherein the determining process of the space data length comprises the steps of determining an initial data length according to the expected data length corresponding to the target service data; Acquiring a reference data length, and determining an extended length range based on the reference data length and the initial data length; Among the sub-service data corresponding to the target service data, counting the sub-service data with the data length within the extended length range to obtain an extended sub-data volume; counting sub-business data contained in the target business data to obtain target sub-data quantity; when the ratio between the extended sub data amount and the target sub data amount is larger than a preset ratio, updating the initial data length based on the reference data length to obtain the space data length, so that each sub service data with the data length in the extended length range is directly written into an index space; When the target data length corresponding to the target sub data is larger than the space data length of the target index space, writing the target sub data into a target heap space corresponding to the target service data to obtain a target pointer corresponding to the target sub data, and writing the target pointer into the target index space to obtain a target index sequence.
  2. 2. The method of claim 1, wherein the process of predicting the data length corresponding to the target service data comprises: and counting the data length corresponding to each piece of sub-service data respectively to obtain the predicted data length corresponding to the target service data, wherein the predicted data length refers to the length of a storage space required for storing each piece of sub-service data contained in the target service data.
  3. 3. The method of claim 1, wherein the determining the initial data length according to the expected data length corresponding to the target service data comprises: and binary conversion is carried out on the predicted data length to obtain a conversion result, and the initial data length is obtained based on the conversion result.
  4. 4. The method according to claim 1, wherein the method further comprises: and updating a target mark bit corresponding to the target index space based on a storage mode corresponding to the target sub-data in the target index sequence, wherein the storage mode comprises heap space storage and index space storage, and the target mark bit is used for representing the storage mode corresponding to the target sub-data.
  5. 5. The method according to claim 1, wherein the method further comprises: acquiring a sub-data query request, wherein the sub-data query request carries a data identifier corresponding to sub-data to be queried; based on the data identification, acquiring a current index sequence corresponding to the business data to which the sub-data to be queried belongs; determining an index space to be queried corresponding to the sub data to be queried in the current index sequence based on the data identification; determining a storage mode corresponding to the sub-data to be queried based on the marking bit to be queried corresponding to the index space to be queried; And based on the storage mode corresponding to the sub-data to be queried, reading the sub-data to be queried from the corresponding storage space, and returning the sub-data to be queried to a querying party corresponding to the sub-data query request.
  6. 6. The method according to claim 5, wherein the reading the sub-data to be queried from the corresponding storage space based on the storage manner corresponding to the sub-data to be queried comprises: When the storage mode corresponding to the sub-data to be queried is heap space storage, determining a storage space to be queried of the sub-data to be queried in the corresponding heap space to be queried based on the pointer stored in the index space to be queried, and reading the sub-data to be queried from the storage space to be queried; And when the storage mode corresponding to the sub-data to be queried is index space storage, reading the sub-data to be queried from the index space to be queried.
  7. 7. A business data storage device, said device comprising: The index sequence acquisition module is used for acquiring an initial index sequence corresponding to the target service data; The target sub-data determining module is used for determining target sub-data from all sub-service data contained in the target service data, and taking an index space corresponding to the target sub-data in the initial index sequence as a target index space; the target sub-data storage module is used for writing 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 smaller than or equal to the space data length of the target index space, wherein the determining process of the space data length comprises the steps of determining an initial data length according to the expected data length corresponding to the target service data; Acquiring a reference data length, and determining an extended length range based on the reference data length and the initial data length; Among the sub-service data corresponding to the target service data, counting the sub-service data with the data length within the extended length range to obtain an extended sub-data volume; counting sub-business data contained in the target business data to obtain target sub-data quantity; when the ratio between the extended sub data amount and the target sub data amount is larger than a preset ratio, updating the initial data length based on the reference data length to obtain the space data length, so that each sub service data with the data length in the extended length range is directly written into an index space; And the target sub-data storage module is further used for writing the target sub-data into a target heap space corresponding to the target service data to obtain a target pointer corresponding to the target sub-data when the target data length corresponding to the target sub-data is greater than the space data length of the target index space, and writing the target pointer into the target index space to obtain a target index sequence.
  8. 8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
  9. 9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
  10. 10. A computer product comprising a computer program, characterized in that the computer program, when executed by a processor, implements the steps of the method of any one of claims 1 to 6.

Description

Service data storage method, device, computer equipment and storage medium Technical Field The present application relates to the field of computer technology, and in particular, to a service data storage method, apparatus, computer device, storage medium, and computer program product. Background With the development of data storage technology, a heap storage technology appears, a large amount of data with different data lengths are stored in a heap, indexes corresponding to the data are recorded, pointers corresponding to the data in the heap are stored in the indexes, and the values of the data can be obtained by accessing the heap through the pointers. However, with the conventional heap storage technique, the problem of low resource utilization occurs in blindly storing data in the heap. Disclosure of Invention In view of the foregoing, it is desirable to provide a business data storage method, apparatus, computer device, computer readable storage medium, and computer program product that can improve resource utilization. The application provides a service data storage method. The method comprises the following steps: acquiring an initial index sequence corresponding to target service data; Determining target sub-data from all sub-service data contained in the target service data, and taking an index space corresponding to the target sub-data in the initial index sequence as a target index space; when the target data length corresponding to the target sub data is smaller than or equal to the space data length of the target index space, writing 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 greater than the space data length of the target index space, writing the target sub data into the target heap space corresponding to the target service data to obtain a target pointer corresponding to the target sub data, and writing the target pointer into the target index space to obtain a target index sequence. The application also provides a service data storage device. The device comprises: The index sequence acquisition module is used for acquiring an initial index sequence corresponding to the target service data; The target sub-data determining module is used for determining target sub-data from all sub-service data contained in the target service data, and taking an index space corresponding to the target sub-data in the initial index sequence as a target index space; the target sub-data storage module is used for writing 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 smaller than or equal to the space data length of the target index space; and the target sub-data storage module is further used for writing the target sub-data into a target heap space corresponding to the target service data when the target data length corresponding to the target sub-data is greater than the space data length of the target index space, so as to obtain a target pointer corresponding to the target sub-data, and writing the target pointer into the target index space, so as to obtain a target index sequence. A computer device comprising a memory storing a computer program and a processor implementing the steps of the business data storage method described above when the processor executes the computer program. A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the business data storage method described above. A computer program product comprising a computer program which, when executed by a processor, performs the steps of the business data storage method described above. According to the business data storage method, the business data storage device, the computer equipment, the storage medium and the computer program product, the initial index sequence corresponding to the target business data is obtained, the target sub-data is determined from all the 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. And when the target data length corresponding to the target sub data is smaller than or equal to the space data length of the target index space, writing 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 greater than the space data length of the target index space, writing the target sub data into the target heap space corresponding to the target service data to obtain a target pointer corresponding to the target sub data, and writing the target pointer into the target index space to obtain a target index sequence. Therefore, when the target data length corresponding to the target sub data is smaller than or equal to the space