[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

WO2024187779A1 - Service data storage method and apparatus, computer device, and storage medium - Google Patents

Service data storage method and apparatus, computer device, and storage medium Download PDF

Info

Publication number
WO2024187779A1
WO2024187779A1 PCT/CN2023/129235 CN2023129235W WO2024187779A1 WO 2024187779 A1 WO2024187779 A1 WO 2024187779A1 CN 2023129235 W CN2023129235 W CN 2023129235W WO 2024187779 A1 WO2024187779 A1 WO 2024187779A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
target
sub
space
queried
Prior art date
Application number
PCT/CN2023/129235
Other languages
French (fr)
Chinese (zh)
Inventor
谈少民
Original Assignee
金蝶软件(中国)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 金蝶软件(中国)有限公司 filed Critical 金蝶软件(中国)有限公司
Publication of WO2024187779A1 publication Critical patent/WO2024187779A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0631Configuration or reconfiguration of storage systems by allocating resources to storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present 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.
  • heap storage technology With the development of data storage technology, heap storage technology has emerged. It stores massive amounts of data of different lengths in a heap and records the indexes corresponding to each piece of data. The index stores the pointer corresponding to the data in the heap. The value of the data can be obtained by accessing the heap through the pointer.
  • the present application provides a method for storing business data.
  • the method comprises:
  • the target sub-data is written into the target index space to obtain a target index sequence
  • the target sub-data is written into the target heap space corresponding to the target business data, the target pointer corresponding to the target sub-data is obtained, and the target pointer is written into the target index space to obtain the target index sequence.
  • the present application also provides a business data storage device.
  • the device comprises:
  • An index sequence acquisition module is used to acquire an initial index sequence corresponding to target business data
  • a target sub-data storage module 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 less than or equal to the spatial data length of the target index space;
  • a computer device includes a memory and a processor.
  • the memory stores a computer program.
  • the processor executes the computer program, the steps of the business data storage method are implemented.
  • a computer-readable storage medium stores a computer program, which implements the steps of the above-mentioned business data storage method when executed by a processor.
  • a computer program product includes a computer program, which implements the steps of the above-mentioned business data storage method when executed by a processor.
  • FIG1 is an application environment diagram of a business data storage method in one embodiment
  • FIG2 is a schematic diagram of a flow chart of a method for storing business data in one embodiment
  • FIG3 is a schematic diagram of a process for determining the length of spatial data in one embodiment
  • FIG4 is a schematic diagram of business data storage in one embodiment
  • FIG5 is a schematic diagram of business data storage in another embodiment
  • FIG6 is a block diagram of a business data storage device in one embodiment
  • FIG7 is a block diagram of a service data storage device in another embodiment
  • FIG8 is a diagram showing the internal structure of a computer device in one embodiment
  • FIG. 9 is a diagram showing the internal structure of a computer device in another embodiment.
  • the business data storage method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1.
  • the terminal 102 communicates with the server 104 through the network.
  • the data storage system can store the data that the server 104 needs to process.
  • the data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers.
  • the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices.
  • the Internet of Things devices can be smart TVs, smart car-mounted devices, etc.
  • Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc.
  • the server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.
  • the terminal 102 and the server 104 can be directly or indirectly connected via wired or wireless communication, and this application is not limited here.
  • Both the terminal and the server can be used independently to execute the business data storage method provided in the embodiments of the present application.
  • the terminal obtains the initial index sequence corresponding to the target business data.
  • the terminal determines the target sub-data from the various sub-business data contained in the target business data, and uses the index space corresponding to the target sub-data in the initial index sequence as the target index space.
  • the terminal writes the target sub-data into the target index space to obtain a target index sequence.
  • the terminal When the target data length corresponding to the target sub-data is greater than the spatial data length of the target index space, the terminal writes the target sub-data into the target heap space corresponding to the target business 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 terminal and the server can also be used together to execute the business data storage method provided in the embodiments of the present application.
  • the terminal sends a business data storage request carrying the target business data identifier to the server, and the server obtains the initial index sequence corresponding to the target business data based on the target business data identifier.
  • the server determines the target sub-data from the various sub-business data contained in the target business data, and uses the index space corresponding to the target sub-data in the initial index sequence as the target index space.
  • the server writes the target sub-data into the target index space to obtain the target index sequence.
  • the server When the target data length corresponding to the target sub-data is greater than the spatial data length of the target index space, the server writes the target sub-data into the target heap space corresponding to the target business 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 business data storage result to the terminal.
  • a business data storage method is provided, and the method is applied to a computer device as an example for explanation.
  • the computer device may be a terminal or a server, and the method may be executed by the terminal or the server itself alone, or may be implemented through interaction between the terminal and the server.
  • the business data storage method includes the following steps:
  • Step S202 Acquire an initial index sequence corresponding to the target business data.
  • business data refers to a business object containing a large amount of sub-business data to be stored.
  • a business object can be an information registration form, and the data information in the cells in the form is the sub-business data;
  • a business object can be a document, and the data information to be stored contained in the document is the sub-business data; and so on.
  • Target business data refers to business data that needs to be stored.
  • Index sequence refers to a sequence composed of index spaces corresponding to each sub-business data in the target business data.
  • the initial index sequence refers to the index sequence corresponding to the target business data before the storage operation is performed on the target sub-data.
  • the target business data when the target business data is stored using a heap storage solution, first, a corresponding storage space is allocated for the target sub-data in the heap, and then the target sub-data is written into the corresponding storage space in the heap, and the pointer corresponding to the storage space is written into the target index space corresponding to the target business data in the initial index sequence.
  • the target business data contains a large amount of sub-business data of variable length, that is, the data length of the sub-business data is not fixed, and there is a large amount of sub-business data whose data length is less than or equal to the index space length, blindly storing the sub-business data in the heap will cause a waste of resources.
  • the computer device when performing a storage operation on the target business data, the computer device first obtains the initial index sequence corresponding to the target business data, and then compares the spatial 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 corresponding storage method.
  • Step S204 determine target sub-data from each sub-service data included in the target service data, and use the index space corresponding to the target sub-data in the initial index sequence as the target index space.
  • the target sub-data refers to the sub-business data that is determined from the various sub-business data contained in the target business data and needs to perform data storage operations.
  • the index space refers to the storage space used to store pointers corresponding to the sub-business data or directly store the sub-business data.
  • the corresponding sub-business data can be read in the heap through the pointer stored in the index space.
  • the sub-business data can be directly read in the index space.
  • the target index space refers to the index space corresponding to the target sub-data.
  • the computer device determines the target sub-data in each sub-business data included in the target business data according to the sub-business data storage order.
  • the target business data does not have a corresponding sub-business data storage order
  • any sub-business data among the sub-business data to be stored included in the target business data is used as the target sub-data.
  • the index space corresponding to the target sub-data is determined in the initial index sequence, and the index space is used as the target index space corresponding to the target sub-data.
  • Step S206 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 a target index sequence.
  • the target data length refers to the data 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 space data length refers to the size of the storage space occupied by the index space. For example, the space 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 the target sub-data is stored, that is, after the target index space in the initial index sequence is updated based on the target sub-data.
  • the target data length of the target sub-data and the spatial data length of the target index space are compared.
  • 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 an updated target index sequence.
  • the target sub-data is continuously determined in each sub-business data contained in the target business data, and the step of returning to obtain the initial index sequence corresponding to the target business data is executed until all sub-business data contained in the target business data are written into the corresponding storage space.
  • the security level corresponding to the target sub-data is obtained.
  • the target data length of the target sub-data is less than or equal to the space data length and the security level of the target sub-data is less than the preset security level
  • the target sub-data is stored in the target index space.
  • 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, and the corresponding storage method is determined according to the security level and data length corresponding to different sub-business data, which can improve resource utilization while ensuring the security of data storage.
  • the access level corresponding to the target sub-data is obtained, and the access level is used to characterize the frequency of the target sub-data being accessed. If the target sub-data is data that needs to be accessed frequently, the access level corresponding to the target sub-data is higher. 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 access level corresponding to the target sub-data is greater than or equal to the preset access level, the target sub-data is stored in the target index space, thereby improving the query speed and improving resource utilization.
  • the target sub-data is stored in the target heap space, thereby improving the security of the target sub-data.
  • the target data length of the target sub-data is less than or equal to the spatial data length
  • the security level corresponding to the target sub-data is less than the preset security level
  • the access level corresponding to the target sub-data is less than the preset access level
  • the target sub-data is stored in the target index space, thereby improving the query speed and improving resource utilization.
  • Corresponding security levels and access levels are set for each sub-business data contained in the target business data, and the corresponding storage method is determined according to the security level, access level and data length corresponding to different sub-business data. In this way, the security needs and access needs corresponding to different sub-business data are comprehensively considered during data storage, effectively improving the flexibility of data storage.
  • Step S208 when the target data length corresponding to the target sub-data is greater than the spatial data length of the target index space, the target sub-data is written into the target heap space corresponding to the target business data, and a target pointer corresponding to the target sub-data is obtained. Write the target pointer into the target index space to obtain the target index sequence.
  • the target heap space refers to the heap storage space allocated for the target business data.
  • the target pointer refers to the first 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.
  • the target data length of the target sub-data and the spatial data length of the target index space are compared.
  • the computer device allocates corresponding storage space for the target sub-data in the heap 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 a target index sequence.
  • the target sub-data is continued to be determined in each sub-business data contained in the target business data, and the step of returning to obtain the initial index sequence corresponding to the target business data is executed until all sub-business data contained in the target business data are written into the corresponding storage space.
  • the index space corresponding to the target sub-data in the initial index sequence is used as the target index space.
  • 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.
  • the target sub-data When the target data length corresponding to the target sub-data is greater than the spatial data length of the target index space, the target sub-data is written into the target heap space corresponding to the target business data, and the target pointer corresponding to the target sub-data is obtained, and the target pointer is written into the target index space to obtain the target index sequence.
  • 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 directly written into the target index space without allocating the corresponding heap space for the target sub-data, which can avoid opening up unnecessary resource space and effectively improve resource utilization.
  • the business data storage method further includes:
  • the data lengths corresponding to each sub-business data are counted to obtain the estimated data length corresponding to the target business data; and the spatial data length is determined based on the estimated data length.
  • the estimated data length refers to the length of the storage space required to store each sub-business data included in the target business data.
  • the computer device counts the data lengths corresponding to the sub-business data contained in the target business data, calculates the sum of the data lengths corresponding to the sub-business data, and obtains the estimated data length corresponding to the target business data.
  • the spatial data length corresponding to the index space is calculated based on the estimated data length.
  • the spatial data length corresponding to the index space of the target business data is usually 4 bytes or 8 bytes.
  • the corresponding maximum addressing range is 2 31 -1.
  • the spatial data length is 8 bytes
  • the corresponding maximum addressing range is 2 63 -1.
  • the estimated data length is 2 30 bytes, the spatial data length can be set to 4 bytes.
  • the estimated data length is 2 40 bytes, The spatial data length can be set to 8 bytes.
  • the computer device determines the lengths of each candidate data corresponding to the index space based on the expected data length.
  • the candidate data length refers to the length of each candidate space data corresponding to the index space.
  • the maximum addressing range corresponding to the candidate data length is greater than the expected data length, and the maximum value of the candidate data length is 8 bytes. In order to improve resource utilization, the minimum value of each candidate data length is used as the space data length.
  • the lengths of each candidate data corresponding to the index space are 4 bytes, 5 bytes, 6 bytes, 7 bytes and 8 bytes, respectively, and the space data length is set to 4 bytes; when the expected data length is 250 bytes, the lengths of each candidate data corresponding to the index space are 7 bytes and 8 bytes, respectively, and the space data length is set to 7 bytes.
  • the spatial data length corresponding to the target business data can be set manually.
  • the spatial data length required for the target business data is determined by judging the business type to which the target business data belongs. For example, when the maximum value of the storage space size required for the business type to which the target business data belongs is less than 2 31 -1 bytes, the spatial data length corresponding to the target business data can be set to 4 bytes manually; when the maximum value of the storage space size required for the business type to which the target business data belongs is greater than 2 31 -1 bytes, the spatial data length corresponding to the target business data can be set to 8 bytes manually; and so on.
  • the expected data length corresponding to the target business data is determined by counting the data lengths corresponding to each sub-business data, and the spatial data length corresponding to the index space is determined based on the expected data length, which can effectively save the storage resources of computer equipment and improve resource utilization.
  • determining the spatial data length based on the expected data length includes:
  • Step S302 performing binary conversion on the estimated data length to obtain a conversion result, and obtaining an initial data length based on the conversion result.
  • Step S304 obtaining a reference data length, and determining an extended length range based on the reference data length and the initial data length.
  • Step S306 Count the sub-business data whose statistical data length is within the extended length range in the sub-business data corresponding to the target business data, and obtain the extended sub-data volume.
  • Step S308 Count the sub-business data included in the target business data to obtain the target sub-data volume.
  • Step S310 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.
  • the conversion result refers to the result obtained by converting the expected data length into binary.
  • 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.
  • the reference data length can usually be set to 8 bytes.
  • the extended length range refers to the initial data length.
  • the data length range is determined by the initial data length and the reference data length.
  • the initial data length is the lower limit of the extended length range
  • the reference data length is the upper limit of the extended length range
  • the extended length range includes the reference data length.
  • the extended length range is (2,4].
  • the extended sub-data volume refers to the number of sub-business data whose data length is within the extended length range.
  • the target sub-data volume refers to the number of sub-business data contained in the target business data.
  • the expected data length is converted into binary to obtain a conversion result
  • the initial data length corresponding to the index space is determined based on the number of bits of the conversion result. For example, when the expected data length is 255 bytes, the conversion result obtained by converting 255 into binary is 1111 1111, and the number of bits corresponding to the conversion result is 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.
  • each sub-business data included in the target business data count each sub-business data whose statistical data length is within the extended length range to obtain the extended sub-data amount. Count each sub-business data included in the target business data to obtain the target sub-data amount. Calculate the ratio between the extended sub-data amount and the target sub-data amount.
  • the ratio is greater than or equal to the preset ratio, update the initial data length with the reference data length to obtain the space data length.
  • the preset ratio can be set to 0.5, that is, 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.
  • the amount of sub-data to be expanded is determined by counting the sub-service data within the extended length range.
  • the ratio of the amount of sub-data to be expanded to the target amount of sub-data is greater than a preset threshold, it indicates that there is still a large amount of sub-service data with a shorter data length that needs to be stored in the heap space.
  • the initial data length is updated based on the reference data length, so that each sub-service data with a data length within the extended length range can be directly written into the index space, which can further improve resource utilization.
  • the business data storage method further includes:
  • the target mark bit corresponding to the target index space is updated; the storage method includes heap space storage and index space storage, and the target mark bit is used to characterize the storage method corresponding to the target sub-data.
  • the mark bit refers to the storage space in the index sequence used to record the storage methods corresponding to each sub-data.
  • the mark bit can be located before the index space and occupy 1 byte.
  • the mark bit corresponding to the sub-data is 1, it means that the storage method corresponding to the sub-data is index space storage, that is, pointer space storage.
  • the mark bit corresponding to the sub-data is 0, it means that the storage method corresponding to the sub-data is heap space storage, that is, heap storage.
  • the target mark bit refers to the mark bit corresponding to the target sub-data in the target index sequence.
  • Heap space storage refers to allocating corresponding
  • the storage space is used as the heap space corresponding to the sub-data, and the sub-data is stored in the heap space.
  • Index space storage refers to directly storing the sub-data in the corresponding index space.
  • the computer device updates the target flag bit corresponding to the target index space based on the storage mode corresponding to the target sub-data. For example, it can be stipulated that when the storage mode 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 mode corresponding to the target sub-data is heap space storage, the target flag bit corresponding to the target sub-data is set to 0.
  • the target flag bit corresponding to the target index space may be stored outside the target index sequence.
  • a flag bit sequence may be established, and the flag bits corresponding to each index space may be stored in the flag bit sequence.
  • the target mark bit corresponding to the target sub-data is updated, so that when performing data query, the storage method corresponding to the target sub-data can be determined according to the target mark 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, thereby ensuring the reliability of data query.
  • the business data storage method further includes:
  • a sub-data query request is obtained, wherein the sub-data query request carries a data identifier corresponding to the sub-data to be queried; based on the data identifier, a current index sequence corresponding to the business data to which the sub-data to be queried belongs is obtained; based on the data identifier, an index space to be queried corresponding to the sub-data to be queried is determined in the current index sequence; based on a to-be-queried mark bit corresponding to the index space to be queried, a storage method corresponding to the sub-data to be queried is determined; 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.
  • the sub-data query request refers to the query request corresponding to the sub-data to be queried in 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 refers to the identifier corresponding to the sub-data to be queried, which can indicate 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 in the current index sequence.
  • the current index sequence refers to the index sequence corresponding to the business data to which the sub-data to be queried belongs.
  • the index space to be queried refers to the index space corresponding to the sub-data to be queried in the current index sequence.
  • the mark bit to be queried refers to the mark bit of the index space to be queried corresponding to the sub-data to be queried.
  • the query party corresponding to the sub-data query request refers to the computer device that issues the sub-data query request, and the query party can be a terminal or a server.
  • the computer device obtains the sub-data query request sent by the query party, and based on the data identifier carried in the sub-data query request, searches for the current index sequence corresponding to the business data to which the sub-data to be queried belongs, and then determines the index space to be queried corresponding to the sub-data to be queried in the current index sequence through the data identifier. According to the to-be-queried mark corresponding to the index space to be queried, the storage method corresponding to the sub-data to be queried is determined.
  • 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 queried sub-data to be queried is returned to the query party corresponding to the sub-data query request.
  • the sub-data query request carries the data identifier corresponding to the sub-data to be queried, and the index space to be queried corresponding to the sub-data to be queried is determined based on the data identifier, and then the storage method corresponding to the sub-data to be queried is determined based on the mark to be queried corresponding to the index space, and then 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, thereby ensuring the reliability of data query.
  • reading the sub-data to be queried from the corresponding storage space includes:
  • the storage method corresponding to the sub-data to be queried is heap space storage, based on the pointer stored in the index space to be queried, the storage space to be queried of the sub-data to be queried in the corresponding heap space to be queried is determined, 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.
  • the heap space to be queried refers to the heap storage space allocated for the target business data to which the sub-data to be queried belongs.
  • the storage space to be queried refers to the storage space in the heap space to be queried that stores the sub-data to be queried.
  • the storage mode corresponding to the sub-data to be queried is heap space storage
  • a pointer corresponding to the sub-data to be queried is obtained from the index space to be queried
  • the storage space to be queried corresponding to the sub-data to be queried is determined in the heap space to be queried corresponding to the sub-data to be queried through the pointer, and the sub-data to be queried is read from the storage space to be queried.
  • the storage mode 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 to be queried.
  • the sub-data to be queried is directly read from the index space to be queried corresponding to the sub-business data to be queried, thereby reducing the time overhead of locating the storage space to be queried corresponding to the sub-data to be queried based on the pointer and improving the efficiency of data query.
  • the target business data is a target table
  • the target sub-data is target cell data
  • the target table refers to a table that needs to store data, and the target table contains a large amount of cell data of indefinite length.
  • the target cell data refers to the data stored in the cells of the target table.
  • the business data storage method of the present application can be applied to data stored in a table.
  • the business data storage method includes the following steps:
  • the computer device obtains an initial index sequence corresponding to the target table, and obtains the spatial data length of the index space in the initial index sequence.
  • the computer device determines the target cell data from each 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.
  • the target cell data when the data length corresponding to the target cell data is less than or equal to the spatial data length of the index space, the target cell data is written into the target index space, that is, stored using the pointer space, and the mark bit corresponding to the target index space is updated to obtain the target index sequence.
  • the target cell data and the data length corresponding to the target cell data and other information are written into the target heap space corresponding to the target table to obtain the target pointer corresponding to the target cell data, and the target pointer is written into the target index space to obtain the target index sequence.
  • the index space when there is a large amount of cell data in the target table whose data length is less than or equal to the length of the index space, such cell data is directly stored in the corresponding index space, the index space is fully utilized, and a mark bit is used to mark whether the data is directly stored using the index space or stored in the heap.
  • This can greatly improve resource utilization and reduce resource waste.
  • the consumption of searching the storage space based on the pointer can be reduced once, that is, the time overhead of locating the storage space corresponding to the cell data in the heap according to the pointer is reduced, thereby improving data reading performance and making the program more efficient.
  • steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
  • the embodiment of the present application also provides a business data storage device for implementing the business data storage method involved above.
  • the implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in the one or more business data storage device embodiments provided below can refer to the limitations on the business data storage method above, and will not be repeated here.
  • a business data storage device including: an index sequence acquisition module 602, a target sub-data determination module 604 and a target sub-data storage module 606, wherein:
  • the target sub-data determination module is used to determine the target sub-data from the various sub-business data included 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.
  • 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 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 storage module is also used to store the target sub-data when the target data length corresponding to the target sub-data is greater than the target index space.
  • the target sub-data is written into the target heap space corresponding to the target business data, the target pointer corresponding to the target sub-data is obtained, and the target pointer is written into the target index space to obtain the target index sequence.
  • the above-mentioned business data storage device obtains the initial index sequence corresponding to the target business data, and determines the target sub-data from each sub-business data contained in the target business data, and uses the index space corresponding to the target sub-data in the initial index sequence as the target index space.
  • 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.
  • the target sub-data When the target data length corresponding to the target sub-data is greater than the spatial data length of the target index space, the target sub-data is written into the target heap space corresponding to the target business data, and the target pointer corresponding to the target sub-data is obtained, and the target pointer is written into the target index space to obtain the target index sequence.
  • 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 directly written into the target index space without allocating the corresponding heap space for the target sub-data, which can avoid opening up unnecessary resource space and effectively improve resource utilization.
  • the service data storage device further includes:
  • the spatial data length determination module 702 is used to count the data lengths corresponding to each sub-service data to obtain the estimated data length corresponding to the target service data; and determine the spatial data length based on the estimated data length.
  • the target mark bit update module 704 is used to update the target mark 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 mark bit is used to characterize the storage method corresponding to the target sub-data.
  • the query request response module 706 is used to obtain a sub-data query request, wherein the sub-data query request carries a 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 to-be-queried mark 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 query party corresponding to the sub-data query request.
  • the spatial data length determination module 702 is further configured to:
  • the query request response module 706 is further configured to:
  • the storage method corresponding to the sub-data to be queried is heap space storage, based on the pointer stored in the index space to be queried, the storage space to be queried of the sub-data to be queried in the corresponding heap space to be queried is determined, 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.
  • Each module in the above-mentioned business data storage device can be implemented in whole or in part by software, hardware or a combination thereof.
  • Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
  • a computer device which may be a server, and its internal structure diagram may be shown in FIG8.
  • the computer device includes a processor, a memory, an input/output interface (Input/Output, referred to as I/O) and a communication interface.
  • the processor, the memory and the input/output interface are connected via a system bus, and the communication interface is connected to the system bus via the input/output interface.
  • the processor of the computer device is used to provide computing and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system, a computer program and a database.
  • the internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium.
  • the database of the computer device is used to store data such as an initial index sequence and target sub-data.
  • the input/output interface of the computer device is used to exchange information between the processor and an external device.
  • the communication interface of the computer device is used to communicate with an external terminal via a network connection.
  • a computer device which may be a terminal, and its internal structure diagram may be shown in FIG9.
  • the computer device includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input device.
  • the processor, the memory, and the input/output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input/output interface.
  • the processor of the computer device is used to provide computing and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system and a computer program.
  • the internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium.
  • the input/output interface of the computer device is used to exchange information between the processor and an external device.
  • the communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies.
  • WIFI wireless fidelity
  • NFC near field communication
  • the computer program is executed by the processor, a business data storage method is implemented.
  • the display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device.
  • the display screen can be a liquid crystal display screen or an electronic ink display screen
  • the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
  • FIGS. 8 and 9 are only partial structures related to the present application.
  • the block diagram of the structure does not constitute a limitation on the computer device to which the present application solution is applied.
  • the specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
  • a computer device including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
  • a computer-readable storage medium on which a computer program is stored.
  • the computer program is executed by a processor, the steps in the above method embodiments are implemented.
  • a computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium.
  • a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-mentioned method embodiments.
  • user information including but not limited to user device information, user personal information, etc.
  • data including but not limited to data used for analysis, stored data, displayed data, etc.
  • any reference to the memory, database or other medium used in the embodiments provided in the present 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), magnetoresistive 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.
  • RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • the database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database.
  • Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this.
  • the processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, etc., but are not limited to this.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A service data storage method, comprising: acquiring an initial index sequence corresponding to target service data (S202); determining target sub-data from a plurality of pieces of service sub-data comprised in the target service data, and taking, as a target index space, an index space corresponding to the target sub-data in the initial index sequence (S204); when a target data length corresponding to the target sub-data is less than or equal to a spatial data length of the target index space, writing the target sub-data into the target index space to obtain a target index sequence (S206); and when the target data length corresponding to the target sub-data is greater than the spatial 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 (S208).

Description

业务数据存储方法、装置、计算机设备和存储介质Business data storage method, device, computer equipment and storage medium
相关申请Related Applications
本申请要求2023年3月14日申请的,申请号为2023103111471,名称为“业务数据存储方法、装置、计算机设备和存储介质”的中国专利申请的优先权,在此将其全文引入作为参考。This application claims priority to Chinese patent application number 2023103111471, filed on March 14, 2023, entitled “Business data storage method, device, computer equipment and storage medium”, the entire text of which is hereby incorporated by reference.
技术领域Technical Field
本申请涉及计算机技术领域,特别是涉及一种业务数据存储方法、装置、计算机设备、存储介质和计算机程序产品。The present 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 Art
随着数据存储技术的发展,出现了堆存储技术,将海量的数据长度不同的数据存储在堆中,并记录各个数据分别对应的索引,索引中存储了数据在堆中对应的指针,通过指针访问堆可以获取数据的值。With the development of data storage technology, heap storage technology has emerged. It stores massive amounts of data of different lengths in a heap and records the indexes corresponding to each piece of data. The index stores the pointer corresponding to the data in the heap. The value of the data can be obtained by accessing the heap through the pointer.
然而,使用传统的堆存储技术,盲目地将数据存入堆中,会出现资源利用率低的问题。However, using traditional heap storage technology and blindly storing data in the heap will result in low resource utilization.
发明内容Summary of the invention
本申请提供了一种业务数据存储方法。所述方法包括:The present application provides a method for storing business data. The method comprises:
获取目标业务数据对应的初始索引序列;Obtain the initial index sequence corresponding to the target business data;
从目标业务数据包含的各个子业务数据中确定目标子数据,将初始索引序列中目标子数据对应的索引空间作为目标索引空间;Determine target sub-data from each sub-business data included 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 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 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, the target sub-data is written into the target heap space corresponding to the target business data, the target pointer corresponding to the target sub-data is obtained, and the target pointer is written into the target index space to obtain the target index sequence.
本申请还提供了一种业务数据存储装置。所述装置包括:The present application also provides a business data storage device. The device comprises:
索引序列获取模块,用于获取目标业务数据对应的初始索引序列;An index sequence acquisition module is used to acquire an initial index sequence corresponding to target business data;
目标子数据确定模块,用于从目标业务数据包含的各个子业务数据中确定目标子数据, 将初始索引序列中目标子数据对应的索引空间作为目标索引空间;The target sub-data determination module is used to determine the target sub-data from each sub-business data included in 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;
目标子数据存储模块,用于当目标子数据对应的目标数据长度小于或等于目标索引空间的空间数据长度时,将目标子数据写入目标索引空间,得到目标索引序列;A target sub-data storage module, 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 less than or equal to the spatial data length of the target index space;
目标子数据存储模块,还用于当目标子数据对应的目标数据长度大于目标索引空间的空间数据长度时,将目标子数据写入目标业务数据对应的目标堆空间中,得到目标子数据对应的目标指针,将目标指针写入目标索引空间,得到目标索引序列。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 target data length corresponding to the target sub-data is greater than the space data length of the target index space, obtain the target pointer corresponding to the target sub-data, write the target pointer into the target index space, and obtain the target index sequence.
一种计算机设备,包括存储器和处理器,存储器存储有计算机程序,处理器执行计算机程序时实现上述业务数据存储方法的步骤。A computer device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the steps of the business data storage method are implemented.
一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述业务数据存储方法的步骤。A computer-readable storage medium stores a computer program, which implements the steps of the above-mentioned business data storage method when executed by a processor.
一种计算机程序产品,包括计算机程序,计算机程序被处理器执行时实现上述业务数据存储方法的步骤。A computer program product includes a computer program, which implements the steps of the above-mentioned business data storage method when executed by a processor.
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其他特征、目的和优点将在说明书、附图以及权利要求书中变得明显。Details of one or more embodiments of the present application are set forth in the following drawings and description. Other features, objects, and advantages of the present application will become apparent in the specification, drawings, and claims.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例或传统技术中的技术方案,下面将对实施例或传统技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据公开的附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the conventional technology, the drawings required for use in the embodiments or the conventional technology descriptions will be briefly introduced below. Obviously, the drawings described below are merely embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on the disclosed drawings without paying any creative work.
图1为一个实施例中业务数据存储方法的应用环境图;FIG1 is an application environment diagram of a business data storage method in one embodiment;
图2为一个实施例中业务数据存储方法的流程示意图;FIG2 is a schematic diagram of a flow chart of a method for storing business data in one embodiment;
图3为一个实施例中确定空间数据长度的流程示意图;FIG3 is a schematic diagram of a process for determining the length of spatial data in one embodiment;
图4为一个实施例中业务数据存储的示意图;FIG4 is a schematic diagram of business data storage in one embodiment;
图5为另一个实施例中业务数据存储的示意图;FIG5 is a schematic diagram of business data storage in another embodiment;
图6为一个实施例中业务数据存储装置的结构框图;FIG6 is a block diagram of a business data storage device in one embodiment;
图7为另一个实施例中业务数据存储装置的结构框图;FIG7 is a block diagram of a service data storage device in another embodiment;
图8为一个实施例中计算机设备的内部结构图;FIG8 is a diagram showing the internal structure of a computer device in one embodiment;
图9为另一个实施例中计算机设备的内部结构图。FIG. 9 is a diagram showing the internal structure of a computer device in another embodiment.
具体实施方式 DETAILED DESCRIPTION
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
本申请实施例提供的业务数据存储方法,可以应用于如图1所示的应用环境中。其中,终端102通过网络与服务器104进行通信。数据存储系统可以存储服务器104需要处理的数据。数据存储系统可以集成在服务器104上,也可以放在云上或其他网络服务器上。终端102可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑、物联网设备和便携式可穿戴设备,物联网设备可为智能电视、智能车载设备等。便携式可穿戴设备可为智能手表、智能手环、头戴设备等。服务器104可以用独立的服务器或者是多个服务器组成的服务器集群来实现。终端102以及服务器104可以通过有线或无线通信方式进行直接或间接地连接,本申请在此不做限制。The business data storage method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart TVs, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers. The terminal 102 and the server 104 can be directly or indirectly connected via wired or wireless communication, and this application is not limited here.
终端和服务器均可单独用于执行本申请实施例中提供的业务数据存储方法。Both the terminal and the server can be used independently to execute the business data storage method provided in the embodiments of the present application.
例如,终端获取目标业务数据对应的初始索引序列。终端从目标业务数据包含的各个子业务数据中确定目标子数据,将初始索引序列中目标子数据对应的索引空间作为目标索引空间。当目标子数据对应的目标数据长度小于或等于目标索引空间的空间数据长度时,终端将目标子数据写入目标索引空间,得到目标索引序列。当目标子数据对应的目标数据长度大于目标索引空间的空间数据长度时,终端将目标子数据写入目标业务数据对应的目标堆空间中,得到目标子数据对应的目标指针,将目标指针写入目标索引空间,得到目标索引序列。For example, the terminal obtains the initial index sequence corresponding to the target business data. The terminal determines the target sub-data from the various sub-business data contained in the target business data, and uses the index space corresponding to the target sub-data in the initial index sequence as the target index space. 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 terminal writes 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 spatial data length of the target index space, the terminal writes the target sub-data into the target heap space corresponding to the target business 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 terminal and the server can also be used together to execute the business data storage method provided in the embodiments of the present application.
例如,终端向服务器发送携带目标业务数据标识的业务数据存储请求,服务器基于目标业务数据标识获取目标业务数据对应的初始索引序列。服务器从目标业务数据包含的各个子业务数据中确定目标子数据,将初始索引序列中目标子数据对应的索引空间作为目标索引空间。当目标子数据对应的目标数据长度小于或等于目标索引空间的空间数据长度时,服务器将目标子数据写入目标索引空间,得到目标索引序列。当目标子数据对应的目标数据长度大于目标索引空间的空间数据长度时,服务器将目标子数据写入目标业务数据对应的目标堆空间中,得到目标子数据对应的目标指针,将目标指针写入目标索引空间,得到目标索引序列。服务器向终端返回业务数据存储结果。For example, the terminal sends a business data storage request carrying the target business data identifier to the server, and the server obtains the initial index sequence corresponding to the target business data based on the target business data identifier. The server determines the target sub-data from the various sub-business data contained in the target business data, and uses the index space corresponding to the target sub-data in the initial index sequence as the target index space. 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 server writes 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 greater than the spatial data length of the target index space, the server writes the target sub-data into the target heap space corresponding to the target business 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 business data storage result to the terminal.
在一个实施例中,如图2所示,提供了一种业务数据存储方法,以该方法应用于计算机设备为例进行说明,计算机设备可以是终端或服务器,所述方法由终端或服务器自身单独执行,也可以通过终端和服务器之间的交互来实现。业务数据存储方法包括以下步骤: In one embodiment, as shown in FIG2 , a business data storage method is provided, and the method is applied to a computer device as an example for explanation. The computer device may be a terminal or a server, and the method may be executed by the terminal or the server itself alone, or may be implemented through interaction between the terminal and the server. The business data storage method includes the following steps:
步骤S202,获取目标业务数据对应的初始索引序列。Step S202: Acquire an initial index sequence corresponding to the target business data.
其中,业务数据是指包含大量待存储的子业务数据的业务对象,例如,业务对象可以为信息登记表格,表格内单元格中的数据信息即为子业务数据;业务对象可以为单据,单据包含的各个待存储的数据信息即为子业务数据;等等。目标业务数据是指需要进行数据存储的业务数据。索引序列是指由目标业务数据中各个子业务数据分别对应的索引空间组成的序列。初始索引序列是指在对目标子数据进行存储操作前,目标业务数据对应的索引序列。Among them, business data refers to a business object containing a large amount of sub-business data to be stored. For example, a business object can be an information registration form, and the data information in the cells in the form is the sub-business data; a business object can be a document, and the data information to be stored contained in the document is the sub-business data; and so on. Target business data refers to business data that needs to be stored. Index sequence refers to a sequence composed of index spaces corresponding to each sub-business data in the target business data. The initial index sequence refers to the index sequence corresponding to the target business data before the storage operation is performed on the target sub-data.
示例性地,在使用堆存储方案对目标业务数据进行存储时,首先是在堆中为目标子数据分配相应的存储空间,再将目标子数据写入堆中对应的存储空间中,并将该存储空间对应的指针写入目标业务数据在初始索引序列中对应的目标索引空间。然而,当目标业务数据中包含大量不定长的子业务数据,即子业务数据的数据长度是不固定,并且存在大量的数据长度小于或等于索引空间长度的子业务数据时,盲目地将子业务数据存储在堆中,会造成资源的浪费。因此,在对目标业务数据进行存储操作时,计算机设备首先获取目标业务数据对应的初始索引序列,进而对比初始索引序列中目标索引空间的空间数据长度和目标子数据的目标数据长度,来确定目标子数据对应的存储方式,使得目标子数据能够以相应的存储方式进行存储。Exemplarily, when the target business data is stored using a heap storage solution, first, a corresponding storage space is allocated for the target sub-data in the heap, and then the target sub-data is written into the corresponding storage space in the heap, and the pointer corresponding to the storage space is written into the target index space corresponding to 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, that is, the data length of the sub-business data is not fixed, and there is a large amount of sub-business data whose data length is less than or equal to the index space length, blindly storing the sub-business data in the heap will cause a waste of resources. Therefore, when performing a storage operation on the target business data, the computer device first obtains the initial index sequence corresponding to the target business data, and then compares the spatial 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 corresponding storage method.
步骤S204,从目标业务数据包含的各个子业务数据中确定目标子数据,将初始索引序列中目标子数据对应的索引空间作为目标索引空间。Step S204: determine target sub-data from each sub-service data included in the target service data, and use the index space corresponding to the target sub-data in the initial index sequence as the target index space.
其中,目标子数据是指从目标业务数据包含的各个子业务数据中确定的,需要进行数据存储操作的子业务数据。索引空间是指用于存储子业务数据对应的指针或者直接存储子业务数据的存储空间,在进行数据查询时,当索引空间中存储的数据为指针时,可以通过索引空间中存储的指针在堆中读取相应的子业务数据,当索引空间中存储的数据为子业务数据时,可以直接在索引空间中读取子业务数据。目标索引空间是指目标子数据对应的索引空间。Among them, the target sub-data refers to the sub-business data that is determined from the various sub-business data contained in the target business data and needs to perform data storage operations. The index space refers to the storage space used to store pointers corresponding to the sub-business data or directly store the sub-business data. When performing data query, when the data stored in the index space is a pointer, the corresponding sub-business data can be read in the heap through the pointer stored in the index space. When the data stored in the index space is sub-business data, the sub-business data can be directly read in the index space. The target index space refers to the index space corresponding to the target sub-data.
示例性地,当目标业务数据存在相应的子业务数据存储顺序时,计算机设备按照子业务数据存储顺序,在目标业务数据包含的各个子业务数据中确定目标子数据。当目标业务数据不存在对应的子业务数据存储顺序时,将目标业务数据包含的各个待存储的子业务数据中的任意一个子业务数据作为目标子数据。进而在初始索引序列中确定目标子数据对应的索引空间,将该索引空间作为目标子数据对应的目标索引空间。Exemplarily, when the target business data has a corresponding sub-business data storage order, the computer device determines the target sub-data in each 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 sub-business data among the sub-business data to be stored included in the target business data is used as the target sub-data. Then, the index space corresponding to the target sub-data is determined in the initial index sequence, and the index space is used as the target index space corresponding to the target sub-data.
步骤S206,当目标子数据对应的目标数据长度小于或等于目标索引空间的空间数据长度时,将目标子数据写入目标索引空间,得到目标索引序列。 Step S206, 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 a target index sequence.
其中,目标数据长度是指目标子数据的数据长度,例如,当目标子数据为字符型数据时,目标数据长度为1字节,当目标子数据为整型数据时,目标数据长度为4字节等。空间数据长度是指索引空间所占存储空间的大小,例如,目标索引空间的空间数据长度可以为4字节、8字节等。目标索引序列是指对目标子数据进行存储操作后,即基于目标子数据更新初始索引序列中的目标索引空间后,得到的索引序列。The target data length refers to the data 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 space data length refers to the size of the storage space occupied by the index space. For example, the space 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 the target sub-data is stored, that is, after the target index space in the initial index sequence is updated based on the target sub-data.
示例性地,对比目标子数据的目标数据长度和目标索引空间的空间数据长度,当目标数据长度小于或等于目标索引空间的空间数据长度时,直接将目标子数据写入目标索引空间中,得到更新后的目标索引序列。继续在目标业务数据包含的各个子业务数据中确定目标子数据,返回获取目标业务数据对应的初始索引序列的步骤执行,直至目标业务数据包含的所有子业务数据均被写入相应的存储空间中。Exemplarily, the target data length of the target sub-data and the spatial data length of the target index space are compared. 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 an updated target index sequence. The target sub-data is continuously determined in each sub-business data contained in the target business data, and the step of returning to obtain the initial index sequence corresponding to the target business data is executed until all sub-business data contained in the target business data are written into the corresponding storage space.
在一个实施例中,获取目标子数据对应的安全等级,当目标子数据的目标数据长度小于或等于空间数据长度,且目标子数据的安全等级小于预设安全等级时,将目标子数据存储在目标索引空间中,若目标子数据的安全等级大于或等于预设等级时,将目标子数据存储在目标业务数据对应的目标堆空间中。为目标业务数据包含的各个子业务数据设置相应的安全等级,根据不同子业务数据分别对应的安全等级和数据长度来确定对应的存储方式,在提高资源利用率的同时,还能够保证数据存储的安全性。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 space data length and the security level of the target sub-data is less than the 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, and the corresponding storage method is determined according to the security level and data length corresponding to different sub-business data, which can improve resource utilization while ensuring the security of data storage.
在一个实施例中,获取目标子数据对应的访问等级,访问等级用于表征目标子数据被访问的频率,若目标子数据为经常需要访问的数据时,目标子数据对应的访问等级越高。获取目标子数据对应的安全等级,当目标子数据的目标数据长度小于或等于空间数据长度,且目标子数据对应的访问等级大于或等于预设访问等级时,将目标子数据存储在目标索引空间中,从而提高查询速度并提高资源利用率。当目标子数据的目标数据长度小于或等于空间数据长度,目标子数据对应的访问等级小于预设访问等级,且目标子数据对应的安全等级大于或等于预设安全等级时,将目标子数据存储在目标堆空间中,从而提升目标子数据的安全性。当目标子数据的目标数据长度小于或等于空间数据长度,目标子数据对应的安全等级小于预设安全等级,且目标子数据对应的访问等级小于预设访问等级时,将目标子数据存储在目标索引空间中,从而提高查询速度并提高资源利用率。为目标业务数据包含的各个子业务数据分别设置相应的安全等级和访问等级,并根据不同子业务数据分别对应的安全等级、访问等级和数据长度来确定对应的存储方式,这样,在数据存储时综合考虑了不同子业务数据分别对应的安全需求和访问需求,有效提高了数据存储的灵活性。In one embodiment, the access level corresponding to the target sub-data is obtained, and the access level is used to characterize the frequency of the target sub-data being accessed. If the target sub-data is data that needs to be accessed frequently, the access level corresponding to the target sub-data is higher. 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 access level corresponding to the target sub-data is greater than or equal to the preset access level, the target sub-data is stored in the target index space, thereby improving the query speed and improving resource utilization. When the target data length of the target sub-data is less than or equal to the spatial data length, the access level corresponding to the target sub-data is less than the preset access level, and the security level corresponding to the target sub-data 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 of the target sub-data is less than or equal to the spatial data length, the security level corresponding to the target sub-data is less than the preset security level, and the access level corresponding to the target sub-data is less than the preset access level, the target sub-data is stored in the target index space, thereby improving the query speed and improving resource utilization. Corresponding security levels and access levels are set for each sub-business data contained in the target business data, and the corresponding storage method is determined according to the security level, access level and data length corresponding to different sub-business data. In this way, the security needs and access needs corresponding to different sub-business data are comprehensively considered during data storage, effectively improving the flexibility of data storage.
步骤S208,当目标子数据对应的目标数据长度大于目标索引空间的空间数据长度时,将目标子数据写入目标业务数据对应的目标堆空间中,得到目标子数据对应的目标指针, 将目标指针写入目标索引空间,得到目标索引序列。Step S208, when the target data length corresponding to the target sub-data is greater than the spatial data length of the target index space, the target sub-data is written into the target heap space corresponding to the target business data, and a target pointer corresponding to the target sub-data is obtained. Write the target pointer into the target index space to obtain the target index sequence.
其中,目标堆空间是指为目标业务数据分配的堆存储空间。目标指针是指目标子数据在目标堆空间中对应的存储空间的首地址。例如,当目标子数据为第一个存储至目标堆空间中的子数据时,所述目标子数据对应的目标指针为0,若所述目标子数据的数据长度为4字节,第二个存储至目标堆空间中的子数据对应的目标指针即为4。The target heap space refers to the heap storage space allocated for the target business data. The target pointer refers to the first 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.
示例性地,对比目标子数据的目标数据长度和目标索引空间的空间数据长度,当目标数据长度大于目标索引空间的空间数据长度时,计算机设备在堆中为目标子数据分配相应的存储空间,作为目标子数据对应的目标堆空间。将目标子数据写入目标堆空间中,并将目标堆空间对应的目标指针写入目标索引空间中,得到目标索引序列。继续在目标业务数据包含的各个子业务数据中确定目标子数据,返回获取目标业务数据对应的初始索引序列的步骤执行,直至目标业务数据包含的所有子业务数据均被写入相应的存储空间中。Exemplarily, the target data length of the target sub-data and the spatial data length of the target index space are compared. When the target data length is greater than the spatial data length of the target index space, the computer device allocates corresponding storage space for the target sub-data in the heap 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 a target index sequence. The target sub-data is continued to be determined in each sub-business data contained in the target business data, and the step of returning to obtain the initial index sequence corresponding to the target business data is executed until all sub-business data contained in the target business data are written into the corresponding storage space.
上述业务数据存储方法中,通过获取目标业务数据对应的初始索引序列,并从目标业务数据包含的各个子业务数据中确定目标子数据,将初始索引序列中目标子数据对应的索引空间作为目标索引空间。当目标子数据对应的目标数据长度小于或等于目标索引空间的空间数据长度时,将目标子数据写入目标索引空间,得到目标索引序列。当目标子数据对应的目标数据长度大于目标索引空间的空间数据长度时,将目标子数据写入目标业务数据对应的目标堆空间中,得到目标子数据对应的目标指针,将目标指针写入目标索引空间,得到目标索引序列。这样,在目标子数据对应的目标数据长度小于或等于目标索引空间的空间数据长度时,直接将目标子数据写入目标索引空间,而无需为目标子数据分配相应的堆空间,能够避免开辟不必要的资源空间,有效提高资源利用率。In the above-mentioned business data storage method, by obtaining the initial index sequence corresponding to the target business data, and determining the target sub-data from each sub-business data contained in 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 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. When the target data length corresponding to the target sub-data is greater than the spatial data length of the target index space, the target sub-data is written into the target heap space corresponding to the target business data, and the target pointer corresponding to the target sub-data is obtained, and the target pointer is written into the target index space to obtain the target index sequence. In this way, 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 directly written into the target index space without allocating the corresponding heap space for the target sub-data, which can avoid opening up unnecessary resource space and effectively improve resource utilization.
在一个实施例中,业务数据存储方法还包括:In one embodiment, the business data storage method further includes:
统计各个子业务数据分别对应的数据长度,得到目标业务数据对应的预计数据长度;基于预计数据长度确定空间数据长度。The data lengths corresponding to each sub-business data are counted to obtain the estimated data length corresponding to the target business data; and the spatial data length is determined based on the estimated data length.
其中,预计数据长度是指存储目标业务数据包含的各个子业务数据所需的存储空间的长度。The estimated data length refers to the length of the storage space required to store each sub-business data included in the target business data.
示例性地,计算机设备统计目标业务数据中包含的子业务数据分别对应的数据长度,计算各个子业务数据分别对应的数据长度之和,得到目标业务数据对应的预计数据长度。基于预计数据长度计算索引空间对应的空间数据长度。例如,目标业务数据的索引空间对应的空间数据长度通常为4字节或者8字节,当空间数据长度为4字节时,对应的最大寻址范围为231-1,当空间数据长度为8字节时,对应的最大寻址范围为263-1,若预计数据长度为230字节时,可以将空间数据长度设置为4字节,若预计数据长度为240字节时, 可以将空间数据长度设置为8字节。Exemplarily, the computer device counts the data lengths corresponding to the sub-business data contained in the target business data, calculates the sum of the data lengths corresponding to the sub-business data, and obtains the estimated data length corresponding to the target business data. The spatial data length corresponding to the index space is calculated based on the estimated data length. For example, the spatial data length corresponding to the index space of the target business data is usually 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 estimated data length is 2 30 bytes, the spatial data length can be set to 4 bytes. If the estimated data length is 2 40 bytes, The spatial data length can be set to 8 bytes.
在一个实施例中,计算机设备基于预计数据长度,确定索引空间对应的各个候选数据长度,候选数据长度是指索引空间对应的各个候选的空间数据长度,候选数据长度对应的最大寻址范围大于预计数据长度,并且候选数据长度的最大值为8字节。为了提高资源利用率,将各个候选数据长度中的最小值作为空间数据长度。例如,当预计数据长度为230字节时,索引空间对应的各个候选数据长度分别为4字节、5字节、6字节、7字节和8字节,将空间数据长度设置为4字节;当预计数据长度为250字节时,索引空间对应的各个候选数据长度分别为7字节和8字节,将空间数据长度设置为7字节。In one embodiment, the computer device determines the lengths of each candidate data corresponding to the index space based on the expected data length. The candidate data length refers to the length of each candidate space data corresponding to the index space. The maximum addressing range corresponding to the candidate data length is greater than the expected data length, and the maximum value of the candidate data length is 8 bytes. In order to improve resource utilization, the minimum value of each candidate data length is used as the space data length. For example, when the expected data length is 230 bytes, the lengths of each candidate data corresponding to the index space are 4 bytes, 5 bytes, 6 bytes, 7 bytes and 8 bytes, respectively, and the space data length is set to 4 bytes; when the expected data length is 250 bytes, the lengths of each candidate data corresponding to the index space are 7 bytes and 8 bytes, respectively, and the space data length is set to 7 bytes.
在一个实施例中,可以人为设置目标业务数据对应的空间数据长度。具体地,通过判断目标业务数据所属的业务类型,来确定目标业务数据所需的空间数据长度。例如,当目标业务数据所属的业务类型所需的存储空间大小的最大值小于231-1字节时,可以人为将目标业务数据对应的空间数据长度设置为4字节;当目标业务数据所属的业务类型所需的存储空间大小的最大值大于231-1字节时,可以人为将目标业务数据对应的空间数据长度设置为8字节;等等。In one embodiment, the spatial data length corresponding to the target business data can be set manually. Specifically, the spatial data length required for the target business data is determined by judging the business type to which the target business data belongs. For example, when the maximum value of the storage space size required for the business type to which the target business data belongs is less than 2 31 -1 bytes, the spatial data length corresponding to the target business data can be set to 4 bytes manually; when the maximum value of the storage space size required for the business type to which the target business data belongs is greater than 2 31 -1 bytes, the spatial data length corresponding to the target business data can be set to 8 bytes manually; and so on.
上述实施例中,通过统计各个子业务数据分别对应的数据长度,来确定目标业务数据对应的预计数据长度,基于预计数据长度来确定索引空间对应的空间数据长度,能够有效节约计算机设备的存储资源,提高资源利用率。In the above embodiment, the expected data length corresponding to the target business data is determined by counting the data lengths corresponding to each sub-business data, and the spatial data length corresponding to the index space is determined based on the expected data length, which can effectively save the storage resources of computer equipment and improve resource utilization.
在一个实施例中,如图3所示,基于所述预计数据长度确定所述空间数据长度,包括:In one embodiment, as shown in FIG3 , determining the spatial data length based on the expected data length includes:
步骤S302,对预计数据长度进行二进制转换得到转换结果,基于转换结果得到初始数据长度。Step S302, performing binary conversion on the estimated data length to obtain a conversion result, and obtaining an initial data length based on the conversion result.
步骤S304,获取参考数据长度,基于参考数据长度和初始数据长度,确定扩充长度范围。Step S304, obtaining a reference data length, and determining an extended length range based on the reference data length and the initial data length.
步骤S306,在目标业务数据对应的子业务数据中,统计数据长度处于扩充长度范围内的子业务数据,得到扩充子数据量。Step S306: Count the sub-business data whose statistical data length is within the extended length range in the sub-business data corresponding to the target business data, and obtain the extended sub-data volume.
步骤S308,统计目标业务数据包含的子业务数据得到目标子数据量。Step S308: Count the sub-business data included in the target business data to obtain the target sub-data volume.
步骤S310,当扩充子数据量与目标子数据量之间的比值大于预设比值时,基于参考数据长度更新初始数据长度,得到空间数据长度。Step S310, 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.
其中,转换结果是指将预计数据长度转换为二进制后得到的结果。The conversion result refers to the result obtained by converting the expected data length into binary.
初始数据长度是指基于预计数据长度确定的索引空间对应的初始的空间数据长度。参考数据长度是指用于对初始数据长度进行扩充的数据长度,参考数据长度大于或等于初始数据长度,例如,参考数据长度通常可以设置为8字节。扩充长度范围是指由初始数据长 度和参考数据长度确定的数据长度范围,初始数据长度为扩充长度范围的下限,参考数据长度为扩充长度范围的上限,扩充长度范围包括参考数据长度,例如,当初始数据长度为2字节,参考数据长度为4字节时,扩充长度范围为(2,4]。扩充子数据量是指数据长度处于扩充长度范围内的子业务数据的数量。目标子数据量是指目标业务数据中包含的子业务数据的数量。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 usually be set to 8 bytes. The extended length range refers to the initial data length. The data length range is determined by the initial data length and the reference data length. The initial data length is the lower limit of the extended length range, the reference data length is the upper limit of the extended length range, and the extended 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 extended length range is (2,4]. The extended sub-data volume refers to the number of sub-business data whose data length is within the extended length range. The target sub-data volume refers to the number of sub-business data contained in the target business data.
示例性地,将预计数据长度转换为二进制,得到转换结果,基于转换结果的位数确定索引空间对应的初始数据长度。例如,当预计数据长度为255字节时,将255转换为二进制得到的转换结果为1111 1111,转换结果对应的位数为8位,因此,初始数据长度应该大于或等于1字节,例如,可以将初始数据长度设置为1字节或者2字节。获取参考数据长度,当初始数据长度小于参考数据长度时,基于初始数据长度和参考数据长度确定扩充长度范围。在目标业务数据包含的各个子业务数据中,统计数据长度处于扩充长度范围内的各个子业务数据,得到扩充子数据量。统计目标业务数据包含的各个子业务数据,得到目标子数据量。计算扩充子数据量和目标子数据量之间的比值,当比值大于或者等于预设比值时,用参考数据长度更新初始数据长度,得到空间数据长度。例如,预设比值可以设置为0.5,即当目标业务数据中50%及以上的子业务数据的数据长度均处于扩充长度范围内时,用参考数据长度更新初始数据长度,例如,当参考数据长度为8字节,初始数据长度为4字节时,将初始数据长度更新为8字节。Exemplarily, the expected data length is converted into binary to obtain a conversion result, and the initial data length corresponding to the index space is determined based on the number of bits of the conversion result. For example, when the expected data length is 255 bytes, the conversion result obtained by converting 255 into binary is 1111 1111, and the number of bits corresponding to the conversion result is 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. Obtain the reference data length, and when the initial data length is less than the reference data length, determine the extended length range based on the initial data length and the reference data length. In each sub-business data included in the target business data, count each sub-business data whose statistical data length is within the extended length range to obtain the extended sub-data amount. Count each sub-business data included in the target business data to obtain the target sub-data amount. Calculate the ratio between the extended sub-data amount and the target sub-data amount. When the ratio is greater than or equal to the preset ratio, update the initial data length with the reference data length to obtain the space data length. For example, the preset ratio can be set to 0.5, that is, 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.
上述实施例中,通过统计处于扩充长度范围内的子业务数据,来确定待扩充子数据量,当待扩充子数据量与目标子数据量的比值大于预设阈值时,说明仍然存在大量的数据长度较短的子业务数据需要存储在堆空间中。此时,基于参考数据长度更新初始数据长度,使得数据长度处于扩充长度范围内的各个子业务数据能够直接写入索引空间中,能够进一步地提高资源利用率。In the above embodiment, the amount of sub-data to be expanded is determined by counting the sub-service data within the extended length range. When the ratio of the amount of sub-data to be expanded to the target amount of sub-data is greater than a preset threshold, it indicates that there is still a large amount of sub-service data with a shorter data length 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 with a data length within the extended length range can be directly written into the index space, which can further improve resource utilization.
在一个实施例中,业务数据存储方法还包括:In one embodiment, the business data storage method further includes:
在目标索引序列中,基于目标子数据对应的存储方式,更新目标索引空间对应的目标标记位;存储方式包括堆空间存储和索引空间存储,目标标记位用于表征目标子数据对应的存储方式。In the target index sequence, based on the storage method corresponding to the target sub-data, the target mark bit corresponding to the target index space is updated; the storage method includes heap space storage and index space storage, and the target mark bit is used to characterize the storage method corresponding to the target sub-data.
其中,标记位是指索引序列中用于记录各个子数据分别对应的存储方式的存储空间,例如,如图4所示,标记位可以位于索引空间之前,占用1个字节,当子数据对应的标记位为1时,表示子数据对应的存储方式为索引空间存储,即指针空间存储,当子数据对应的标记位为0时,表示子数据对应的存储方式为堆空间存储,即堆存储。目标标记位是指目标索引序列中的目标子数据对应的标记位。堆空间存储是指在堆中为子数据分配相应的 存储空间作为子数据对应的堆空间,将子数据存储在该堆空间中。索引空间存储是指将子数据直接存储在对应的索引空间中。Among them, the mark bit refers to the storage space in the index sequence used to record the storage methods corresponding to each sub-data. For example, as shown in Figure 4, the mark bit can be located before the index space and occupy 1 byte. When the mark bit corresponding to the sub-data is 1, it means that the storage method corresponding to the sub-data is index space storage, that is, pointer space storage. When the mark bit corresponding to the sub-data is 0, it means that the storage method corresponding to the sub-data is heap space storage, that is, heap storage. The target mark bit refers to the mark bit corresponding to the target sub-data in the target index sequence. Heap space storage refers to allocating corresponding The storage space is used as the heap space corresponding to the sub-data, and the sub-data is stored in the heap space. Index space storage refers to directly storing the sub-data in the corresponding index space.
示例性地,计算机设备基于目标子数据对应的存储方式,更新目标索引空间对应的目标标记位。例如,可以规定当目标子数据对应的存储方式为索引空间存储时,将目标子数据对应的目标标记位设置为1,当目标子数据对应的存储方式为堆空间存储时,将目标子数据对应的目标标记位设置为0。Exemplarily, the computer device updates the target flag bit corresponding to the target index space based on the storage mode corresponding to the target sub-data. For example, it can be stipulated that when the storage mode 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 mode corresponding to the target sub-data is heap space storage, the target flag bit corresponding to the target sub-data is set to 0.
在一个实施例中,目标索引空间对应的目标标记位可以存储在目标索引序列之外,例如,可以建立标记位序列,标记位序列中存储各个索引空间分别对应的标记位。In one embodiment, the target flag bit corresponding to the target index space may be stored outside the target index sequence. For example, a flag bit sequence may be established, and the flag bits corresponding to each index space may be stored in the flag bit sequence.
上述实施例中,基于目标子数据对应的存储方式,更新目标子数据对应的目标标记位,使得在进行数据查询时,能够根据目标标记位来确定目标子数据对应的存储方式,进而基于目标子数据对应的存储方式从相应的存储空间查询目标子数据,能够保证数据查询的可靠性。In the above embodiment, based on the storage method corresponding to the target sub-data, the target mark bit corresponding to the target sub-data is updated, so that when performing data query, the storage method corresponding to the target sub-data can be determined according to the target mark 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, thereby ensuring the reliability of data query.
在一个实施例中,业务数据存储方法还包括:In one embodiment, the business data storage method further includes:
获取子数据查询请求,其中子数据查询请求携带待查询子数据对应的数据标识;基于数据标识,获取待查询子数据所属的业务数据对应的当前索引序列;基于数据标识,在当前索引序列中确定待查询子数据对应的待查询索引空间;基于待查询索引空间对应的待查询标记位,确定待查询子数据对应的存储方式;基于待查询子数据对应的存储方式,从相应的存储空间读取待查询子数据,向子数据查询请求对应的查询方返回待查询子数据。A sub-data query request is obtained, wherein the sub-data query request carries a data identifier corresponding to the sub-data to be queried; based on the data identifier, a current index sequence corresponding to the business data to which the sub-data to be queried belongs is obtained; based on the data identifier, an index space to be queried corresponding to the sub-data to be queried is determined in the current index sequence; based on a to-be-queried mark bit corresponding to the index space to be queried, a storage method corresponding to the sub-data to be queried is determined; 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.
其中,子数据查询请求是指目标业务数据中的待查询子数据对应的查询请求。待查询子数据是指子数据查询请求所查询的子业务数据。数据标识是指待查询子数据对应的标识,能够指示待查询子数据对应的当前索引序列,以及待查询子数据在当前索引序列中对应的待查询索引空间。当前索引序列是指待查询子数据所属的业务数据对应的索引序列。待查询索引空间是指待查询子数据在当前索引序列中对应的索引空间。待查询标记位是指待查询子数据对应的待查询索引空间的标记位。子数据查询请求对应的查询方是指发出子数据查询请求的计算机设备,查询方可以是终端或者服务器。Among them, the sub-data query request refers to the query request corresponding to the sub-data to be queried in 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 refers to the identifier corresponding to the sub-data to be queried, which can indicate 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 in the current index sequence. The current index sequence refers to the index sequence corresponding to the business data to which the sub-data to be queried belongs. The index space to be queried refers to the index space corresponding to the sub-data to be queried in the current index sequence. The mark bit to be queried refers to the mark bit of the index space to be queried corresponding to the sub-data to be queried. The query party corresponding to the sub-data query request refers to the computer device that issues the sub-data query request, and the query party can be a terminal or a server.
示例性地,计算机设备获取查询方发送的子数据查询请求,基于子数据查询请求中携带的数据标识,查找待查询子数据所属的业务数据对应的当前索引序列,进而再通过数据标识在当前索引序列中确定待查询子数据对应的待查询索引空间。根据待查询索引空间对应的待查询标记位,确定待查询子数据对应的存储方式。进而基于待查询子数据对应的存储方式和待查询索引空间,确定待查询子数据对应的存储空间,从相应的存储空间读取待查询子数据,并将查询到的待查询子数据返回至子数据查询请求对应的查询方。 Exemplarily, the computer device obtains the sub-data query request sent by the query party, and based on the data identifier carried in the sub-data query request, searches for the current index sequence corresponding to the business data to which the sub-data to be queried belongs, and then determines the index space to be queried corresponding to the sub-data to be queried in the current index sequence through the data identifier. According to the to-be-queried mark corresponding to the index space to be queried, the storage method corresponding to the sub-data to be queried is determined. Then, based on the storage method corresponding to the sub-data to be queried and the index space to be queried, 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 queried sub-data to be queried is returned to the query party corresponding to the sub-data query request.
上述实施例中,子数据查询请求中携带了待查询子数据对应的数据标识,基于数据标识确定待查询子数据对应的待查询索引空间,进而基于索引空间对应的待查询标记位来确定待查询子数据对应的存储方式,接着基于待查询子数据对应的存储方式从相应的存储空间读取待查询子数据,可以保证数据查询的可靠性。In the above embodiment, the sub-data query request carries the data identifier corresponding to the sub-data to be queried, and the index space to be queried corresponding to the sub-data to be queried is determined based on the data identifier, and then the storage method corresponding to the sub-data to be queried is determined based on the mark to be queried corresponding to the index space, and then 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, thereby ensuring the reliability of data query.
在一个实施例中,基于待查询子数据对应的存储方式,从相应的存储空间读取待查询子数据,包括:In one embodiment, 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 includes:
当待查询子数据对应的存储方式为堆空间存储时,基于待查询索引空间中存储的指针,确定待查询子数据在对应的待查询堆空间中的待查询存储空间,从待查询存储空间中读取待查询子数据;当待查询子数据对应的存储方式为索引空间存储时,从待查询索引空间中读取待查询子数据。When the storage method corresponding to the sub-data to be queried is heap space storage, based on the pointer stored in the index space to be queried, the storage space to be queried of the sub-data to be queried in the corresponding heap space to be queried is determined, 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.
其中,待查询堆空间是指为待查询子数据所属的目标业务数据分配的堆存储空间。待查询存储空间是指待查询堆空间中存储了待查询子数据的存储空间。The heap space to be queried refers to the heap storage space allocated for the target business data to which the sub-data to be queried belongs. The storage space to be queried refers to the storage space in the heap space to be queried that stores the sub-data to be queried.
示例性地,当待查询子数据对应的存储方式为堆空间存储时,从待查询索引空间中获取待查询子数据对应的指针,通过该指针在待查询子数据对应的待查询堆空间中确定待查询子数据对应的待查询存储空间,从待查询存储空间中读取待查询子数据。当待查询子数据对应的存储方式为索引空间存储时,从待查询子数据对应的待查询索引空间中读取待查询子数据。Exemplarily, when the storage mode corresponding to the sub-data to be queried is heap space storage, a pointer corresponding to the sub-data to be queried is obtained from the index space to be queried, and the storage space to be queried corresponding to the sub-data to be queried is determined in the heap space to be queried corresponding to the sub-data to be queried through the pointer, and the sub-data to be queried is read from the storage space to be queried. When the storage mode 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 to be queried.
上述实施例中,当待查询子数据对应的存储方式为索引空间存储时,直接从待查询子业务数据对应的待查询索引空间读取待查询子数据,减少基于指针定位到待查询数据对应的待查询存储空间的时间开销,提高数据查询的效率。In the above embodiment, 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 to be queried corresponding to the sub-business data to be queried, thereby reducing the time overhead of locating the storage space to be queried corresponding to the sub-data to be queried based on the pointer and improving the efficiency of data query.
在一个实施例中,目标业务数据为目标表格,所述目标子数据为目标单元格数据。In one embodiment, the target business data is a target table, and the target sub-data is target cell data.
其中,目标表格是指需要进行数据存储的表格,目标表格中包含大量不定长度的单元格数据。目标单元格数据是指目标表格的单元格中存储的数据。The target table refers to a table that needs to store data, and the target table contains a large amount of cell data of indefinite length. The target cell data refers to the data stored in the cells of the target table.
在一个具体的实施例中,本申请的业务数据存储方法可以应用于存储表格中的数据。业务数据存储方法包括以下步骤:In a specific embodiment, the business data storage method of the present application can be applied to data stored in a table. The business data storage method includes the following steps:
1、获取目标表格对应的索引序列1. Get the index sequence corresponding to the target table
计算机设备获取目标表格对应的初始索引序列,获取初始索引序列中索引空间的空间数据长度。The computer device obtains an initial index sequence corresponding to the target table, and obtains the spatial data length of the index space in the initial index sequence.
2、确定目标单元格数据和目标索引空间2. Determine the target cell data and target index space
计算机设备从目标表格包含的各个单元格数据中确定目标单元格数据,并将初始索引序列中目标单元格数据对应的索引空间作为目标索引空间。 The computer device determines the target cell data from each 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.
3、存储目标单元格数据3. Store target cell data
如图5所示,当目标单元格数据对应的数据长度小于或等于索引空间的空间数据长度时,将目标单元格数据写入目标索引空间,即利用指针空间存储,并更新目标索引空间对应的标记位,得到目标索引序列。当目标单元格数据对应的数据长度大于索引空间的空间数据长度时,将目标单元格数据和目标单元格数据对应的数据长度等信息写入目标表格对应的目标堆空间中,得到目标单元格数据对应的目标指针,将目标指针写入目标索引空间中,得到目标索引序列。As shown in Figure 5, when the data length corresponding to the target cell data is less than or equal to the spatial data length of the index space, the target cell data is written into the target index space, that is, stored using the pointer space, and the mark bit corresponding to the target index space is updated to obtain the target index sequence. When the data length corresponding to the target cell data is greater than the spatial data length of the index space, the target cell data and the data length corresponding to the target cell data and other information are written into the target heap space corresponding to the target table to obtain the target pointer corresponding to the target cell data, and the target pointer is written into the target index space to obtain the target index sequence.
上述实施例中,当目标表格中存在大量的数据长度小于或等于索引空间长度的单元格数据时,将这类单元格数据直接存储在对应的索引空间中,将索引空间进行充分利用,并使用标记位标记该数据是直接利用索引空间存储还是存储在堆中。能够大大提高资源利用率,减少资源的浪费,此外将单元格数据存储在索引处,在查询数据时,能够减少一次基于指针查找存储空间的消耗,即减少根据指针定位到单元格数据在堆中对应的存储空间的时间开销,提高数据读取性能,使程序更加高效。In the above embodiment, when there is a large amount of cell data in the target table whose data length is less than or equal to the length of the index space, such cell data is directly stored in the corresponding index space, the index space is fully utilized, and a mark bit is used to mark whether the data is directly stored using the index space or stored in the heap. This can greatly improve resource utilization and reduce resource waste. In addition, by storing the cell data at the index, when querying data, the consumption of searching the storage space based on the pointer can be reduced once, that is, the time overhead of locating the storage space corresponding to the cell data in the heap according to the pointer is reduced, thereby improving data reading performance and making the program more efficient.
应该理解的是,虽然如上所述的各实施例所涉及的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,如上所述的各实施例所涉及的流程图中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
基于同样的发明构思,本申请实施例还提供了一种用于实现上述所涉及的业务数据存储方法的业务数据存储装置。该装置所提供的解决问题的实现方案与上述方法中所记载的实现方案相似,故下面所提供的一个或多个业务数据存储装置实施例中的具体限定可以参见上文中对于业务数据存储方法的限定,在此不再赘述。Based on the same inventive concept, the embodiment of the present application also provides a business data storage device for implementing the business data storage method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in the one or more business data storage device embodiments provided below can refer to the limitations on the business data storage method above, and will not be repeated here.
在一个实施例中,如图6所示,提供了一种业务数据存储装置,包括:索引序列获取模块602、目标子数据确定模块604和目标子数据存储模块606,其中:In one embodiment, as shown in FIG. 6 , 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:
目标子数据确定模块,用于从目标业务数据包含的各个子业务数据中确定目标子数据,将初始索引序列中目标子数据对应的索引空间作为目标索引空间。The target sub-data determination module is used to determine the target sub-data from the various sub-business data included 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.
目标子数据存储模块,用于当目标子数据对应的目标数据长度小于或等于目标索引空间的空间数据长度时,将目标子数据写入目标索引空间,得到目标索引序列。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 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 storage module is also used to store the target sub-data when the target data length corresponding to the target sub-data is greater than the target index space. When the spatial data length is reached, the target sub-data is written into the target heap space corresponding to the target business data, the target pointer corresponding to the target sub-data is obtained, and the target pointer is written into the target index space to obtain the target index sequence.
上述业务数据存储装置,通过获取目标业务数据对应的初始索引序列,并从目标业务数据包含的各个子业务数据中确定目标子数据,将初始索引序列中目标子数据对应的索引空间作为目标索引空间。当目标子数据对应的目标数据长度小于或等于目标索引空间的空间数据长度时,将目标子数据写入目标索引空间,得到目标索引序列。当目标子数据对应的目标数据长度大于目标索引空间的空间数据长度时,将目标子数据写入目标业务数据对应的目标堆空间中,得到目标子数据对应的目标指针,将目标指针写入目标索引空间,得到目标索引序列。这样,在目标子数据对应的目标数据长度小于或等于目标索引空间的空间数据长度时,直接将目标子数据写入目标索引空间,而无需为目标子数据分配相应的堆空间,能够避免开辟不必要的资源空间,有效提高资源利用率。The above-mentioned business data storage device obtains the initial index sequence corresponding to the target business data, and determines the target sub-data from each sub-business data contained in the target business data, and uses the index space corresponding to the target sub-data in the initial index sequence as the target index space. 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. When the target data length corresponding to the target sub-data is greater than the spatial data length of the target index space, the target sub-data is written into the target heap space corresponding to the target business data, and the target pointer corresponding to the target sub-data is obtained, and the target pointer is written into the target index space to obtain the target index sequence. In this way, 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 directly written into the target index space without allocating the corresponding heap space for the target sub-data, which can avoid opening up unnecessary resource space and effectively improve resource utilization.
在一个实施例中,如图7所示,业务数据存储装置还包括:In one embodiment, as shown in FIG7 , the service data storage device further includes:
空间数据长度确定模块702,用于统计各个子业务数据分别对应的数据长度,得到目标业务数据对应的预计数据长度;基于预计数据长度确定空间数据长度。The spatial data length determination module 702 is used to count the data lengths corresponding to each sub-service data to obtain the estimated data length corresponding to the target service data; and determine the spatial data length based on the estimated data length.
目标标记位更新模块704,用于在目标索引序列中,基于目标子数据对应的存储方式,更新目标索引空间对应的目标标记位;存储方式包括堆空间存储和索引空间存储,目标标记位用于表征目标子数据对应的存储方式。The target mark bit update module 704 is used to update the target mark 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 mark bit is used to characterize the storage method corresponding to the target sub-data.
查询请求响应模块706,用于获取子数据查询请求,其中,子数据查询请求携带待查询子数据对应的数据标识;基于数据标识,获取待查询子数据所属的业务数据对应的当前索引序列;基于数据标识,在当前索引序列中确定待查询子数据对应的待查询索引空间;基于待查询索引空间对应的待查询标记位,确定待查询子数据对应的存储方式;基于待查询子数据对应的存储方式,从相应的存储空间读取待查询子数据,向子数据查询请求对应的查询方返回待查询子数据。The query request response module 706 is used to obtain a sub-data query request, wherein the sub-data query request carries a 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 to-be-queried mark 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 query party corresponding to the sub-data query request.
在一个实施例中,空间数据长度确定模块702还用于:In one embodiment, the spatial data length determination module 702 is further configured to:
对预计数据长度进行二进制转换得到转换结果,基于所述转换结果得到初始数据长度;获取参考数据长度,基于参考数据长度和初始数据长度,确定扩充长度范围;在目标业务数据对应的子业务数据中,统计数据长度处于扩充长度范围内的子业务数据,得到扩充子数据量;统计目标业务数据包含的子业务数据得到目标子数据量;当扩充子数据量与目标子数据量之间的比值大于预设比值时,基于参考数据长度更新初始数据长度,得到空间数据长度。Perform binary conversion on the expected data length to obtain a conversion result, and obtain an initial data length based on the conversion result; obtain a reference data length, and determine an extended length range based on the reference data length and the initial data length; among the sub-business data corresponding to the target business data, count the sub-business data whose statistical length is within the extended length range to obtain an extended sub-data volume; count the sub-business data included in the target business data to obtain a target sub-data volume; when the ratio between the extended sub-data volume and the target sub-data volume is greater than a preset ratio, update the initial data length based on the reference data length to obtain the spatial data length.
在一个实施例中,查询请求响应模块706还用于: In one embodiment, the query request response module 706 is further configured to:
当待查询子数据对应的存储方式为堆空间存储时,基于待查询索引空间中存储的指针,确定待查询子数据在对应的待查询堆空间中的待查询存储空间,从待查询存储空间中读取待查询子数据;当待查询子数据对应的存储方式为索引空间存储时,从待查询索引空间中读取待查询子数据。When the storage method corresponding to the sub-data to be queried is heap space storage, based on the pointer stored in the index space to be queried, the storage space to be queried of the sub-data to be queried in the corresponding heap space to be queried is determined, 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.
上述业务数据存储装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。Each module in the above-mentioned business data storage device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图8所示。该计算机设备包括处理器、存储器、输入/输出接口(Input/Output,简称I/O)和通信接口。其中,处理器、存储器和输入/输出接口通过系统总线连接,通信接口通过输入/输出接口连接到系统总线。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质和内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储初始索引序列、目标子数据等数据。该计算机设备的输入/输出接口用于处理器与外部设备之间交换信息。该计算机设备的通信接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种业务数据存储方法。In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG8. The computer device includes a processor, a memory, an input/output interface (Input/Output, referred to as I/O) and a communication interface. The processor, the memory and the input/output interface are connected via a system bus, and the communication interface is connected to the system bus via the input/output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as an initial index sequence and target sub-data. The input/output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a business data storage method is implemented.
在一个实施例中,提供了一种计算机设备,该计算机设备可以是终端,其内部结构图可以如图9所示。该计算机设备包括处理器、存储器、输入/输出接口、通信接口、显示单元和输入装置。其中,处理器、存储器和输入/输出接口通过系统总线连接,通信接口、显示单元和输入装置通过输入/输出接口连接到系统总线。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质和内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的输入/输出接口用于处理器与外部设备之间交换信息。该计算机设备的通信接口用于与外部的终端进行有线或无线方式的通信,无线方式可通过WIFI、移动蜂窝网络、NFC(近场通信)或其他技术实现。该计算机程序被处理器执行时以实现一种业务数据存储方法。该计算机设备的显示单元用于形成视觉可见的画面,可以是显示屏、投影装置或虚拟现实成像装置。显示屏可以是液晶显示屏或者电子墨水显示屏,该计算机设备的输入装置可以是显示屏上覆盖的触摸层,也可以是计算机设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG9. The computer device includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input/output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input/output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input/output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a business data storage method is implemented. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
本领域技术人员可以理解,图8、9中示出的结构,仅仅是与本申请方案相关的部分结 构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art will appreciate that the structures shown in FIGS. 8 and 9 are only partial structures related to the present application. The block diagram of the structure does not constitute a limitation on the computer device to which the present application solution is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
在一个实施例中,提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机程序,该处理器执行计算机程序时实现上述各方法实施例中的步骤。In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述各方法实施例中的步骤。In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
在一个实施例中,提供了一种计算机程序产品或计算机程序,该计算机产品或计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行上述各方法实施例中的步骤。In one embodiment, a computer program product or computer program is provided, the computer product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-mentioned method embodiments.
需要说明的是,本申请所涉及的用户信息(包括但不限于用户设备信息、用户个人信息等)和数据(包括但不限于用于分析的数据、存储的数据、展示的数据等),均为经用户授权或者经过各方充分授权的信息和数据,且相关数据的收集、使用和处理需要遵守相关国家和地区的相关法律法规和标准。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, stored data, displayed data, 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 relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-Only Memory,ROM)、磁带、软盘、闪存、光存储器、高密度嵌入式非易失性存储器、阻变存储器(ReRAM)、磁变存储器(Magnetoresistive Random Access Memory,MRAM)、铁电存储器(Ferroelectric Random Access Memory,FRAM)、相变存储器(Phase Change Memory,PCM)、石墨烯存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器等。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic Random Access Memory,DRAM)等。本申请所提供的各实施例中所涉及的数据库可包括关系型数据库和非关系型数据库中至少一种。非关系型数据库可包括基于区块链的分布式数据库等,不限于此。本申请所提供的各实施例中所涉及的处理器可为通用处理器、中央处理器、图形处理器、数字信号处理器、可编程逻辑器、基于量子计算的数据处理逻辑器等,不限于此。A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present 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), magnetoresistive 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. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, etc., but are not limited to this.
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的 各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. All possible combinations of various technical features 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.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请的保护范围应以所附权利要求为准 The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the patent of the present application. It should be pointed out that, for ordinary technicians in this field, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the attached claims.

