CN112685417B - Database operation method, system, device, server and storage medium - Google Patents
Database operation method, system, device, server and storage medium Download PDFInfo
- Publication number
- CN112685417B CN112685417B CN202011613781.3A CN202011613781A CN112685417B CN 112685417 B CN112685417 B CN 112685417B CN 202011613781 A CN202011613781 A CN 202011613781A CN 112685417 B CN112685417 B CN 112685417B
- Authority
- CN
- China
- Prior art keywords
- object identifier
- server
- target
- queried
- index table
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 94
- 238000013507 mapping Methods 0.000 claims description 37
- 230000004048 modification Effects 0.000 claims description 30
- 238000012986 modification Methods 0.000 claims description 30
- 238000011017 operating method Methods 0.000 claims description 15
- 230000004913 activation Effects 0.000 claims description 3
- 238000004590 computer program Methods 0.000 claims description 2
- 238000010586 diagram Methods 0.000 description 22
- 230000003993 interaction Effects 0.000 description 12
- 230000008569 process Effects 0.000 description 11
- 238000013500 data storage Methods 0.000 description 4
- 241000533950 Leucojum Species 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a database operation method, a database operation system, a database operation device, a database operation server and a database operation storage medium, wherein the database operation method comprises the following steps: receiving a first query statement sent by routing equipment, wherein the first query statement comprises a first object identifier to be queried; according to the first object identification to be queried, acquiring a target second object identification corresponding to the first object identification to be queried from an index table stored in a target server; and acquiring first target detail information corresponding to the target second object identifier from a detail table stored in the target server according to the target second object identifier. In the database operation method, on one hand, the data related to the corresponding first object identification are respectively stored in the plurality of servers, so that the pressure of a single server can be reduced, high concurrency inquiry can be realized, and on the other hand, the data is stored in each server by adopting an index table and a detail table, so that quick inquiry can be realized, and the inquiry efficiency is improved.
Description
Technical Field
The embodiment of the invention relates to the field of computers, in particular to a database operation method, a database operation system, a database operation device, a database operation server and a database storage medium.
Background
The internet industry has huge information quantity, and mass data needs to be stored in order to meet the data query requirement.
The existing mass data storage scheme is as follows: the main field in one table is reserved in the main table, and other information is split into an expansion table on the same server for storage.
However, in the process of implementing the present invention, it is found that at least the following technical problems exist in the prior art: according to the scheme, the data in the main table and the data in the extension table are stored in the same server, and the query efficiency is low when the data is queried in high concurrency.
Disclosure of Invention
The invention provides a database operation method, a database operation system, a database operation device, a database operation server and a database storage medium, and aims to solve the technical problem of low query efficiency in the conventional database operation method.
In a first aspect, an embodiment of the present invention provides a database operation method, which is applied to a target server, including:
receiving a first query statement sent by routing equipment; the first query statement comprises a first object identifier to be queried, the routing equipment is connected with a plurality of servers including the target server, and the target server is a server corresponding to the first object identifier to be queried, which is determined by the routing equipment according to the corresponding relation between the first object identifier and the server; each server is stored with an index table and a detail table corresponding to the index table, the index table is used for indicating the mapping relation between a first object identifier corresponding to the server and a second object identifier, and the detail table is used for indicating the mapping relation between the second object identifier and detail information;
Acquiring a target second object identifier corresponding to the first object identifier to be queried from an index table stored in the target server according to the first object identifier to be queried;
and acquiring first target detail information corresponding to the target second object identifier from a detail table stored in the target server according to the target second object identifier.
In a second aspect, an embodiment of the present invention provides a database operating system, including:
a routing device and a plurality of servers connected to the routing device;
the routing equipment acquires a first query statement; the first query statement comprises a first object identifier to be queried;
the routing equipment determines a target server corresponding to the first object identifier to be queried in the plurality of servers according to the corresponding relation between the first object identifier and the servers; an index table and a detail table corresponding to the index table are stored in each server, the index table is used for indicating the mapping relation between a first object identifier and a second object identifier corresponding to the server, and the detail table is used for indicating the mapping relation between the second object identifier and detail information;
The routing device sends the first query statement to the target server;
the target server is configured to perform the database operating method according to the first aspect.
In a third aspect, an embodiment of the present invention provides a database operating apparatus, where the database operating apparatus is disposed in a target server, including:
the receiving module is used for receiving a first query statement sent by the routing equipment; the first query statement comprises a first object identifier to be queried, the routing equipment is connected with a plurality of servers including the target server, and the target server is a server corresponding to the first object identifier to be queried, which is determined by the routing equipment according to the corresponding relation between the first object identifier and the server; each server is stored with an index table and a detail table corresponding to the index table, the index table is used for indicating the mapping relation between a first object identifier corresponding to the server and a second object identifier, and the detail table is used for indicating the mapping relation between the second object identifier and detail information;
the first acquisition module is used for acquiring a target second object identifier corresponding to the first object identifier to be queried from an index table stored in the target server according to the first object identifier to be queried;
And the second acquisition module is used for acquiring the first target detail information corresponding to the target second object identifier from the detail table stored in the target server according to the target second object identifier.
In a fourth aspect, an embodiment of the present invention further provides a server, where the server includes:
one or more processors;
a memory for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the database operating method as provided in the first aspect.
In a fifth aspect, embodiments of the present invention also provide a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a database operating method as provided in the first aspect.
The embodiment of the invention provides a database operation method, a database operation system, a database operation device, a database operation server and a database storage medium, wherein the database operation method comprises the following steps: receiving a first query statement sent by routing equipment, wherein the first query statement comprises a first object identifier to be queried, the routing equipment is connected with a plurality of servers including a target server, and the target server is a server corresponding to the first object identifier to be queried, which is determined by the routing equipment according to the corresponding relation between the first object identifier and the server; each server is stored with an index table and a detail table corresponding to the index table, the index table is used for indicating the mapping relation between the first object identifier and the second object identifier corresponding to the server, and the detail table is used for indicating the mapping relation between the second object identifier and the detail information; according to the first object identification to be queried, acquiring a target second object identification corresponding to the first object identification to be queried from an index table stored in a target server; and acquiring first target detail information corresponding to the target second object identifier from a detail table stored in the target server according to the target second object identifier. In the database operation method, on one hand, the data related to the corresponding first object identifiers are respectively stored in the plurality of servers, so that the pressure of a single server can be reduced, the bottleneck in the query process is avoided, the high concurrency query can be realized, and on the other hand, the data are stored in each server by adopting an index table and a detail table, the rapid query can be realized, and the query efficiency is improved. Therefore, the database operation method provided by the embodiment can realize high-concurrency rapid query.
Drawings
FIG. 1 is a schematic diagram of a database operating system according to an embodiment of the present invention;
FIG. 2 is a flowchart of a database operation method according to an embodiment of the present invention;
FIG. 3 is a corresponding relationship between a first object identifier and a server in the database operation method provided by the present invention;
FIG. 4 is a schematic diagram of an index table and a detail table in the database operation method according to the present invention;
FIG. 5 is another schematic diagram of an index table in the database operation method according to the present invention;
FIG. 6 is a schematic diagram of information interaction of the database operation method according to the embodiment shown in FIG. 2;
FIG. 7 is a flowchart of a database operation method according to another embodiment of the present invention;
FIG. 8 is a schematic diagram of writing data in the database operation method according to the present invention;
FIG. 9 is a schematic diagram of information interaction of the database operation method according to the embodiment shown in FIG. 7;
FIG. 10 is a flowchart of a database operation method according to another embodiment of the present invention;
FIG. 11 is a diagram of modified data in the database operating method according to the present invention;
FIG. 12 is a schematic diagram of information interaction of the database operation method according to the embodiment shown in FIG. 10;
FIG. 13 is a flowchart of a database operation method according to still another embodiment of the present invention;
FIG. 14 is a schematic diagram of information interaction of the database operation method according to the embodiment shown in FIG. 13;
FIG. 15 is a schematic diagram of a database operating apparatus according to an embodiment of the present invention;
fig. 16 is a schematic structural diagram of a server according to an embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
Fig. 1 is a schematic structural diagram of a database operating system according to an embodiment of the present invention. As shown in fig. 1, the system includes: a routing device 11, and a plurality of servers 12 connected to the routing device 11. In this embodiment the data is stored in a plurality of servers 12. The data stored in the present embodiment includes: the first object identifier, the second object identifier and the detail information corresponding to the second object identifier. The first object identifier has a corresponding relation with the server. To improve query efficiency, within each server, data is stored in two tables: index table and detail table corresponding to index table. The index table is used for indicating the mapping relation between the first object identifier and the second object identifier corresponding to the server, and the detail table is used for indicating the mapping relation between the second object identifier and the detail information. In other words, in the database operating system provided in this embodiment, on one hand, data is stored in a plurality of servers, so as to reduce the pressure of a single server, and on the other hand, in the server, a data storage manner of an index table and a detail table is adopted, so as to improve the query efficiency.
Based on the database operating system, the embodiment improves a database operating method to improve database query efficiency. The database operation method provided in this embodiment is described in detail below.
Fig. 2 is a flowchart of a database operation method according to an embodiment of the present invention. The embodiment is suitable for a scene of inquiring the database. The present embodiment may be performed by a database operating device, which may be implemented in software and/or hardware, which may be integrated in a target server. As shown in fig. 2, the database operation method provided in this embodiment includes the following steps:
step 201: and receiving a first query statement sent by the routing equipment.
Wherein the first query statement includes a first object identification to be queried. The routing device connects a plurality of servers including the target server. The target server is a server corresponding to the first object identifier to be queried, which is determined by the routing equipment according to the corresponding relation between the first object identifier and the server. Each server stores an index table and a list corresponding to the index table. The index table is used for indicating the mapping relation between the first object identifier and the second object identifier corresponding to the server. The list is used for indicating the mapping relation between the second object identification and the list information.
Specifically, the routing device in this embodiment is a device capable of determining, according to a correspondence between the first object identifier and the server, a target server corresponding to the first object identifier to be queried. The routing device may receive a first query statement. The first query statement in this embodiment may be a query statement sent by the user equipment or a query statement sent by the operator equipment or the maintainer equipment.
The correspondence between the first object identification and the server is predetermined. When determining the target server, the routing device may determine the server corresponding to the first object identifier to be queried in the corresponding relationship as the target server. Fig. 3 is a corresponding relationship between a first object identifier and a server in the database operation method provided by the present invention. As shown in fig. 3, each first object identifier corresponds to only one server. Each server stores an index table and a list table.
Alternatively, the corresponding server may be determined according to the data of the preset number of bits at the tail of the first object identifier. More specifically, assume that the number of servers is 2 n And n is an integer greater than or equal to 2, and the bit number of the first object identifier is greater than n, so that the corresponding relationship between the first object identifier and the server can be: for 2 according to the first object identification n And determining a server corresponding to the first object identifier as a result of the remainder, wherein the essence of the server is that the last n bits of the first object identifier correspond to the server. Based on the implementation manner, the routing device may determine, according to the last n bits of the first object identifier to be queried, a target server corresponding to the first object identifier to be queried. After determining the target server corresponding to the first object identifier to be queried, the routing device sends a first query statement to the target server.
The target server receives a first query statement sent by the routing device. Based on the foregoing description, the target server stores an index table and a detail table corresponding to the index table. The index table is used for indicating the mapping relation between the first object identifier and the second object identifier corresponding to the target server. The list is used for indicating the mapping relation between the second object identification and the list information.
Illustratively, the first object identifier in the present embodiment may be a user identifier, and the second object identifier may be a marketing information identifier. So as to realize operations such as mass data storage, inquiry and the like in the marketing scene. The user identification in this embodiment may be a personal identification password (Personal Identification Number, PIN) for the user.
More specifically, the marketing message may be a coupon. The detail information includes at least one of: the type of the coupon, the denomination of the coupon, the condition of use of the coupon, the coupon rules corresponding to the coupon, and the status of the coupon. The coupon returning rule refers to a rule that a user returns after using a coupon, and whether the used coupon is returned to the user or not. The status of the coupon includes: coupon used status, coupon unused status, and coupon in-use status.
Step 202: and acquiring a target second object identifier corresponding to the first object identifier to be queried from an index table stored in the target server according to the first object identifier to be queried.
Step 203: and acquiring first target detail information corresponding to the target second object identifier from a detail table stored in the target server according to the target second object identifier.
Specifically, in this embodiment, in order to improve the query efficiency of the target server, the query may be performed by querying the index table and then querying the detail table. In step 202, the target server may obtain, from the stored index table, a target second object identifier corresponding to the first object identifier to be queried. Then, in step 203, based on the target second object identifier queried in step 202, the first target detail information corresponding to the target second object identifier is obtained from the stored detail table. In the process, since the detail information is not stored in the index table, the stored data volume is smaller, and the target second object identification can be queried from the index table faster. Then, based on the target second object identification, the first target detail information corresponding to the target second object identification can be queried out from the detail table faster. The query mode has higher query efficiency. Moreover, in the scene of high concurrency inquiry, faster inquiry can be realized.
Optionally, after step 203, the destination server may feed back the first destination details information to the routing device.
FIG. 4 is a schematic diagram of an index table and a detail table in the database operation method according to the present invention. As shown in fig. 4, the fields stored in the index table include: the first object identifier and the second object identifier. The fields stored in the detail table include: the second object identification and the detail information.
Of course, it is understood that other fields may be included in the index table. For example, in a scenario where the second object is a coupon, the index table may further include fields such as a time associated with the coupon, a coupon status, etc. Correspondingly, in order to improve the query efficiency, in this scenario, the first query statement may also include information of these fields as shown before. Other fields may also be included in the list. For example, the details table may also include fields such as the time of day associated with the coupon.
Alternatively, the index table may be stored in the elastic search and the detail table may be stored in the HBase in this embodiment. The elastic search can achieve real-time searching, and is stable, reliable, quick and convenient to install and use. HBase is a distributed, nematic, open source database. Since the elastiscearch is flexible, the HBase can implement a fast query for the second object identification. Thus, this implementation may further improve the efficiency and reliability of the query.
Fig. 6 is a schematic information interaction diagram of the database operation method provided in the embodiment shown in fig. 2. The database operation method provided in this embodiment is described below from the viewpoint of interaction between the routing device and the target server. As shown in fig. 6, the high database operation method includes the steps of:
step 601: the routing device obtains a first query statement.
Step 602: and the routing equipment determines a target server corresponding to the first object identifier to be queried in the plurality of servers according to the corresponding relation between the first object identifier and the servers.
Step 603: the routing device sends a first query statement to the target server.
Step 604: the target server receives a first query statement sent by the routing device.
Step 605: and the target server acquires a target second object identifier corresponding to the first object identifier to be queried from an index table stored in the target server according to the first object identifier to be queried.
Step 606: and the target server acquires the first target detail information corresponding to the target second object identifier from the detail table stored in the target server according to the target second object identifier.
In a more specific implementation, the first query statement further includes: the first object to be queried identifies the relevant time of the corresponding target second object. Correspondingly, the index table of the server comprises a plurality of sub-index tables. Each sub-index table is used for indicating a mapping relation among a first object identifier, a second object identifier and a related time of the second object corresponding to the server. The time ranges formed by the correlation times of the second objects in the different sub-index tables are different. That is, in this implementation, the index table is split into a plurality of sub-index tables according to the difference in the time range formed by the correlation time of the second object, so as to refine the index table.
By way of example, the time range herein may be day, month, etc. That is, the mapping relationship of the first object identification, the second object identification, and the related time of the second object on the same day may be stored in the same sub-index table. Alternatively, the mapping relationship of the first object identifier, the second object identifier, and the related time of the second object for the same month may be stored in the same sub-index table.
In a scenario where the second object is a coupon, the relevant time of the second object includes at least one of: the time of acquisition of the coupon, the time of activation of the coupon, the time of use of the coupon, and the expiration date of the coupon.
Fig. 5 is another schematic diagram of an index table in the database operation method provided by the present invention. As shown in fig. 5, the index table includes a plurality of sub-index tables. Assuming that the first object is a user, the second object is a coupon, and the relevant time of the second object is the time of picking up the coupon. The time ranges formed by the time of picking up coupons in different sub-index tables are different. For example, in sub-index Table 5.1, the coupon pickup times are 2020.12.1 days; in the sub-index table 5.2, the coupon retrieval time was 2020.12.2 days; in sub-index Table 5.3, the coupon pickup time was 2020.12.3 days.
Based on this implementation, step 202 may specifically include: determining a sub-index table corresponding to the first object identifier to be queried in the index table stored in the target server according to the first object identifier to be queried and the related time of the target second object; and acquiring a target second object identifier corresponding to the first object identifier to be queried from a sub-index table corresponding to the first object identifier to be queried. According to the implementation mode, the target second object identification can be positioned in the sub-index table during query, and the query efficiency is further improved based on the sub-index table.
Optionally, the database operation method provided in this embodiment further includes the following steps: acquiring the related time of the second object in each sub-index table stored in the target server at a preset frequency; and deleting the whole data of which the relevant time of the corresponding second object in the sub-index table and the detail table stored in the target server meets the preset condition. For example, the preset condition may be 2020.1.1 days ago, and based on the preset condition, the whole piece of data corresponding to the sub-index table stored in the target server and the second object corresponding to the detail table and having the relevant time 2020.1.1 days ago is deleted. The whole data means all data corresponding to the relevant time of the second object meeting the preset condition in the index table and the detail table.
Deleting the whole data of which the related time of the corresponding second object in the sub index table and the detail table stored in the target server meets the preset condition can release the storage resource when the deleting condition is met, can improve the resource utilization rate, and can ensure the stability of the query performance.
Although the details table may not store the correlation time of the second object, since the first object identifier, the second object identifier, and the correlation time of the second object have a mapping relationship, and the details table is used to indicate the mapping relationship between the second object identifier and the details information, it can be seen that the second object identifier and the details information in the details table have a mapping relationship with the correlation time of the second object.
In one particular scenario, the first object is a user, the second object is a coupon, the index table may include an index table of a coupon instance table and an index table of a coupon operation log table, and the list may include a list of a coupon instance table and a list of a coupon operation log table. Then, in such a scenario, the table name of the index table may be included in the first query statement to determine whether to query the index table of the coupon instance table or the index table of the coupon operation log table. The coupon instance table is identical to the initial fields included in the coupon operation log table, except that the fields in the coupon operation log table are only increased and not modified or deleted. For example, when a coupon is consumed, data of a consumed coupon is added to a coupon operation log table (an index table or a detail table, which is not limited herein).
The database operation method provided in this embodiment includes: receiving a first query statement sent by routing equipment, wherein the first query statement comprises a first object identifier to be queried, the routing equipment is connected with a plurality of servers including a target server, and the target server is a server corresponding to the first object identifier to be queried, which is determined by the routing equipment according to the corresponding relation between the first object identifier and the server; each server is stored with an index table and a detail table corresponding to the index table, the index table is used for indicating the mapping relation between the first object identifier and the second object identifier corresponding to the server, and the detail table is used for indicating the mapping relation between the second object identifier and the detail information; according to the first object identification to be queried, acquiring a target second object identification corresponding to the first object identification to be queried from an index table stored in a target server; and acquiring first target detail information corresponding to the target second object identifier from a detail table stored in the target server according to the target second object identifier. In the database operation method, on one hand, the data related to the corresponding first object identifiers are respectively stored in the plurality of servers, so that the pressure of a single server can be reduced, the bottleneck in the query process is avoided, the high concurrency query can be realized, and on the other hand, the data are stored in each server by adopting an index table and a detail table, the rapid query can be realized, and the query efficiency is improved. Therefore, the database operation method provided by the embodiment can realize high-concurrency rapid query.
Fig. 7 is a flowchart of a database operation method according to another embodiment of the present invention. The embodiment is suitable for a scene of writing data into a database. This embodiment describes in detail how to write data to a target server based on the embodiment shown in fig. 2 and various alternative implementations. As shown in fig. 7, the procedure of writing data in the database operation method provided in this embodiment is as follows:
step 701: and receiving the write statement sent by the routing equipment.
The writing statement comprises a first object identifier to be written, a second object identifier to be written, which is generated according to the first object identifier to be written, related time of the second object to be written and detail information corresponding to the second object identifier to be written. The target server is a server which is determined by the routing equipment according to the corresponding relation between the first object identifier and the server and is to be written into the corresponding relation of the first object identifier.
Specifically, the write statement in this embodiment may be a write statement sent by the user equipment or a write statement sent by the operator and maintainer equipment.
Optionally, the correspondence between the first object identifier and the server may be: the last n bits of the first object identification correspond to the server. Based on the implementation manner, the routing device may determine, according to the last n bits of the first object identifier to be written, a target server corresponding to the first object identifier to be written. And the routing equipment sends a write statement to the target server after determining that the target server corresponding to the first object identifier to be written is to be written.
The second object identifier to be written in this embodiment may be generated according to the first object identifier to be written.
Optionally, the number of servers is 2 n And n is an integer greater than or equal to 2, and the bit number of the first object identifier to be written is greater than n. The second object identifier to be written is a unique string generated by the routing equipment according to a preset algorithm, and data formed by last n bits of data to be written into the first object identifier are added at the tail part of the unique string.
The preset algorithm may be a snowflake algorithm or other distributed algorithm. The number of bits of the unique string may be a preset number of bits. Illustratively, the number of bits of the unique string may be 60 bits. In generating the unique string, the types of the second objects are considered, and an anti-duplicate timestamp is added to ensure that the generated unique string is not duplicated. After the unique string is generated, adding the last n bits of data to be written into the first object identifier at the tail part of the unique string to form a second object identifier to be written into.
The method for generating the second object identifier based on the first object identifier can ensure that data query can be realized by using either the first object identifier or the second object identifier, namely, query with two dimensions is supported, and the query flexibility is higher.
Step 702: and determining a sub-index table corresponding to the first object identifier to be written in an index table stored in the target server according to the first object identifier to be written in and the related time of the second object to be written in.
Step 702 is similar to the specific implementation of step 202, and will not be described again here.
Step 703: writing the first object identifier to be written, the second object identifier to be written and the relevant time of the second object to be written into the sub-index table corresponding to the first object identifier to be written.
Step 704: and writing the second object identifier to be written into the detail table stored in the target server, and writing the detail information corresponding to the second object identifier to be written into.
After executing step 702, steps 703 and 704 are executed. Step 703 and step 704 have no timing relationship, and may be performed in any order or in parallel.
Fig. 8 is a schematic diagram of writing data in the database operation method provided by the present invention. As shown in fig. 8, the first object identification to be written, the second object identification to be written, and the associated time for the second object to be written are written in the sub-index table 8.1. And writing the second object identifier to be written and the detail information corresponding to the second object identifier to be written in the detail table.
It should be noted that, before, after, or at the same time as writing data, the steps of data query shown in steps 201 to 203 may be performed, and for simplicity, the process of querying data is not described in this embodiment.
Fig. 9 is a schematic information interaction diagram of the database operation method provided in the embodiment shown in fig. 7. The database operation method provided in this embodiment is described below from the viewpoint of interaction between the routing device and the target server. As shown in fig. 9, the high database operation method further includes the steps of:
step 901: the routing device generates a write statement.
Specifically, the routing device generates a corresponding second object identifier to be written according to the received first object identifier to be written, and packages the received first object identifier to be written, the related time of the second object to be written, the detailed information corresponding to the second object identifier to be written and the generated second object identifier to be written into a writing statement.
Step 902: and the routing equipment determines a target server corresponding to the first object identifier to be written in the plurality of servers according to the corresponding relation between the first object identifier and the servers.
Step 903: the routing device sends a write statement to the target server.
Step 904: the target server receives the write statement sent by the routing device.
Step 905: and the target server determines a sub-index table corresponding to the first object identifier to be written in an index table stored in the target server according to the first object identifier to be written in and the related time of the second object to be written in.
Step 906: and the target server writes the first object identifier to be written, the second object identifier to be written and the relevant time of the second object to be written into the sub-index table corresponding to the first object identifier to be written.
Step 907: and the target server writes the second object identifier to be written and the detail information corresponding to the second object identifier to be written into the detail table stored in the target server.
The database operation method provided in this embodiment further includes: receiving a writing statement sent by a routing device, wherein the writing statement comprises a first object identifier to be written, a second object identifier to be written, which is generated according to the first object identifier to be written, related time of the second object to be written and detail information corresponding to the second object identifier to be written, and the target server is a server corresponding to the first object identifier to be written, which is determined by the routing device according to the corresponding relation between the first object identifier and the server; determining a sub-index table corresponding to the first object identifier to be written in an index table stored in a target server according to the first object identifier to be written in and the related time of the second object to be written in; writing a first object identifier to be written, a second object identifier to be written and the related time of the second object to be written into a sub-index table corresponding to the first object identifier to be written; and writing the second object identifier to be written into the detail table stored in the target server, and writing the detail information corresponding to the second object identifier to be written into. According to the database operation method, based on the writing process, on one hand, data can be stored in a plurality of servers, the pressure of a single server can be reduced, bottlenecks in writing and inquiring are avoided, high-concurrency writing and inquiring can be realized, on the other hand, in each server, the data are stored by adopting an index table and a detail table, the rapid inquiring can be realized subsequently, and the inquiring efficiency is improved.
Fig. 10 is a flowchart of a database operation method according to another embodiment of the present invention. The embodiment is suitable for the scene of data modification of the database. This embodiment describes in detail how to modify the data in the target server based on the embodiments shown in fig. 2 and 7 and various alternative implementations. As shown in fig. 10, the procedure for modifying data in the database operation method provided in this embodiment is as follows:
step 1001: and receiving the modification statement sent by the routing equipment.
The modification statement comprises a first object identifier to be modified, related time of a second object to be modified corresponding to the first object identifier to be modified and modification information corresponding to the first object identifier to be modified. The target server is a server corresponding to the first object identifier to be modified, which is determined by the routing equipment according to the corresponding relation between the first object identifier and the server.
Specifically, the modification statement in the embodiment may be a modification statement sent by the user equipment or a modification statement sent by the operator and maintainer equipment.
Optionally, the correspondence between the first object identifier and the server may be: the last n bits of the first object identification correspond to the server. Based on the implementation manner, the routing device may determine, according to the last n bits of the first object identifier to be modified, a target server corresponding to the first object identifier to be modified. And the routing equipment sends a modification statement to the target server after determining the target server corresponding to the first object identifier to be modified.
Step 1002: and determining a sub-index table corresponding to the first object identifier to be modified in the index table stored in the target server according to the first object identifier to be modified and the related time of the second object to be modified.
Step 1002 is similar to the specific implementation process of step 202, and will not be described again here.
Step 1003: and acquiring a second object identifier to be modified corresponding to the first object identifier to be modified from the sub-index table corresponding to the first object identifier to be modified.
Step 1004: and acquiring detail information corresponding to the second object identifier to be modified from a detail table stored in the target server according to the second object identifier to be modified.
Step 1005: and modifying the detail information corresponding to the second object identifier to be modified according to the modification information corresponding to the first object identifier to be modified.
In step 1005, modifying the detail information corresponding to the second object identifier to be modified may include the following two implementations: for replacing information to be replaced in detail information corresponding to a second object identifier to be modified by modification information corresponding to the first object identifier to be modified; and the other is to add modification information corresponding to the first object identifier to be modified in the detail information corresponding to the second object identifier to be modified.
FIG. 11 is a schematic diagram of modifying data in the database operating method according to the present invention. As shown in fig. 11, assuming that the second object is a coupon, the detail information is a coupon state, and the modification information corresponding to the first object identifier to be modified is changed from unused to used in the coupon state, the "unused" in the coupon state corresponding to the second object identifier to be modified in the detail table is modified to "used".
It should be noted that, before, after, or simultaneously with modifying the data, the steps of querying the data as shown in steps 201 to 203 and/or the steps of writing the data as shown in steps 701 to 704 may be performed, and for simplicity, the process of querying the data and writing the data is not described in this embodiment.
Fig. 12 is a schematic information interaction diagram of the database operation method provided in the embodiment shown in fig. 10. The database operation method provided in this embodiment is described below from the viewpoint of interaction between the routing device and the target server. As shown in fig. 12, the high database operation method further includes the steps of:
step 1201: the routing device obtains the modification statement.
Step 1202: and the routing equipment determines a target server corresponding to the first object identifier to be modified in the plurality of servers according to the corresponding relation between the first object identifier and the servers.
Step 1203: the routing device sends a modification statement to the target server.
Step 1204: the target server receives the modification statement sent by the routing device.
Step 1205: and the target server determines a sub-index table corresponding to the first object identifier to be modified in the index table stored in the target server according to the first object identifier to be modified and the related time of the second object to be modified.
Step 1206: and the target server acquires a second object identifier to be modified, which corresponds to the first object identifier to be modified, from a sub-index table which corresponds to the first object identifier to be modified.
Step 1207: and the target server acquires the detail information corresponding to the second object identifier to be modified from the detail table stored in the target server according to the second object identifier to be modified.
Step 1208: and the target server modifies the detail information corresponding to the second object identifier to be modified according to the modification information corresponding to the first object identifier to be modified.
The database operation method provided in this embodiment further includes: receiving a writing statement sent by a routing device, wherein the writing statement comprises a first object identifier to be written, a second object identifier to be written, which is generated according to the first object identifier to be written, related time of the second object to be written and detail information corresponding to the second object identifier to be written, and the target server is a server corresponding to the first object identifier to be written, which is determined by the routing device according to the corresponding relation between the first object identifier and the server; determining a sub-index table corresponding to the first object identifier to be written in an index table stored in a target server according to the first object identifier to be written in and the related time of the second object to be written in; writing a first object identifier to be written, a second object identifier to be written and the related time of the second object to be written into a sub-index table corresponding to the first object identifier to be written; and writing the second object identifier to be written into the detail table stored in the target server, and writing the detail information corresponding to the second object identifier to be written into. In the database operation method, on one hand, the data related to the corresponding first object identifiers are respectively stored in the plurality of servers, so that the pressure of a single server can be reduced, the bottleneck during modification is avoided, high concurrency modification can be realized, and on the other hand, the data are stored in each server by adopting an index table and a detail table, so that quick modification can be realized, and the modification efficiency is improved.
Fig. 13 is a flowchart of a database operation method according to still another embodiment of the present invention. The embodiment is suitable for a scene of inquiring the database by using the second object identification. This embodiment describes in detail the process of querying the data in the target server using the second object identification based on the embodiments shown in fig. 2, 7, and 10 and various alternative implementations. As shown in fig. 13, the process of querying data in the database operation method provided in this embodiment is as follows:
step 1301: and receiving a second query statement sent by the routing equipment.
The second query statement includes a second object identifier to be queried, and the second object identifier to be queried is generated according to the corresponding first object identifier. The target server is a server corresponding to the second object identifier to be queried, which is determined by the routing equipment according to the corresponding relation between the first object identifier and the server.
Specifically, since the second object identifier to be queried is generated according to the corresponding first object identifier, that is, the first object identifier has a corresponding relationship with the second object identifier, and the first object identifier has a corresponding relationship with the server, it can be determined that the second object identifier also has a corresponding relationship with the server. In other words, the routing device may determine, according to the correspondence between the first object identifier and the server, the server corresponding to the second object identifier to be queried.
Optionally, the number of servers is 2 n And n is an integer greater than or equal to 2, and the bit number of the first object identification is greater than n. The second object identifier is data formed by generating a unique string by the routing equipment according to a preset algorithm and adding the last n bits of data of the corresponding first object identifier at the tail part of the unique string.
The preset algorithm may be a snowflake algorithm or other distributed algorithm. The number of bits of the unique string may be a preset number of bits. Illustratively, the number of bits of the unique string may be 60 bits. In generating the unique string, the types of the second objects are considered, and an anti-duplicate timestamp is added to ensure that the generated unique string is not duplicated. After the unique string is generated, adding the last n bits of data of the corresponding first object identifier at the tail part of the unique string to form a second object identifier.
The method for generating the second object identifier based on the first object identifier can ensure that the data query can be realized by utilizing either the first object identifier or the second object identifier on the premise of not carrying out redundant data storage, namely, the query with two dimensions is supported, the query flexibility is higher, and the resource utilization is friendly.
The difference between this embodiment and the embodiment shown in fig. 2 and various alternative implementations is that in this embodiment, the query is implemented according to the identifier of the second object.
Step 1302: and acquiring second target detail information corresponding to the second object identifier to be queried from a detail table stored in the target server according to the second object identifier to be queried.
In step 1302, according to the second object identifier to be queried, second target detail information corresponding to the second object identifier to be queried is obtained from a detail table stored in the target server.
Optionally, after step 1302, the destination server may feed back second destination details information to the routing device.
It should be noted that, before, after, or simultaneously with querying the data using the second object identifier, at least one of the steps of querying the data, performing the writing of the data, and performing the modification of the data, such as steps 701 to 704, and 1001 to 1005, as shown in steps 201 to 203, may be performed, and for simplicity, there is no other data operation process in this embodiment.
Fig. 14 is a schematic information interaction diagram of the database operation method provided in the embodiment shown in fig. 13. The database operation method provided in this embodiment is described below from the viewpoint of interaction between the routing device and the target server. As shown in fig. 14, the high database operation method further includes the steps of:
Step 1401: the routing device obtains a second query statement.
Step 1402: and the routing equipment determines a target server corresponding to the second object identifier to be queried in the plurality of servers according to the corresponding relation between the first object identifier and the servers.
Step 1403: the routing device sends a second query statement to the target server.
Step 1404: the target server receives a second query statement sent by the routing device.
Step 1405: and the target server acquires second target detail information corresponding to the second object identifier to be queried from a detail table stored in the target server according to the second object identifier to be queried.
The database operation method provided in this embodiment further includes: receiving a second query statement sent by the routing equipment, wherein the second query statement comprises a second object identifier to be queried, the second object identifier to be queried is generated according to a corresponding first object identifier, and the target server is a server corresponding to the determined second object identifier to be queried by the routing equipment according to the corresponding relation between the first object identifier and the server; and acquiring second target detail information corresponding to the second object identifier to be queried from a detail table stored in the target server according to the second object identifier to be queried. According to the database operation method, on one hand, multi-dimensional inquiry can be achieved on the premise that data are not stored redundantly, the inquiry flexibility is high, on the other hand, data related to corresponding first object identifiers are stored in a plurality of servers respectively, the pressure of a single server can be reduced, bottlenecks in inquiry are avoided, and high-concurrency inquiry can be achieved.
The embodiment of the invention also provides a database operating system, which comprises: a routing device and a plurality of servers connected to the routing device.
The routing device obtains a first query statement, wherein the first query statement comprises a first object identifier to be queried.
And the routing equipment determines a target server corresponding to the first object identifier to be queried in the plurality of servers according to the corresponding relation between the first object identifier and the servers. Each server stores an index table and a detail table corresponding to the index table, the index table is used for indicating the mapping relation between the first object identifier and the second object identifier corresponding to the server, and the detail table is used for indicating the mapping relation between the second object identifier and the detail information.
The routing device sends a first query statement to the target server.
The target server is used for executing the database operation method provided by any embodiment of the invention.
The database operating system provided by the embodiment has the corresponding functional modules and beneficial effects of the execution method.
Fig. 15 is a schematic structural diagram of a database operating device according to an embodiment of the present invention. The database operating device may be provided in the target server. As shown in fig. 15, the database operating device provided in this embodiment includes the following modules: a receiving module 151, a first acquiring module 152 and a second acquiring module 153.
A receiving module 151, configured to receive a first query statement sent by a routing device.
Wherein the first query statement includes a first object identification to be queried. The routing device connects a plurality of servers including the target server. The target server is a server corresponding to the first object identifier to be queried, which is determined by the routing equipment according to the corresponding relation between the first object identifier and the server. Each server is stored with an index table and a detail table corresponding to the index table, the index table is used for indicating the mapping relation between the first object identifier and the second object identifier corresponding to the server, and the detail table is used for indicating the mapping relation between the second object identifier and the detail information.
The first obtaining module 152 is configured to obtain, according to the first object identifier to be queried, a target second object identifier corresponding to the first object identifier to be queried from an index table stored in the target server.
And the second obtaining module 153 is configured to obtain, according to the target second object identifier, first target detail information corresponding to the target second object identifier from a detail table stored in the target server.
Optionally, the first query statement further includes: the first object to be queried identifies the relevant time of the corresponding target second object. The index table of the server comprises a plurality of sub-index tables, and each sub-index table is used for indicating the mapping relation of the first object identifier, the second object identifier and the related time of the second object corresponding to the server. The time ranges formed by the correlation times of the second objects in the different sub-index tables are different. The first obtaining module 152 is specifically configured to: determining a sub-index table corresponding to the first object identifier to be queried in the index table stored in the target server according to the first object identifier to be queried and the related time of the target second object; and acquiring a target second object identifier corresponding to the first object identifier to be queried from a sub-index table corresponding to the first object identifier to be queried.
Optionally, the apparatus further comprises: a determining module and a writing module.
The receiving module 151 is further configured to receive a write statement sent by the routing device.
The writing statement comprises a first object identifier to be written, a second object identifier to be written, which is generated according to the first object identifier to be written, related time of the second object to be written and detail information corresponding to the second object identifier to be written. The target server is a server which is determined by the routing equipment according to the corresponding relation between the first object identifier and the server and is to be written into the corresponding relation of the first object identifier.
The determining module is used for determining a sub-index table corresponding to the first object identifier to be written in an index table stored in the target server according to the first object identifier to be written in and the related time of the second object to be written in.
The writing module is used for writing the first object identifier to be written, the second object identifier to be written and the relevant time of the second object to be written into the sub-index table corresponding to the first object identifier to be written.
The writing module is further used for writing the second object identifier to be written and the detail information corresponding to the second object identifier to be written into the detail table stored in the target server.
Optionally, the number of servers is 2 n And n is an integer greater than or equal to 2, and the bit number of the first object identifier to be written is greater than n. To be written to secondThe object identifier is a unique string generated by the routing equipment according to a preset algorithm, and data formed by last n bits of data to be written into the first object identifier is added at the tail part of the unique string.
In one implementation, the apparatus further comprises: the module is modified.
The receiving module 151 is further configured to receive the modification statement sent by the routing device.
The modification statement comprises a first object identifier to be modified, related time of a second object to be modified corresponding to the first object identifier to be modified and modification information corresponding to the first object identifier to be modified. The target server is a server corresponding to the first object identifier to be modified, which is determined by the routing equipment according to the corresponding relation between the first object identifier and the server.
The determining module is further configured to determine, according to the first object identifier to be modified and the related time of the second object to be modified, a sub-index table corresponding to the first object identifier to be modified in the index table stored in the target server.
The first obtaining module 152 is further configured to obtain a second object identifier to be modified corresponding to the first object identifier to be modified from a sub-index table corresponding to the first object identifier to be modified.
The second obtaining module 153 is further configured to obtain, according to the second object identifier to be modified, detail information corresponding to the second object identifier to be modified from a detail table stored in the target server.
And the modification module is used for modifying the detail information corresponding to the second object identifier to be modified according to the modification information corresponding to the first object identifier to be modified.
In another implementation, the receiving module 151 is further configured to receive a second query statement sent by the routing device. Wherein the second query statement includes a second object identification to be queried. The second object identifier to be queried is generated according to the corresponding first object identifier. The target server is a server corresponding to the second object identifier to be queried, which is determined by the routing equipment according to the corresponding relation between the first object identifier and the server.
The second obtaining module 153 is further configured to obtain, according to the second object identifier to be queried, second target detail information corresponding to the second object identifier to be queried from a detail table stored in the target server.
Optionally, the apparatus further comprises a deletion module.
The first obtaining module 152 is further configured to obtain, at a preset frequency, a related time of the second object in each sub-index table stored in the target server.
And the deleting module is used for deleting the whole data of which the relevant time of the corresponding second object in the sub-index table and the detail table stored in the target server meets the preset condition.
Optionally, the first object identifier is a user identifier, and the second object identifier is a marketing information identifier.
Illustratively, the marketing message is a coupon. The correlation time of the second object includes at least one of: the time of acquisition of the coupon, the time of activation of the coupon, the time of use of the coupon, and the expiration date of the coupon.
Optionally, the detail information includes at least one of: the relevant time of the coupon, the type of the coupon, the denomination of the coupon, the condition of use of the coupon, the coupon rules corresponding to the coupon, and the status of the coupon.
The database operating device provided by the embodiment of the invention can execute the database operating method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the executing method.
Fig. 16 is a schematic structural diagram of a server according to an embodiment of the present invention. As shown in fig. 16, the server includes a processor 60 and a memory 61. The number of processors 60 in the server may be one or more, one processor 60 being taken as an example in fig. 16; the processor 60 and the memory 61 of the server may be connected by a bus or other means, for example in fig. 16.
The memory 61 is a computer-readable storage medium, and may be used to store a software program, a computer-executable program, and modules, such as program instructions and modules corresponding to the database operating method in the embodiment of the present invention (for example, the receiving module 151, the first acquiring module 152, and the second acquiring module 153 in the database operating device). The processor 60 executes various functional applications of the server and database operating methods, i.e., implements the database operating methods described above, by running software programs, instructions, and modules stored in the memory 61.
The memory 61 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, at least one application program required for functions; the storage data area may store data created according to the use of the server, etc. In addition, the memory 61 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 61 may further comprise memory remotely located with respect to the processor 60, which may be connected to a server via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The present invention also provides a storage medium containing computer executable instructions which, when executed by a computer processor, are for performing a database operating method, the method comprising:
receiving a first query statement sent by routing equipment; the first query statement comprises a first object identifier to be queried, the routing equipment is connected with a plurality of servers including the target server, and the target server is a server corresponding to the first object identifier to be queried, which is determined by the routing equipment according to the corresponding relation between the first object identifier and the server; each server is stored with an index table and a detail table corresponding to the index table, the index table is used for indicating the mapping relation between a first object identifier corresponding to the server and a second object identifier, and the detail table is used for indicating the mapping relation between the second object identifier and detail information;
acquiring a target second object identifier corresponding to the first object identifier to be queried from an index table stored in the target server according to the first object identifier to be queried;
and acquiring first target detail information corresponding to the target second object identifier from a detail table stored in the target server according to the target second object identifier.
Of course, the storage medium containing the computer executable instructions provided in the embodiments of the present invention is not limited to the method operations described above, and may also perform the related operations in the database operation method provided in any embodiment of the present invention.
From the above description of embodiments, it will be clear to a person skilled in the art that the present invention may be implemented by means of software and necessary general purpose hardware, but of course also by means of hardware, although in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, etc., and include several instructions for causing a server (which may be a personal computer, a computer device, or a network device, etc.) to execute the database operation method according to the embodiments of the present invention.
It should be noted that, in the embodiment of the database operating device, each unit and module included are only divided according to the functional logic, but not limited to the above division, so long as the corresponding functions can be implemented; in addition, the specific names of the functional units are also only for distinguishing from each other, and are not used to limit the protection scope of the present invention.
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.
Claims (13)
1. A database operating method, characterized by being applied to a target server, the method comprising:
receiving a first query statement sent by routing equipment; the first query statement comprises a first object identifier to be queried, the routing equipment is connected with a plurality of servers including the target server, and the target server is a server corresponding to the first object identifier to be queried, which is determined by the routing equipment according to the corresponding relation between the first object identifier and the server; each server is stored with an index table and a detail table corresponding to the index table, the index table is used for indicating the mapping relation between a first object identifier corresponding to the server and a second object identifier, and the detail table is used for indicating the mapping relation between the second object identifier and detail information;
Acquiring a target second object identifier corresponding to the first object identifier to be queried from an index table stored in the target server according to the first object identifier to be queried;
according to the target second object identifier, acquiring first target detail information corresponding to the target second object identifier from a detail table stored in the target server;
the determining, according to the correspondence between the first object identifier and the server, the server corresponding to the first object identifier to be queried includes:
determining a corresponding server according to the data of the preset bit number at the tail part of the first object identifier;
the first query statement further includes: the related time of a target second object corresponding to the first object identification to be queried; the index table of the server comprises a plurality of sub-index tables, each sub-index table is used for indicating the mapping relation of the corresponding first object identifier, second object identifier and related time of the second object of the server, and the time ranges formed by the related time of the second object in different sub-index tables are different;
the obtaining, according to the first object identifier to be queried, a target second object identifier corresponding to the first object identifier to be queried from an index table stored in the target server, includes:
Determining a sub-index table corresponding to the first object identifier to be queried in an index table stored in the target server according to the first object identifier to be queried and the related time of the target second object;
and acquiring a target second object identifier corresponding to the first object identifier to be queried from a sub-index table corresponding to the first object identifier to be queried.
2. The method according to claim 1, wherein the method further comprises:
receiving a write statement sent by the routing equipment; the writing statement comprises a first object identifier to be written, a second object identifier to be written, a related time of the second object to be written and detail information corresponding to the second object identifier to be written, wherein the second object identifier to be written is generated according to the first object identifier to be written, and the target server is a server corresponding to the first object identifier to be written, which is determined by the routing equipment according to a corresponding relation between the first object identifier and the server;
determining a sub-index table corresponding to the first object identifier to be written in an index table stored in the target server according to the first object identifier to be written in and the related time of the second object to be written in;
Writing the first object identifier to be written, the second object identifier to be written and the relevant time of the second object to be written into a sub-index table corresponding to the first object identifier to be written;
writing the second object identifier to be written and the detail information corresponding to the second object identifier to be written into a detail table stored in the target server.
3. The method of claim 2, wherein the number of servers is 2 n N is an integer greater than or equal to 2, and the bit number of the first object identifier to be written is greater than n;
the second object identifier to be written is the data formed by the last n bits of data of the first object identifier to be written, wherein the routing equipment generates a unique string according to a preset algorithm, and the tail part of the unique string is added with the data formed by the last n bits of data of the first object identifier to be written.
4. The method according to claim 1, wherein the method further comprises:
receiving a modification statement sent by the routing equipment; the modification statement comprises a first object identifier to be modified, a related time of a second object to be modified corresponding to the first object identifier to be modified and modification information corresponding to the first object identifier to be modified, wherein the target server is a server corresponding to the first object identifier to be modified, which is determined by the routing equipment according to the corresponding relation between the first object identifier and the server;
Determining a sub-index table corresponding to the first object identifier to be modified in the index table stored in the target server according to the first object identifier to be modified and the related time of the second object to be modified;
acquiring a second object identifier to be modified corresponding to the first object identifier to be modified from a sub-index table corresponding to the first object identifier to be modified;
acquiring detail information corresponding to the second object identifier to be modified from a detail table stored in the target server according to the second object identifier to be modified;
and modifying the detail information corresponding to the second object identifier to be modified according to the modification information corresponding to the first object identifier to be modified.
5. The method according to claim 1, wherein the method further comprises:
receiving a second query statement sent by the routing equipment; the second query statement comprises a second object identifier to be queried, the second object identifier to be queried is generated according to a corresponding first object identifier, and the target server is a server corresponding to the second object identifier to be queried, which is determined by the routing equipment according to the corresponding relation between the first object identifier and the server;
And acquiring second target detail information corresponding to the second object identifier to be queried from a detail table stored in the target server according to the second object identifier to be queried.
6. The method according to any one of claims 1 to 4, further comprising:
acquiring the related time of the second object in each sub-index table stored in the target server at a preset frequency;
and deleting the whole data of which the relevant time of the corresponding second object in the sub-index table and the detail table stored in the target server meets the preset condition.
7. The method of any of claims 1 to 4, wherein the first object identifier is a user identifier and the second object identifier is a marketing information identifier.
8. The method of claim 7, wherein the marketing message is a coupon and the associated time of the second object comprises at least one of: the time of acquisition of the coupon, the time of activation of the coupon, the time of use of the coupon, and the expiration date of the coupon.
9. The method of claim 8, wherein the detail information comprises at least one of: the relevant time of the coupon, the type of the coupon, the denomination of the coupon, the use condition of the coupon, the corresponding coupon withdrawal rule of the coupon and the state of the coupon.
10. A database operating system, comprising: a routing device and a plurality of servers connected to the routing device;
the routing equipment acquires a first query statement; the first query statement comprises a first object identifier to be queried;
the routing equipment determines a target server corresponding to the first object identifier to be queried in the plurality of servers according to the corresponding relation between the first object identifier and the servers; an index table and a detail table corresponding to the index table are stored in each server, the index table is used for indicating the mapping relation between a first object identifier and a second object identifier corresponding to the server, and the detail table is used for indicating the mapping relation between the second object identifier and detail information;
the routing device sends the first query statement to the target server;
the target server is configured to perform the database operating method according to any one of claims 1 to 9.
11. A database operating device, wherein the database operating device is provided in a target server, comprising:
the receiving module is used for receiving a first query statement sent by the routing equipment; the first query statement comprises a first object identifier to be queried, the routing equipment is connected with a plurality of servers including the target server, and the target server is a server corresponding to the first object identifier to be queried, which is determined by the routing equipment according to the corresponding relation between the first object identifier and the server; each server is stored with an index table and a detail table corresponding to the index table, the index table is used for indicating the mapping relation between a first object identifier corresponding to the server and a second object identifier, and the detail table is used for indicating the mapping relation between the second object identifier and detail information;
The first acquisition module is used for acquiring a target second object identifier corresponding to the first object identifier to be queried from an index table stored in the target server according to the first object identifier to be queried;
the second acquisition module is used for acquiring first target detail information corresponding to the target second object identifier from a detail table stored in the target server according to the target second object identifier;
the determining, according to the correspondence between the first object identifier and the server, the server corresponding to the first object identifier to be queried includes:
determining a corresponding server according to the data of the preset bit number at the tail part of the first object identifier;
the first query statement further includes: the related time of a target second object corresponding to the first object identification to be queried; the index table of the server comprises a plurality of sub-index tables, and each sub-index table is used for indicating the mapping relation of the first object identifier, the second object identifier and the related time of the second object corresponding to the server; the time ranges formed by the related time of the second object in different sub-index tables are different;
the first obtaining module is specifically configured to: determining a sub-index table corresponding to the first object identifier to be queried in an index table stored in the target server according to the first object identifier to be queried and the related time of the target second object; and acquiring a target second object identifier corresponding to the first object identifier to be queried from a sub-index table corresponding to the first object identifier to be queried.
12. A server, the server comprising:
one or more processors;
a memory for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the database operating method of any of claims 1 to 9.
13. A computer-readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the database operating method according to any one of claims 1 to 9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011613781.3A CN112685417B (en) | 2020-12-30 | 2020-12-30 | Database operation method, system, device, server and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011613781.3A CN112685417B (en) | 2020-12-30 | 2020-12-30 | Database operation method, system, device, server and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112685417A CN112685417A (en) | 2021-04-20 |
CN112685417B true CN112685417B (en) | 2024-04-05 |
Family
ID=75455353
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011613781.3A Active CN112685417B (en) | 2020-12-30 | 2020-12-30 | Database operation method, system, device, server and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112685417B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113205361A (en) * | 2021-04-30 | 2021-08-03 | 携程商旅信息服务(上海)有限公司 | Management method, management system, electronic device and storage medium of electronic coupon |
CN115712664A (en) * | 2023-01-10 | 2023-02-24 | 无锡容智技术有限公司 | Method and system for screening cases according to time frame based on log data |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9449008B1 (en) * | 2014-03-31 | 2016-09-20 | Amazon Technologies, Inc. | Consistent object renaming in distributed systems |
CN108694218A (en) * | 2017-04-12 | 2018-10-23 | 大唐移动通信设备有限公司 | A kind of method and apparatus data write-in and read |
CN110276002A (en) * | 2019-06-26 | 2019-09-24 | 浙江大搜车软件技术有限公司 | Search for application data processing method, device, computer equipment and storage medium |
CN110879819A (en) * | 2019-11-20 | 2020-03-13 | 北京明略软件系统有限公司 | Method, device, server and storage medium for quickly and accurately identifying routing information |
CN111814020A (en) * | 2020-06-23 | 2020-10-23 | 五八有限公司 | Data acquisition method and device |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7725459B2 (en) * | 2005-12-01 | 2010-05-25 | International Business Machines Corporation | Method and apparatus for manipulating data within a remote database in a multiple tier environment |
-
2020
- 2020-12-30 CN CN202011613781.3A patent/CN112685417B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9449008B1 (en) * | 2014-03-31 | 2016-09-20 | Amazon Technologies, Inc. | Consistent object renaming in distributed systems |
CN108694218A (en) * | 2017-04-12 | 2018-10-23 | 大唐移动通信设备有限公司 | A kind of method and apparatus data write-in and read |
CN110276002A (en) * | 2019-06-26 | 2019-09-24 | 浙江大搜车软件技术有限公司 | Search for application data processing method, device, computer equipment and storage medium |
CN110879819A (en) * | 2019-11-20 | 2020-03-13 | 北京明略软件系统有限公司 | Method, device, server and storage medium for quickly and accurately identifying routing information |
CN111814020A (en) * | 2020-06-23 | 2020-10-23 | 五八有限公司 | Data acquisition method and device |
Also Published As
Publication number | Publication date |
---|---|
CN112685417A (en) | 2021-04-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11157445B2 (en) | Indexing implementing method and system in file storage | |
EP2863310B1 (en) | Data processing method and apparatus, and shared storage device | |
US20190026042A1 (en) | Deduplication-Aware Load Balancing in Distributed Storage Systems | |
US20160364407A1 (en) | Method and Device for Responding to Request, and Distributed File System | |
US20160350302A1 (en) | Dynamically splitting a range of a node in a distributed hash table | |
CN112084258A (en) | Data synchronization method and device | |
CN103019960A (en) | Distributed cache method and system | |
CN111722918A (en) | Service identification code generation method and device, storage medium and electronic equipment | |
CN112685417B (en) | Database operation method, system, device, server and storage medium | |
CN112307119A (en) | Data synchronization method, device, equipment and storage medium | |
CN104423982A (en) | Request processing method and device | |
CN113760847A (en) | Log data processing method, device, equipment and storage medium | |
US10747773B2 (en) | Database management system, computer, and database management method | |
CN104951475B (en) | Distributed file system and implementation method | |
CN107493309B (en) | File writing method and device in distributed system | |
CN107181773A (en) | Data storage and data managing method, the equipment of distributed memory system | |
CN111625617A (en) | Data indexing method and device and computer readable storage medium | |
CN111046106A (en) | Cache data synchronization method, device, equipment and medium | |
CN109522311B (en) | Data storage method, device, server and storage medium | |
CN110798358B (en) | Distributed service identification method and device, computer readable medium and electronic equipment | |
CN108306976B (en) | SDN controller architecture used in cloud computing network virtualization | |
KR20180095004A (en) | High Throughput, High Reliability Data Processing System | |
CN104391931A (en) | Method for efficiently indexing mass data in cloud computing | |
CN105653566A (en) | Method and apparatus realizing database writing and visiting | |
CN115129779A (en) | Database synchronization method, device and readable medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: Room 221, 2 / F, block C, 18 Kechuang 11th Street, Daxing District, Beijing, 100176 Applicant after: Jingdong Technology Holding Co.,Ltd. Address before: Room 221, 2 / F, block C, 18 Kechuang 11th Street, Daxing District, Beijing, 100176 Applicant before: Jingdong Digital Technology Holding Co.,Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant |