Cross-database sequence access method, medium, product and equipment

By designing a shared sequence cache area and preset sequence sharing system table in the shared memory of the database, the problem that traditional database sequence objects can only be used in the current database is solved, and sequence access across databases is achieved, efficiency is improved and data correctness is ensured.

CN119848095APending Publication Date: 2025-04-18CETC JINCANG (BEIJING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510047104.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-13
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

The sequence objects of traditional databases are library-level objects, and users can only use them in the current database and cannot achieve sequence access across databases.

Method used

Sequence access across databases is achieved by designing shared sequence caches and preset sequence sharing system tables in the shared memory of all databases. The specific steps include obtaining access instructions, querying whether the shared sequence cache exists for the target sequence object, if there is, determine whether there is an unused sequence value, and if there is, obtain the minimum value, otherwise generate the next sequence value and update the cache area and system table synchronously.

Benefits of technology

It realizes sequence access across databases, improves sequence access efficiency, and ensures data accuracy in high concurrency scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119848095A_ABST
    Figure CN119848095A_ABST
Patent Text Reader

Abstract

The invention provides a cross-database sequence access method, a medium, a product and equipment. The method comprises the steps that an access instruction is acquired, and the access instruction is used for accessing a target sequence object across databases to acquire a target sequence value; querying whether a target cache corresponding to the target sequence object exists in a shared sequence cache region or not according to the access instruction, wherein the shared sequence cache region is a cache region specially used for storing the sequence object in a shared memory of a database; if not, the target sequence object is accessed in a preset sequence sharing system table according to the access instruction, and a target sequence value is obtained, and the preset sequence sharing system table is used for storing meta information of the sequence object. According to the method, the shared sequence cache region and the preset sequence sharing system table are designed in the shared memory of all the databases, so that it is ensured that the access instruction can access the corresponding sequence object across the databases, and the sequence access efficiency across the databases can be further improved by designing the shared sequence cache region.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of database technology, and in particular to a cross-database sequence access method, medium, product and device. Background Art

[0002] In modern data instances, traditional databases provide sequence objects. Users can create and use sequences to obtain a series of increasing or decreasing numbers. For example, after the user connects to the database "test", perform the following operations:

[0003] create sequence s4 cache 1000;

[0004] select nextval('s4');

[0005] select nextval('s4');

[0006] select nextval('s4');

[0007] select nextval('s4');

[0008] select nextval('s4');

[0009] The above operation will create a sequence named "s4", and then obtain the values ​​1, 2, 3, 4, 5 through the sequence.

[0010] However, the sequence objects of traditional databases are library-level objects, and users can only use the sequences in the current library. Therefore, "s4" can only be used in the database "test". Summary of the invention

[0011] In view of the above problems, the present invention proposes a cross-database sequence access method, medium, product and device that overcome the above problems or at least partially solve the above problems.

[0012] An object of the present invention is to enable cross-database sequence access.

[0013] A further object of the present invention is to ensure the data correctness of cross-library sequences in high-concurrency scenarios.

[0014] Another further object of the present invention is to improve the efficiency of sequence access across databases.

[0015] In particular, the present invention provides a cross-database sequence access method, comprising:

[0016] Get access instructions, which are used to access the target sequence object across databases to obtain the target sequence value;

[0017] According to the access instruction, query whether there is a target cache corresponding to the target sequence object in the shared sequence cache area, where the shared sequence cache area is a cache area in the shared memory of the database specifically used to store sequence objects;

[0018] If not, the target sequence object is accessed in a preset sequence sharing system table according to the access instruction and the target sequence value is obtained. The preset sequence sharing system table is used to store the meta information of the sequence object.

[0019] Optionally, after the step of querying whether there is a target cache corresponding to the target sequence object in the shared sequence cache area according to the access instruction, the method further includes:

[0020] In the case where a target cache exists in the shared sequence buffer area, determining whether there is an unused sequence value in the target cache;

[0021] If so, the smallest sequence value is obtained in order from the unused sequence values ​​as the target sequence value, and the data about the target sequence object in the target cache and the preset sequence sharing system table are synchronously updated.

[0022] Optionally, after the step of determining whether there is an unused sequence value in the target cache, the step further includes:

[0023] If there is no unused sequence value in the target cache, the next sequence value is generated according to the existing sequence value in the target cache as the target sequence value;

[0024] Synchronously update the target cache and the data about the target sequence object in the preset sequence shared system table.

[0025] Optionally, before the step of querying whether there is a target cache corresponding to the target sequence object in the shared sequence cache area according to the access instruction, the method further includes:

[0026] Determine whether the shared sequence buffer is in an accessed state;

[0027] If not, the shared sequence buffer is locked, and a step of querying whether there is a target buffer corresponding to the target sequence object in the shared sequence buffer according to the access instruction is executed.

[0028] Optionally, the step of accessing the target sequence object in the preset sequence sharing system table according to the access instruction and obtaining the target sequence value includes:

[0029] According to the access instruction, the meta information of the target sequence object is obtained by querying the preset sequence sharing system table;

[0030] Get the preset cache value;

[0031] Generate the same number of sequence values ​​for the target sequence object according to the preset cache value;

[0032] The smallest sequence value among the unused sequence values ​​is obtained in order as the target sequence value and the preset sequence shared system table is updated.

[0033] Optionally, after the step of accessing the target sequence object in the preset sequence sharing system table according to the access instruction and obtaining the target sequence value, the step further includes:

[0034] The data about the target sequence object in the updated preset sequence shared system table is synchronized to the shared sequence buffer area.

[0035] Optionally, the method for maintaining the shared sequence buffer includes:

[0036] Determine the commonly used sequence objects in the preset sequence sharing system table through a preset round-robin scheduling algorithm;

[0037] Synchronize the data corresponding to the commonly used sequence objects to the shared sequence buffer;

[0038] Delete the data corresponding to the infrequently used sequence objects in the shared sequence buffer.

[0039] According to another aspect of the present invention, 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 of any one of the above-mentioned cross-database sequence access methods are implemented.

[0040] According to yet another aspect of the present invention, a computer program product is provided, which includes a computer program, and when the computer program is executed by a processor, the steps of any one of the above-mentioned cross-database sequence access methods are implemented.

[0041] According to another aspect of the present invention, a computer device is provided, comprising a memory, a processor, and a machine executable program stored in the memory and running on the processor, and the processor implements any of the steps of the above-mentioned cross-database sequence access method when executing the machine executable program.

[0042] The cross-database sequence access method of the present invention first obtains an access instruction, which is used to access a target sequence object across databases to obtain a target sequence value; inquires whether there is a target cache corresponding to the target sequence object in a shared sequence buffer according to the access instruction, and the shared sequence buffer is a buffer area in the shared memory of the database specifically used to store sequence objects; if not, accesses the target sequence object and obtains the target sequence value in a preset sequence shared system table according to the access instruction, and the preset sequence shared system table is used to store the meta information of the sequence object. The method ensures that the access instruction can access the corresponding sequence object across databases by designing a shared sequence buffer and a preset sequence shared system table in the shared memory of all databases, and the design of the shared sequence buffer can further improve the efficiency of cross-database sequence access.

[0043] Furthermore, the cross-database sequence access method of the present invention further includes, before the step of querying whether there is a target cache corresponding to the target sequence object in the shared sequence cache according to the access instruction: determining whether the shared sequence cache is in an accessed state; if not, locking the shared sequence cache, and executing the step of querying whether there is a target cache corresponding to the target sequence object in the shared sequence cache according to the access instruction. This method can ensure the data correctness of the cross-database sequence in a high-concurrency scenario.

[0044] Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Hereinafter, some specific embodiments of the present invention will be described in detail in an exemplary and non-limiting manner with reference to the accompanying drawings. The same reference numerals in the accompanying drawings indicate the same or similar components or parts. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the accompanying drawings:

[0046] Figure 1 is a flow chart of a cross-database sequence access method according to an embodiment of the present invention;

[0047] Figure 2 is a flow chart of a cross-database sequence access method according to another embodiment of the present invention;

[0048] Figure 3 is a flow chart of a cross-database sequence access method according to yet another embodiment of the present invention;

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

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

[0051] Figure 6 is a schematic diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0052] It should be understood by those skilled in the art that the embodiments described below are only some embodiments of the present invention, rather than all embodiments of the present invention, and these embodiments are intended to explain the technical principles of the present invention, rather than to limit the protection scope of the present invention. Based on the embodiments provided by the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should still fall within the protection scope of the present invention.

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