Claims (10)

  1. 一种业务数据存储方法,所述方法包括:A business data storage method, the method comprising:
    获取目标业务数据对应的初始索引序列;Obtain the initial index sequence corresponding to the target business data;
    从所述目标业务数据包含的各个子业务数据中确定目标子数据,将所述初始索引序列中所述目标子数据对应的索引空间作为目标索引空间;Determine target sub-data from each sub-service data included in the target service data, and use the index space corresponding to the target sub-data in the initial index sequence as the target index space;
    当所述目标子数据对应的目标数据长度小于或等于所述目标索引空间的空间数据长度时,将所述目标子数据写入所述目标索引空间,得到目标索引序列;以及When the target data length corresponding to the target sub-data is less 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; and
    当所述目标子数据对应的目标数据长度大于所述目标索引空间的空间数据长度时,将所述目标子数据写入所述目标业务数据对应的目标堆空间中,得到所述目标子数据对应的目标指针,将所述目标指针写入所述目标索引空间,得到目标索引序列。When the target data length corresponding to the target sub-data is greater than the space data length of the target index space, the target sub-data is written into the target heap space corresponding to the target business data, and the target pointer corresponding to the target sub-data is obtained. The target pointer is written into the target index space to obtain a target index sequence.
  2. 根据权利要求1所述的方法,其中,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    统计所述各个子业务数据分别对应的数据长度,得到所述目标业务数据对应的预计数据长度;以及Counting the data lengths corresponding to the sub-service data to obtain the estimated data length corresponding to the target service data; and
    基于所述预计数据长度确定所述空间数据长度。The spatial data length is determined based on the expected data length.
  3. 根据权利要求2所述的方法,其中,所述基于所述预计数据长度确定所述空间数据长度,包括:The method according to claim 2, wherein the determining the spatial data length based on the expected data length comprises:
    对所述预计数据长度进行二进制转换得到转换结果,基于所述转换结果得到初始数据长度;Performing binary conversion on the estimated data length to obtain a conversion result, and obtaining an initial data length based on the conversion result;
    获取参考数据长度,基于所述参考数据长度和所述初始数据长度,确定扩充长度范围;Acquire a reference data length, and determine an extended length range based on the reference data length and the initial data length;
    在所述目标业务数据对应的子业务数据中,统计数据长度处于所述扩充长度范围内的子业务数据,得到扩充子数据量;In the sub-service data corresponding to the target service data, the sub-service data whose statistical data length is within the extended length range is obtained to obtain the extended sub-data volume;
    统计所述目标业务数据包含的子业务数据得到目标子数据量;以及Counting the sub-service data included in the target service data to obtain a target sub-data volume; and
    当所述扩充子数据量与所述目标子数据量之间的比值大于预设比值时,基于所述参考数据长度更新所述初始数据长度,得到所述空间数据长度。When the ratio between the extended sub-data amount and the target sub-data amount is greater than a preset ratio, the initial data length is updated based on the reference data length to obtain the spatial data length.
  4. 根据权利要求1所述的方法,其中,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    在所述目标索引序列中,基于所述目标子数据对应的存储方式,更新所述目标索引空间对应的目标标记位;所述存储方式包括堆空间存储和索引空间存储,所述目标标记位用于表征所述目标子数据对应的存储方式。In the target index sequence, based on the storage method corresponding to the target sub-data, the target mark bit corresponding to the target index space is updated; the storage method includes heap space storage and index space storage, and the target mark bit is used to characterize the storage method corresponding to the target sub-data.
  5. 根据权利要求1所述的方法,其中,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    获取子数据查询请求,其中,所述子数据查询请求携带待查询子数据对应的数据标识; Obtaining a sub-data query request, wherein the sub-data query request carries a data identifier corresponding to the sub-data to be queried;
    基于所述数据标识,获取所述待查询子数据所属的业务数据对应的当前索引序列;Based on the data identifier, obtaining a current index sequence corresponding to the business data to which the sub-data to be queried belongs;
    基于所述数据标识,在所述当前索引序列中确定所述待查询子数据对应的待查询索引空间;Based on the data identifier, determining the to-be-queried index space corresponding to the to-be-queried sub-data in the current index sequence;
    基于所述待查询索引空间对应的待查询标记位,确定所述待查询子数据对应的存储方式;以及Determining a storage mode corresponding to the sub-data to be queried based on the to-be-queried mark bit corresponding to the to-be-queried index space; and
    基于所述待查询子数据对应的存储方式,从相应的存储空间读取所述待查询子数据,向所述子数据查询请求对应的查询方返回所述待查询子数据。Based on the storage mode 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. 根据权利要求5所述的方法,其中,所述基于所述待查询子数据对应的存储方式,从相应的存储空间读取所述待查询子数据,包括:The method according to claim 5, wherein the reading the sub-data to be queried from the corresponding storage space based on the storage mode 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 the 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, the sub-data to be queried is read from the index space to be queried.
  7. 根据权利要求1至6中任一项所述的方法,其中,所述目标业务数据为目标表格,所述目标子数据为目标单元格数据。The method according to any one of claims 1 to 6, wherein the target business data is a target table, and the target sub-data is target cell data.
  8. 一种业务数据存储装置,所述装置包括:A business data storage device, the device comprising:
    索引序列获取模块,用于获取目标业务数据对应的初始索引序列;An index sequence acquisition module is used to acquire an initial index sequence corresponding to target business data;
    目标子数据确定模块,用于从所述目标业务数据包含的各个子业务数据中确定目标子数据,将所述初始索引序列中所述目标子数据对应的索引空间作为目标索引空间;A target sub-data determining module, configured to determine target sub-data from each sub-service data included in the target service data, and use the index space corresponding to the target sub-data in the initial index sequence as the target index space;
    目标子数据存储模块,用于当所述目标子数据对应的目标数据长度小于或等于所述目标索引空间的空间数据长度时,将所述目标子数据写入所述目标索引空间,得到目标索引序列;A target sub-data storage module, configured 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;
    目标子数据存储模块,还用于当所述目标子数据对应的目标数据长度大于所述目标索引空间的空间数据长度时,将所述目标子数据写入所述目标业务数据对应的目标堆空间中,得到所述目标子数据对应的目标指针,将所述目标指针写入所述目标索引空间,得到目标索引序列。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 target data length corresponding to the target sub-data is greater than the space data length of the target index space, obtain the target pointer corresponding to the target sub-data, write the target pointer into the target index space, and obtain the target index sequence.
  9. 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现权利要求1至7中任一项所述的方法的步骤。A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the methods of claims 1 to 7 when executing the computer program.
  10. 一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1至7中任一项所述的方法的步骤。 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 method according to any one of claims 1 to 7.