[0054] The present invention provides a cross-database sequence access method. Figure 1 FIG. 1 is a flow chart of a cross-database sequence access method according to an embodiment of the present invention. Figure 1 As shown, the cross-database sequence access method at least includes the following steps S101 to S103.

[0055] Step S101, obtain access instructions. The access instructions are used to access the target sequence object across the database to obtain the target sequence value. In the database field, a sequence is an object that automatically generates increasing or decreasing numbers according to certain rules, and it exists independently of the table in the database. It is like a number generator that continuously generates a series of numbers according to preset rules. These numbers can be used in various scenarios that require unique identification, such as generating primary key values ​​for records in a table, assigning values ​​to business serial numbers, etc. In this step, the way to obtain access instructions can generally be active input by the user, or automatically generated by the database program during operation due to business needs. Those skilled in the art can decide how to obtain access instructions according to actual conditions.

[0056] Step S102, query whether there is a target cache corresponding to the target sequence object in the shared sequence cache according to the access instruction. Among them, the shared sequence cache is a cache area in the shared memory of the database specifically used to store sequence objects, which can generally be called shared_sequence_cache. Shared memory is a memory area that shares data between multiple databases in a database cluster. In the database cluster, isolated databases can access the data in the shared memory, and multiple database-related processes can access and operate the data in the shared memory at the same time, thereby achieving efficient data interaction and collaborative work. The shared sequence cache is a cache area that this method specifically divides in the shared memory for storing shared sequences. Storing the target cache corresponding to the target sequence object in the shared sequence cache can greatly improve the query speed of accessing sequences across databases.