PCT/CN2023/129235 2023-03-14 2023-11-02 Service data storage method and apparatus, computer device, and storage medium WO2024187779A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202310311147.1 2023-03-14
CN202310311147.1A CN116185305A (en) 2023-03-14 2023-03-14 Service data storage method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2024187779A1 true WO2024187779A1 (en) 2024-09-19

Family

ID=86450739

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/129235 WO2024187779A1 (en) 2023-03-14 2023-11-02 Service data storage method and apparatus, computer device, and storage medium

Country Status (2)

Country Link
CN (1) CN116185305A (en)
WO (1) WO2024187779A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116185305A (en) * 2023-03-14 2023-05-30 金蝶软件(中国)有限公司 Service data storage method, device, computer equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004229163A (en) * 2003-01-27 2004-08-12 Internatl Business Mach Corp <Ibm> Device and method for retrieving fixed length data, computer program, and computer readable recording medium
CN101441638A (en) * 2007-11-21 2009-05-27 英业达股份有限公司 Data structure of mapping file
CN103678657A (en) * 2013-12-24 2014-03-26 北京中科大洋科技发展股份有限公司 Method for storing and reading altitude data of terrain
CN103678160A (en) * 2012-08-30 2014-03-26 腾讯科技(深圳)有限公司 Data storage method and device
CN112286725A (en) * 2020-10-28 2021-01-29 联想(北京)有限公司 Data processing method and device and electronic equipment
CN116185305A (en) * 2023-03-14 2023-05-30 金蝶软件(中国)有限公司 Service data storage method, device, computer equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004229163A (en) * 2003-01-27 2004-08-12 Internatl Business Mach Corp <Ibm> Device and method for retrieving fixed length data, computer program, and computer readable recording medium
CN101441638A (en) * 2007-11-21 2009-05-27 英业达股份有限公司 Data structure of mapping file
CN103678160A (en) * 2012-08-30 2014-03-26 腾讯科技(深圳)有限公司 Data storage method and device
CN103678657A (en) * 2013-12-24 2014-03-26 北京中科大洋科技发展股份有限公司 Method for storing and reading altitude data of terrain
CN112286725A (en) * 2020-10-28 2021-01-29 联想(北京)有限公司 Data processing method and device and electronic equipment
CN116185305A (en) * 2023-03-14 2023-05-30 金蝶软件(中国)有限公司 Service data storage method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN116185305A (en) 2023-05-30