[0057] In some optional embodiments, the maintenance method of the shared sequence buffer area may generally include: determining the commonly used sequence objects in the preset sequence shared system table through a preset round-robin scheduling algorithm; synchronizing the data corresponding to the commonly used sequence objects to the shared sequence buffer area; and deleting the data corresponding to the uncommonly used sequence objects in the shared sequence buffer area. The preset round-robin scheduling algorithm is an algorithm for optimizing resource management and allocation, which is generally used to determine which sequences should remain in the shared sequence buffer area and which sequences should be written back to the preset sequence shared system table to release cache space.

[0058] Optionally, the method of triggering the preset round-robin scheduling algorithm can generally be after a specific time period or after a set number of sequence access operations. An optional calculation method of the preset round-robin scheduling algorithm is to sort the sequences according to the access frequency by recording and counting the number of accesses or frequencies of each sequence within a period of time. Sequences with high access frequencies are considered to be active sequences and are more likely to be frequently used in subsequent operations, so they will be retained in the shared sequence cache area first; while sequences with low access frequencies may be marked as inactive sequences and become candidates for replacement. When the shared sequence cache area is insufficient or a new sequence needs to enter the cache area, the preset round-robin scheduling algorithm will select one or more inactive sequences according to the preset rules and write them back to the preset sequence sharing system table, thereby freeing up space to accommodate new or more active sequences, and realizing dynamic updating and optimization of the shared sequence cache area, so as to improve the overall hit rate of the shared sequence cache area and the performance of the system. Those skilled in the art can decide the calculation method and triggering method of the preset round-robin scheduling algorithm according to actual conditions.

[0059] Step S103: when the judgment in step S102 is no, access the target sequence object in the preset sequence sharing system table according to the access instruction and obtain the target sequence value.