Similar Documents

Publication Publication Date Title
US7461233B2 (en) Method for identifying data characteristics for flash memory
US9489409B2 (en) Rollover strategies in a N-bit dictionary compressed column store
CN110196847A (en) Data processing method and device, storage medium and electronic device
US9823854B2 (en) Priority-based access of compressed memory lines in memory in a processor-based system
EP4174677A1 (en) Data reading and writing method and device
US20190370009A1 (en) Intelligent swap for fatigable storage mediums
CN111177143B (en) Key value data storage method and device, storage medium and electronic equipment
CN113569508B (en) Database model construction method and device for data indexing and access based on ID
CN114924911B (en) Method, device, equipment and storage medium for backing up effective data of Windows operating system
WO2024187779A1 (en) Service data storage method and apparatus, computer device, and storage medium
CN112199039B (en) Virtual storage management method and processor
WO2024016789A1 (en) Log data query method and apparatus, and device and medium
EP4120060A1 (en) Method and apparatus of storing data,and method and apparatus of reading data
CN117112941A (en) Dictionary acquisition method, dictionary acquisition device, computer device, storage medium, and program product
TWI777268B (en) Virtual memory management method and processor
CN114745436A (en) Data acquisition method and device, computer equipment and storage medium
CN117785889B (en) Index management method for graph database and related equipment
CN117290302B (en) Directory separation method, apparatus, computer device and storage medium
CN114676675B (en) Data processing method, device, computer equipment and storage medium
CN116126546B (en) Performance optimization method and device, electronic equipment and medium
CN114840466B (en) Resource allocation space allocation method and device, computer equipment and storage medium
US20240320203A1 (en) Method for data processing, database system, computer equipment, and storage medium
CN116627876A (en) Address remapping method, device, equipment and storage medium
CN117435589A (en) Data transfer method, device, computer equipment and storage medium
CN117725266A (en) Load curve data processing method and device and intelligent ammeter

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23927120

Country of ref document: EP

Kind code of ref document: A1