[0060] In some optional embodiments, step S103 may generally include: querying the preset sequence sharing system table to obtain the metadata of the target sequence object according to the access instruction; obtaining the preset cache value; generating the same number of sequence values ​​for the target sequence object according to the preset cache value; obtaining the smallest sequence value in order from the unused sequence values ​​as the target sequence value and updating the preset sequence sharing system table.

[0061] The shared system table is generally used to store metadata at the database cluster level, which is shared in all databases. The method of the present invention chooses to add a preset sequence shared system table in the shared system table. The preset sequence shared system table is generally used to store the metadata of the sequence object, wherein the metadata of the sequence object generally includes sequence identification information and sequence attribute information. The sequence identification information generally refers to the name, creator and other information of the sequence object, and the sequence attribute information generally includes the starting value, incremental value, maximum value, minimum value and loop flag of the sequence. The incremental value refers to the value added to the starting value each time a new value is generated, which is used to control the growth step of the sequence value, and the loop flag is generally used to indicate whether the sequence generates a new value in a loop after reaching the maximum or minimum value. If it is set to loop, the sequence will be generated from the starting value again after reaching the boundary value; if it is not looped, an exception may be thrown or the generation of new values ​​may be stopped when the boundary value is reached. The technicians in this field can decide the specific information recorded in the preset sequence shared system table according to the actual situation.

[0062] Optionally, after step S103, the process may also generally include: synchronizing the data on the target sequence object in the updated preset sequence sharing system table to the shared sequence buffer area.

[0063] This method ensures that access instructions can access corresponding sequence objects across databases by designing a shared sequence buffer and a preset sequence shared system table in the shared memory of all databases, and the design of the shared sequence buffer can further improve the efficiency of sequence access across databases.

[0064] In other optional embodiments, after the step of querying whether there is a target cache corresponding to the target sequence object in the shared sequence cache area according to the access instruction, it can generally also include: when there is a target cache in the shared sequence cache area, determining whether there is an unused sequence value in the target cache; if so, obtaining the smallest sequence value in the unused sequence values ​​in order as the target sequence value, and synchronously updating the target cache and the data about the target sequence object in the preset sequence shared system table.

[0065] Optionally, after the step of determining whether there are unused sequence values ​​in the target cache, the following may generally be included: if there are no unused sequence values ​​in the target cache, generating the next sequence value as the target sequence value based on the existing sequence value in the target cache; and synchronously updating the data about the target sequence object in the target cache and the preset sequence sharing system table.

[0066] In some other optional embodiments, since the database cluster is usually in a high-concurrency scenario, in order to ensure the data correctness of the cross-library sequence in a high-concurrency scenario, before the step of querying whether there is a target cache corresponding to the target sequence object in the shared sequence cache according to the access instruction, it can generally include: judging whether the shared sequence cache is in an accessed state; if not, locking the shared sequence cache, and executing the step of querying whether there is a target cache corresponding to the target sequence object in the shared sequence cache according to the access instruction. The way to judge whether the shared sequence cache is in an accessed state can be to judge whether the current shared sequence cache is locked. If it is locked, it means that other sessions are accessing the shared sequence cache. In order to ensure the accuracy of the data, it is necessary to wait for other sessions to complete the processing and unlock before accessing and performing other operations. When the operation is completed, it is also necessary to unlock the lock added during the access to indicate that the access is completed. Those skilled in the art can determine the type of lock and the recording method of the lock according to the actual access requirements.

[0067] Figure 2 is a flow chart of a cross-database sequence access method according to another embodiment of the present invention. Figure 2 As shown, the cross-database sequence access method at least includes the following steps S201 to S205.

[0068] Step S201, according to the access instruction, the metadata of the target sequence object is obtained by querying in the preset sequence sharing system table. The shared system table is generally used to store metadata at the database cluster level, and these data are shared in all databases. The method of the present invention chooses to add a preset sequence sharing system table in the shared system table. The preset sequence sharing system table is generally used to store the metadata of the sequence object, wherein the metadata of the sequence object generally may include sequence identification information and sequence attribute information. The sequence identification information generally refers to the name, creator and other information of the sequence object, and the sequence attribute information generally may include the starting value, incremental value, maximum value, minimum value and loop flag of the sequence. The incremental value refers to the value added to the starting value each time a new value is generated, which is used to control the growth step of the sequence value, and the loop flag is generally used to indicate whether the sequence generates a new value in a loop after reaching the maximum or minimum value. If it is set to loop, the sequence will start to generate from the starting value again after reaching the boundary value; if it is not looped, it may throw an exception or stop generating new values ​​when reaching the boundary value. Those skilled in the art can decide the specific information recorded in the preset sequence sharing system table according to actual conditions.

[0069] Step S202, obtaining a preset cache value. In some optional embodiments, the preset cache value generally refers to a preset value, which is used to determine the number of sequence values ​​generated for the target sequence object and stored in the cache at one time. For example, when the cache value is set to 100, the system will generate 100 consecutive sequence values ​​for the target sequence object at one time and store them in the cache for standby. This allows them to be directly used in subsequent query processes, further improving execution speed.

[0070] Step S203, generate the same number of sequence values ​​for the target sequence object according to the preset cache value. Based on the acquired preset cache value and other relevant meta information of the target sequence object (such as the starting value, the incremental value, etc.), the system will perform calculation and generation operations according to the established sequence generation rules. For example, if the starting value of the target sequence object is 1, the incremental value is 1, and the preset cache value is 50, then 50 consecutive sequence values ​​from 1 to 50 will be generated in sequence.

[0071] Step S204: Obtain the smallest sequence value in order from the unused sequence values ​​as the target sequence value and update the preset sequence sharing system table.

[0072] Step S205, synchronize the data about the target sequence object in the updated preset sequence shared system table to the shared sequence cache. After obtaining the target sequence value, it is generally necessary to update the relevant meta information of the target sequence object in the preset sequence shared system table, mainly including: Current value update: update the current value field of the target sequence object recorded in the table to the next available value, such as 10, after selecting 10 as the target sequence value, update the current value to 12 according to the incremental value (assuming the incremental value is 2), and ensure that the current value recorded in the system table always reflects the latest state of the sequence. Use statistics related updates: If there are statistical fields such as the number of times the sequence is used and the most recent use time recorded in the system table, they also need to be updated accordingly, such as adding 1 to the number of times used, and updating the most recent use time to the current time, etc., to facilitate the subsequent analysis and management of the frequency of use, activity, etc. of the sequence, and then provide accurate data support for cache strategy adjustment, resource allocation, etc.

[0073] This method can be used to orderly implement operations from querying sequence object metadata, generating cached sequence values ​​to accurately obtaining and updating related data, thereby ensuring that sequence values ​​can be used efficiently, accurately and orderly in cross-database application scenarios, maintaining the consistency and stability of the entire system data level.

[0074] Figure 3 FIG. 1 is a flow chart of a cross-database sequence access method according to another embodiment of the present invention. Figure 3 As shown, the cross-database sequence access method at least includes the following steps S301 to S309.

[0075] Step S301, obtaining an access instruction.

[0076] Step S302, determine whether the shared sequence buffer area is in an accessed state. The method for determining whether the shared sequence buffer area is in an accessed state may be to determine whether the current shared sequence buffer area is locked. If it is locked, it means that other sessions are accessing the shared sequence buffer area. In order to ensure the accuracy of the data, it is necessary to wait for other sessions to be processed and unlocked before accessing and performing other operations. When the operation is completed, it is also necessary to unlock the lock added during access to indicate that the access is completed. Those skilled in the art can determine the type of lock and the lock recording method according to actual access requirements.

[0077] Step S303: If the answer in step S302 is yes, wait for the access to end.

[0078] Step S304: When the judgment in step S302 is No or step S303 is completed, the shared sequence buffer area is locked.

[0079] Step S305, determining whether there is a target buffer corresponding to the target sequence object in the shared sequence buffer area.

[0080] Step S306: If the answer in step S305 is yes, determine whether there is any unused sequence value in the target cache.

[0081] Step S307, if the judgment in step S306 is yes, obtain the smallest sequence value in the unused sequence values ​​in order as the target sequence value. The reason for selecting the smallest sequence value is to strictly follow the principle of order required by the sequence itself. Generally speaking, the values ​​generated by the sequence are arranged according to the law of increasing (or decreasing, depending on the specific settings). Obtaining the smallest unused value in order can ensure that the entire sequence value generation and use process remains coherent and orderly, and meets the business logic's expectations for the sequence. For example, if the unused sequence values ​​in the target cache are 3, 5, 7, etc., then 3 will be selected as the target sequence value, so that when the sequence values ​​continue to be obtained later, they can also be obtained in order to ensure the logic and accuracy of the data.

[0082] Step S308: If the judgment in step S306 is no, a next sequence value is generated as a target sequence value according to the existing sequence value in the target cache.

[0083] Step S309: synchronously update the target cache and the data on the target sequence object in the preset sequence sharing system table.

[0084] Through this method, we can not only make full use of the existing unused sequence values ​​in the shared sequence buffer to achieve the purpose of efficiently obtaining sequence values, but also ensure that the data in the buffer and the system table are always consistent, ensuring that the entire cross-database sequence mechanism runs stably and reliably in a complex database environment (especially in high-concurrency scenarios), and providing accurate data support for various business operations that rely on sequence values.

[0085] The flow chart provided by the present embodiment is not intended to indicate that the operation of the method will be performed in any particular order, or that all operations of the method are included in all every case. In addition, the method may include additional operations. Within the scope of the technical thinking provided by the present embodiment method, additional changes may be made to the above method.

[0086] It should be understood that in some embodiments, each part can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system.

[0087] This embodiment also provides a computer program product 10 , a computer readable storage medium 20 , and a computer device 30 . Figure 4is a schematic diagram of a computer program product 10 according to an embodiment of the present invention, Figure 5 is a schematic diagram of a computer-readable storage medium 20 according to an embodiment of the present invention, Figure 6 is a schematic diagram of a computer device 30 according to an embodiment of the present invention. The computer program product 10 includes a computer program 11, which implements the steps of any of the above-mentioned cross-database sequence access methods when executed by a processor 32. The computer-readable storage medium 20 stores the above-mentioned computer program 11, which implements the steps of the cross-database sequence access method of any of the above-mentioned embodiments when executed by the processor 32. The computer device 30 may include a memory 31, a processor 32, and the computer program 11 stored in the memory 31 and running on the processor 32.

[0088] The computer program 11 for performing the operation of the present invention may be an assembly instruction, an instruction set architecture (ISA) instruction, a machine instruction, a machine-related instruction, a microcode, a firmware instruction, a state setting data, a configuration data of an integrated circuit, or a source code or an object code written in any combination of one or more programming languages ​​and process programming languages. The computer program 11 may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer may be connected to the user's computer via any type of network (including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider via the Internet). In some embodiments, in order to perform various aspects of the present invention, an electronic circuit including, for example, a programmable logic circuit, a field programmable gate array (FPGA) or a programmable logic array (PLA) may execute computer-readable program instructions by utilizing the state information of the computer-readable program instructions to personalize the electronic circuit.

[0089] For the purposes of the description of the present embodiment, the computer program product 10 is a related product that includes the computer program 11. For the purposes of the description of the present embodiment, the computer readable storage medium 20 is a tangible device capable of retaining and storing the computer program 11, which may be any device that can contain, store, communicate, propagate or transmit the program 11 for use with or in conjunction with an instruction execution system, device or apparatus. More specific examples (a non-exhaustive list) of the computer readable storage medium 20 include the following: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, and any suitable combination of the foregoing.

[0090] The computer device 30 may be, for example, a server, a desktop computer, a notebook computer, a tablet computer, or a smart phone. In some examples, the computer device 30 may be a cloud computing node. The computer device 30 may be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, a program module may include routines, programs, target programs, components, logic, data structures, etc. that perform specific tasks or implement specific abstract data types. The computer device 30 may be implemented in a distributed cloud computing environment where remote processing devices linked via a communication network perform tasks. In a distributed cloud computing environment, program modules may be located on a local or remote computing system storage medium including a storage device.

[0091] The computer device 30 may include a processor 32 adapted to execute stored instructions, and a memory 31 providing temporary storage space for the operation of the instructions during operation. The processor 32 may be a single-core processor, a multi-core processor, a computing cluster, or any number of other configurations. The memory 31 may include a random access memory (RAM), a read-only memory, a flash memory, or any other suitable storage system.

[0092] The computer device 30 may also include a network adapter / interface and an input / output (I / O) interface. The I / O interface allows data to be input and output with external devices that may be connected to the computer device. The network adapter / interface may provide communication between the computer device and a network, which is typically shown as a communication network.

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

Claims

1. A cross-database sequence access method, comprising: Get access instructions, where the access instructions are used to access the target sequence object across databases to obtain the target sequence value; querying, according to the access instruction, whether there is a target cache corresponding to the target sequence object in a shared sequence cache area, wherein the shared sequence cache area is a cache area in the shared memory of the database specifically used for storing the sequence object; If not, access the target sequence object in a preset sequence sharing system table according to the access instruction and obtain the target sequence value, wherein the preset sequence sharing system table is used to store the meta information of the sequence object.

2. The cross-database sequence access method according to claim 1, wherein: After the step of querying whether there is a target cache corresponding to the target sequence object in the shared sequence cache area according to the access instruction, the following step further includes: In the case where the target cache exists in the shared sequence cache area, determining whether there is an unused sequence value in the target cache; If so, the smallest sequence value is obtained in order from the unused sequence values ​​as the target sequence value, and the data about the target sequence object in the target cache and the preset sequence sharing system table are synchronously updated.

3. The cross-database sequence access method according to claim 2, wherein: After the step of determining whether there is an unused sequence value in the target cache, the following step is further included: If there is no unused sequence value in the target cache, generating a next sequence value as the target sequence value according to the existing sequence value in the target cache; The data about the target sequence object in the target cache and the preset sequence sharing system table are synchronously updated.

4. The cross-database sequence access method according to claim 1, wherein: Before the step of querying whether there is a target cache corresponding to the target sequence object in the shared sequence cache area according to the access instruction, the step further includes: Determining whether the shared sequence buffer is in an accessed state; If not, the shared sequence buffer area is locked, and the step of querying whether there is a target buffer corresponding to the target sequence object in the shared sequence buffer area according to the access instruction is performed.

5. The cross-database sequence access method according to claim 1, wherein: The step of accessing the target sequence object in the preset sequence sharing system table according to the access instruction and obtaining the target sequence value comprises: According to the access instruction, the meta information of the target sequence object is obtained by querying in a preset sequence sharing system table; Get the preset cache value; Generate the same number of sequence values ​​for the target sequence object according to the preset cache value; The smallest sequence value is obtained in order from the unused sequence values ​​as the target sequence value and the preset sequence sharing system table is updated.

6. The cross-database sequence access method according to claim 5, wherein: After the step of accessing the target sequence object in the preset sequence sharing system table according to the access instruction and obtaining the target sequence value, the following step further comprises: The updated data about the target sequence object in the preset sequence sharing system table is synchronized to the shared sequence buffer area.

7. The cross-database sequence access method according to claim 1, wherein: The maintenance method of the shared sequence buffer area includes: Determine the commonly used sequence objects in the preset sequence sharing system table by using a preset round-robin scheduling algorithm; Synchronize the data corresponding to the common sequence object to the shared sequence buffer; Delete the data corresponding to the infrequently used sequence objects in the shared sequence buffer.

8. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the cross-database sequence access method according to any one of claims 1 to 7 are implemented.

9. A computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the cross-database sequence access method according to any one of claims 1 to 7.

10. A computer device comprising a memory, a processor, and a machine executable program stored in the memory and running on the processor, wherein the processor implements the steps of the cross-database sequence access method according to any one of claims 1 to 7 when executing the machine executable program.