WO2021057253A1 - Data separation and storage method and apparatus, computer device and storage medium - Google Patents

Data separation and storage method and apparatus, computer device and storage medium Download PDF

Info

Publication number
WO2021057253A1
WO2021057253A1 PCT/CN2020/105962 CN2020105962W WO2021057253A1 WO 2021057253 A1 WO2021057253 A1 WO 2021057253A1 CN 2020105962 W CN2020105962 W CN 2020105962W WO 2021057253 A1 WO2021057253 A1 WO 2021057253A1
Authority
WO
WIPO (PCT)
Prior art keywords
database
data
period
target user
user
Prior art date
Application number
PCT/CN2020/105962
Other languages
French (fr)
Chinese (zh)
Inventor
杨念磊
叶国华
司孝波
杨盈
李钥珑
Original Assignee
苏宁云计算有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 苏宁云计算有限公司 filed Critical 苏宁云计算有限公司
Priority to CA3156068A priority Critical patent/CA3156068A1/en
Publication of WO2021057253A1 publication Critical patent/WO2021057253A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/214Database migration support
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2477Temporal data queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems

Definitions

  • This application relates to the field of data storage technology, and in particular, to a data separation storage method, device, computer equipment, and storage medium.
  • the server can provide services for multiple different users, and for each user, save the user data of the user.
  • the number of pieces of user data tends to be large, making the total amount of data too large, and data with a large amount of data often needs to be split.
  • the traditional data splitting scheme of user data is to split the database and tables according to the user dimension, and split the user data of all users into multiple databases.
  • the existing database needs to be split into two.
  • the A database is split into the A1 database and the A2 database, and then the redundant data in the A1 and A2 databases are deleted.
  • all user data of the same user still exists together, and the existence of a large amount of cold data will cause the storage and query of hot data to increase time-consuming, and affect the use of hot data. Therefore, effective processing and storage of hot and cold data is becoming more and more important.
  • the traditional method of separating hot and cold data is based on the heat value of the data.
  • the calculation of the heat value needs to consider many factors such as the visit start time, the visit end time, the amount of visits, and the length of unit time. Not only is the calculation method more complicated, but also due to The amount of visits needed is only suitable for the separation of historical data with visits. It is not suitable for the direct separation of newly generated data. The separation and storage of newly generated data has a lag.
  • a data separation storage method includes: acquiring each piece of user data of a target user; respectively determining the generation time period of each piece of user data of the target user; according to the period of each generation time, dividing each piece of the target user Pieces of user data are stored separately in multiple databases.
  • the above method further includes: requesting to allocate a current period database, a historical database, a first database, and a second database to the target user; Separately stored in multiple databases, including: according to the period of each generation time, separate and store each piece of user data of the target user into the current period database, the historical database, the first database and the second database; among them, the current period database It is used to store the user data whose generation time of the target user is in the current cycle, the historical database is used to store the user data whose generation time of the target user is in the historical period, and the first database is used to store the generation time of the target user.
  • the processing period is the user data of the current period and the previous period, and the second database is used to store the user data of the current period and the next period in which the generation time of the target user is located.
  • the aforementioned pieces of user data of the target user include newly generated data of the target user and pieces of historical data; the aforementioned pieces of user data of the target user are stored separately and stored in the current period according to the period of each generation time.
  • the period database, the historical database, the first database and the second database include: storing the newly generated data of the target user in the current period database, the first database and the second database respectively; according to the generation of each piece of historical data of the target user When the time is in the cycle, each piece of historical data of the target user is stored separately in the current cycle database, the historical database and the first database.
  • the above-mentioned storing the newly generated data of the target user in the current period database, the first database and the second database respectively includes: writing the newly generated data of the target user into the current period database; The newly generated data of the user is written into the operation log generated by the current periodic database, and the newly generated data of the target user is written into the first database and the second database in an asynchronous manner.
  • the above method further includes: before entering the next period, requesting to allocate a new current period database and a new second database for the target user; after entering the next period, assigning the target user corresponding to the current period
  • the data in the current cycle database of the target user is migrated to the historical database of the target user, and the second database corresponding to the current cycle of the target user is used as the new first database of the target user; after the data migration is completed, the current cycle corresponding to the target user is destroyed The current period database of the target user, and the first database corresponding to the current period of the target user.
  • the above method further includes: segmenting the user data according to the user dimension, and the user data of each segmented user after the segmentation processing is used as each piece of user data of the target user.
  • the above method further includes:
  • the generation period information of the user data to be modified When receiving the user data modification request of the target user, query the generation period information of the user data to be modified; when the period determined according to the queried generation period information is the current period, route the user data modification request to the current period corresponding to the target user
  • the database performs data modification; when the period determined according to the queried generation period information is a historical period, the user data modification request is routed to the historical database corresponding to the target user for data modification;
  • the query type is determined according to the query conditions carried in the query request; when the query type is a periodical query, if the query period determined according to the query conditions is the current period, the user data query request Route to the current period database corresponding to the target user for data query.
  • the user data query request is routed to the historical database corresponding to the target user for data query; when the query type is query by time period At the time, the start time and end time corresponding to the query period determined according to the query conditions; according to the start time and end time, determine the target database of the target user that matches the start time and end time, and route the user data query request to the target The database performs data query.
  • a data separation storage device which includes:
  • the data acquisition module is used to acquire various pieces of user data of the target user
  • the period determination module is used to respectively determine the period in which the generation time of each piece of user data of the target user is located;
  • the separate storage module is used to separate and store each piece of user data of the target user into multiple databases according to the cycle of each generation time.
  • a computer device includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor.
  • the processor implements the following steps when the processor executes the computer program:
  • each piece of user data of the target user is stored separately in multiple databases.
  • the computer program is executed by a processor, the following steps are implemented:
  • each piece of user data of the target user is stored separately in multiple databases.
  • the above-mentioned data separation storage method, device, computer equipment and storage medium are to obtain each piece of user data of the target user, respectively determine the period in which each piece of user data of the target user is generated, and according to the period in which the generation time is located, Each piece of user data of the target user is stored separately in multiple databases.
  • each piece of user data of the target user is stored separately based on the period of the generation time, it is only necessary to determine the corresponding period according to the generation time of each piece of user data, which simplifies the calculation method.
  • the newly generated data can also be separated and stored directly according to the embodiment of the application to avoid the hysteresis of the separation and storage of the newly generated data.
  • the physical separation of hot and cold data can be achieved.
  • Figure 1 is an application environment diagram of a data separation storage method in an embodiment
  • FIG. 2 is a schematic flowchart of a method for data separation and storage in an embodiment
  • FIG. 3 is a detailed flowchart of the data separation and storage step in an embodiment
  • FIG. 4 is a detailed flow diagram of a step of storing newly generated data in an embodiment
  • FIG. 5 is a schematic flowchart of a data separation and storage step in another embodiment
  • FIG. 6 is an example diagram of data separation and storage for two consecutive weeks in an embodiment
  • FIG. 7 is a structural block diagram of a data separation storage device in an embodiment
  • Fig. 8 is an internal structure diagram of a computer device in an embodiment.
  • first, second, etc. used in this application can be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from another element.
  • first client may be referred to as the second client, and similarly, the second client may be referred to as the first client. Both the first client and the second client are clients, but they are not the same client.
  • or/and used in this application describes the association relationship of associated objects, indicating that there can be three types of relationships, for example, A or/and B can mean that A alone exists, and both A and A exist at the same time. B, there are three cases of B alone.
  • the character "/" generally indicates that the associated objects before and after are in an "or” relationship.
  • the following takes order data storage as an example to illustrate the problems existing in the prior art.
  • the traditional order data splitting scheme is that the order data is divided into database and table according to the member dimension, and the order data of all members is split into multiple (for example, 32) databases.
  • the data grows to the limited capacity of the database, it is required Split the existing database into two.
  • the data for all time periods of the same member still exists together.
  • 90% of the user's access to the data basically falls in the hot data of the most recent period of time (such as the last 1-2 years), and the existence of a large amount of cold data will cause
  • the storage and query time of hotspot data increases, which affects the use of hotspot data.
  • the data separation storage method provided in this application can be applied to the application environment as shown in FIG. 1.
  • the application environment includes a terminal 102, a network 104, a server 106, and a database device 108.
  • the terminal 102, the server 106 and the database device 108 can all be connected through the network 104 for communication.
  • the network system composed of the terminal 102, the network 104, the server 106, and the database device 108 may be based on the Internet, or a local area network, or a combined network of the Internet and a local area network, which will not be repeated here.
  • the terminal 102 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices.
  • FIG. 1 shows a case where the number of terminals 102 is two, but this application does not limit the number of terminals 102, and it may also include more or less terminals.
  • An application program runs on the terminal 102, and the application program may be a shopping application, a communication application, or other applications.
  • the database device 108 includes multiple databases or database clusters.
  • the network 104 is used to implement the network connection between the terminal 102 and the server 106, the server 106 and the database device 108, etc., and may include multiple types of wired or wireless networks.
  • the network 104 may include the Internet, a local area network ("LAN”), a wide area network ("WAN"), an intranet, a mobile phone network, a virtual private network (VPN), a cellular or other mobile communication network, Bluetooth, NFC, or any combination thereof .
  • the data transmission on the network 104 is also based on the corresponding communication protocol. For example, when the web browser receives the corresponding service code of the webpage, it will be based on the HTTP communication protocol, and the service code received by the mobile application may be based on the Websocket communication protocol.
  • the server 106 may be implemented as an independent server or a server cluster composed of multiple servers. During the running process, the server 106 can obtain each piece of user data of the target user, respectively determine the period of the generation time of each piece of user data of the target user, and according to the period of each generation time, the target user Each piece of user data is stored separately in multiple databases. In this way, the cold and hot data can be separated.
  • a data separation storage method is provided. Taking the method applied to the server in FIG. 1 as an example for description, the method includes the following steps:
  • Step 202 Obtain various pieces of user data of the target user.
  • the target users may be users of the sales platform, specifically all users of the sales platform, or some users of the sales platform, for example, a part of users selected from all users of the sales platform.
  • the target user can also be other types of platform users.
  • user data may include order data.
  • the number of target users can be one or more.
  • the server may obtain various pieces of user data of the target user from historical data and current data.
  • the current data may be newly generated data or data generated in the current cycle.
  • Step 204 respectively determine the period in which the generation time of each piece of user data of the target user is located;
  • the period in which the generation time is located refers to the period in which the generation time is located.
  • the division method of the cycle can be set according to the actual situation, for example, divided by year, divided by month, or divided by day, etc.
  • For the division by year it can be a cycle per year, or it can be a cycle per multiple years, by month Division or division by day is equivalent.
  • the server may query the generation time of each piece of user data of the target user, and determine the period of the generation time of each piece of user data of the target user according to the generation time of each piece of user data that is queried.
  • the accuracy of the generation time that is queried can be determined according to the period division method, for example, if it is divided by year, only the generation year information can be queried.
  • Step 206 Separately store each piece of user data of the target user into multiple databases according to the period of each generation time.
  • the number of databases can be determined according to actual needs.
  • the server can separate and store each piece of user data of the target user into multiple databases according to preset data separation rules according to the period of each generation time obtained in step 204, where the data separation rules can be based on actual conditions. It needs to be set.
  • the same piece of user data can be stored in only one database or in multiple databases as required.
  • each piece of user data of the target user is obtained, and the period of the generation time of each piece of user data of the target user is determined respectively, and the period of each piece of user data of the target user is determined according to the period of the generation time.
  • each piece of user data of the target user is stored separately based on the period of the generation time, it is only necessary to determine the corresponding period according to the generation time of each piece of user data, which simplifies the calculation method, and at the same time
  • each piece of user data of the target user is stored separately according to the period of each generation time In multiple different databases, the physical separation of hot and cold data can be achieved, which can reduce the time-consuming storage and query of hot data, and avoid or reduce the impact of cold data on the use of hot data.
  • the data separation storage method of the present application may further include the steps of: requesting to allocate the current period database, historical database, first database, and second database to the target user; the above-mentioned target users are allocated according to the period of each generation time.
  • the step of storing each piece of user data of the user separately into multiple databases may include the step of: according to the period of each generation time, each piece of user data of the target user is separately stored in the current period database, the historical database, the first database and The second database; where the current period database is used to store user data whose target user’s generation time is in the current period, and the historical database is used to store user data whose target user’s generation time is in the historical period.
  • the first The database is used to store the user data of the current period and the previous period in which the generation time of the target user is in the period
  • the second database is used to store the user data in the current period and the next period in which the generation time of the target user is in the period.
  • the historical period is the period corresponding to the generation time of the first user data of the target user to the previous period.
  • the previous period, the current period and the next period are three periods immediately adjacent in time. Over time, the expression of the same period can also be different. For example, in 2019, 2018, 2019, and 2020 are the previous cycle, the current cycle, and the next cycle, respectively, and in 2020, 2019 is the previous cycle.
  • the order data of the same user is distributed in 4 databases: historical order database, current year order database, previous year and current year order database, and next year and The current year order database.
  • the previous year is the year minus 1 from the current year
  • the next year is the year plus 1 from the current year.
  • the historical order database, the current year order database, the previous year and current year order database, and the next year and current year order database are respectively equivalent to the aforementioned historical database, current period database, first database and second database.
  • each piece of user data of the target user is separately stored in the current period database, the historical database, the first database, and the second database, which realizes the isolated storage of hot and cold user data.
  • the current cycle database since the current cycle database, the historical database and the first database respectively store user data whose generation time is in the current cycle, user data whose generation time is in the historical cycle, and the generation time is in the current cycle.
  • operations on hot data can be routed to the current period database or the first database for operations, which can improve the processing efficiency of hot data.
  • the current period database, the first database and the second database all store the user data of the current period
  • the first database and the second database are also used to store the user data of the previous period and the user data of the next period, respectively.
  • a cycle change occurs (for example, entering the next cycle)
  • the data in the current cycle database is migrated to the historical database and the identity of the second database is changed, that is, the second database is changed to the first database without discarding this
  • Two databases that is, when a periodic change occurs, the number of abandoned databases is small, which can improve the efficiency of the change and improve the time continuity of the solution.
  • the aforementioned pieces of user data of the target user may include the newly generated data of the target user and various pieces of historical data; as shown in FIG. 3, the aforementioned pieces of user data of the target user are changed according to the period of each generation time.
  • the step of storing the pieces of user data separately in the current period database, the historical database, the first database and the second database may include the following steps:
  • Step 302 Store the newly generated data of the target user in the current period database, the first database and the second database respectively;
  • Step 304 Separately store each piece of historical data of the target user in the current period database, the historical database and the first database according to the period in which each piece of historical data of the target user is generated.
  • the newly generated data can be directly stored, that is, there is no need to determine the period of the generation time, and the efficiency of data separation and storage can be improved.
  • the step of storing the newly generated data of the target user in the current period database, the first database, and the second database, respectively, may include the following steps:
  • Step 402 Write the newly generated data of the target user into the current cycle database
  • Step 404 Write the newly generated data of the target user into the operation log generated by the current periodic database, and write the newly generated data of the target user into the first database and the second database in an asynchronous manner.
  • the server can write the newly generated data of the target user into the current cycle database.
  • an operation log is generated.
  • the operation log is generally a binary log (binlog).
  • the operation log can be parsed in an asynchronous manner, and the newly generated data of the target user will be inserted into the first database and the second database according to the result of the analytic processing, so that it does not affect the data processing flow based on the newly generated data, such as user orders The submission process.
  • a data separation storage method is provided.
  • the method is applied to the server in FIG. 1 as an example for description.
  • the data separation storage method in this embodiment The method includes the following steps in addition to the above-mentioned step 202, step 204, and step 206:
  • Step 502 before entering the next cycle, request to allocate a new current cycle database and a new second database to the target user;
  • Step 504 After entering the next cycle, migrate the data in the current cycle database of the target user corresponding to the current cycle to the historical database of the target user, and use the second database corresponding to the current cycle of the target user as the new first database of the target user.
  • a database
  • Step 506 After the data migration is completed, destroy the current period database corresponding to the current period of the target user and the first database corresponding to the current period of the target user.
  • the solution of this embodiment has very good time scalability for a database with a rapidly growing data volume, and can be implemented infinitely extended.
  • the data separation and storage method in an embodiment may further include the step of fragmenting user data according to the user dimension, and the user data of each fragmented user after the fragmentation processing is used as each piece of user data of the target user.
  • the order data of all members is divided into n segments according to the member dimension, where n is a positive integer, and the size can be set according to actual needs.
  • Multiple pieces of user data of the same user are generally in the same shard, that is to say, the order data of all members is divided into multiple groups according to the members, and the user data of each group of users can be used as the pieces of user data of the target user, according to the above implementation.
  • each shard user can correspond to the above-mentioned multiple (four) databases, and the user data of different shard users can be separated and stored in parallel, which can further reduce the storage and storage of hot data.
  • the query is time consuming.
  • the data separation storage method in one embodiment may further include the steps of: when a user data modification request of the target user is received, query the generation period information of the user data to be modified; when the period determined according to the queried generation period information is the current period When the user data modification request is routed to the current period database corresponding to the target user for data modification; when the period determined according to the queried generation period information is a historical period, the user data modification request is routed to the historical database corresponding to the target user for data modification. Data modification.
  • the generation period information refers to the period information of the generation time, that is, the period in which the generation time is located.
  • the user data to be modified can be determined according to the user data modification request.
  • different user data modification requests are routed to the current period database or historical database for data modification, and the modification of cold and hot data can be processed separately, which can improve processing efficiency.
  • the data separation storage method in one embodiment may further include the step of: when a user data query request from a target user is received, the query type is determined according to the query conditions carried in the query request; when the query type is a periodic query, if the query is based on the query If the query period determined by the condition is the current period, the user data query request is routed to the current period database corresponding to the target user for data query.
  • the user data query request is routed to the target user Corresponding historical database for data query; when the query type is query by time period, the start time and end time corresponding to the query period determined according to the query conditions; according to the start time and end time, it is determined to match the start time and end time
  • the user data query request is routed to the target database for data query.
  • the step of determining the target database of the target user matching the start time and the end time according to the start time and the end time may specifically include the step of detecting whether the start time and the end time both fall within the current target user's Period database or historical database corresponding to the time period; if yes, determine the current period database or historical database as the target database; if not, check whether the start time and end time both fall in the first database of the target user, if yes, Then the first database is determined as the target database; if not, the historical database and the current database are used as the target database.
  • query in a single database is preferred, and cross-database query is performed when a single database cannot match the start time and end time, so that cross-database queries can be avoided as much as possible, and the response efficiency to user data query requests can be improved as much as possible .
  • the query period can be split into two sub-query periods that match the historical database and the current database. Based on these two sub-query periods, data queries are performed on the corresponding historical database and the current database respectively, and you will get The two query results are aggregated to obtain the final data query result.
  • the data separation storage method in this embodiment includes the following steps:
  • Step 1 Divide into n segments according to the member dimension, and split the full amount of order data according to the members of each segment.
  • the number of members in each shard can be equal or unequal.
  • all members are first divided into n segments according to the member dimension, and then the full amount of order data is split according to the members of each segment, so that multiple pieces of order data of the same member are in the same segment.
  • Step 2 For each shard, apply for four databases: history database, now database, before&now database and now&after database.
  • the history database refers to the historical order database
  • the now database refers to the database of orders in the current year
  • the before&now database refers to the database of current year-1 (that is, the previous year) and the current year's orders
  • the now&after database refers to the current year&current year+1 (That is, the database of orders for the next year.
  • the history database, now database, before&now database, and now&after database are respectively equivalent to the history database, current period database, first database, and second database in the foregoing embodiment.
  • Step 3 Define data storage routing rules, which are used to instruct the service program in the server to read and write the corresponding database;
  • the data storage routing rules may include new order storage rules, historical order modification rules, and order query rules.
  • New order storage rule the year when the order is placed is the current year, routed to the now database for storage;
  • Historical order modification rules query the year of placing the historical order, if it is the current year, route to the now database for modification; if it is a historical year, route to the history database for modification;
  • Order query rules If query by year, query the current year, route to the now database query, query the history year, route to the history database query; if the query condition is a time period, that is, the start time to the end time, if the time period corresponds to the now database The time period is routed to the now database for query. If the time period is in the period corresponding to the before&now database, it is routed to the before&now database for query. If the time period is in the period corresponding to the history database, it is routed to the history database for query.
  • the solution of this embodiment is to consider the externally provided query service, which generally involves requests in the last three months/six months/a certain year, and therefore does not involve a scenario where results are aggregated across two databases.
  • cross-database queries can also be performed according to actual needs.
  • Step 4 Establish an asynchronous association writing mechanism among the now database, before&now database and now&after database;
  • the database binary log analysis component RDRS can be used to write all operations of the now database into the before&now database and the now&after database to ensure the consistency of the current data in the three databases.
  • a historical order database 18+19 year order database, 19 year database, and 19+20 year order data are applied for a sharded user.
  • Historical orders The database is used to store the order data of the corresponding user from the start time to the end of 2018, the 18+19 order database is used to store the order data of the corresponding user in 2018 and 2019, and the 19+20 order database It is used to store the order data of the corresponding user in 2019 and 2020.
  • the order data generated on the terminal application is stored in these four databases according to the year of production.
  • the historical order data is stored in the historical order database, the 18+19 year order database or the 19 year database according to the year of production, 2019
  • the newly generated data of the year is stored in the 19 year database, and is stored in the 18+19 year order database and 19 year order database in an asynchronous manner according to the asynchronous association write mechanism of the 18+19 year order database, the 19 year database and the 19+20 year order database. +20 years of order database.
  • Step 5 Preparation before the new switching cycle
  • Step 7 Clean up redundant data
  • a data separation storage device including: a data acquisition module 702, a period determination module 704, and a separation storage module 706, wherein:
  • the data acquisition module 702 is used to acquire various pieces of user data of the target user;
  • the period determining module 704 is used to determine the period in which the generation time of each piece of user data of the target user is located;
  • the separate storage module 706 is used to separate and store each piece of user data of the target user into multiple databases according to the period of each generation time.
  • the data separation storage device of the present application may further include: a database allocation request module (not shown in the figure), the database allocation request module is used to request the target user to allocate the current period database, historical database, first Database and the second database; the separate storage module 706 can separate and store each piece of user data of the target user into the current period database, the historical database, the first database and the second database according to the period of each generation time; among them, the current period
  • the database is used to store the user data whose generation time of the target user is in the current period
  • the historical database is used to store the user data whose generation time is the target user in the historical period
  • the first database is used to store the generation time of the target user
  • the period is the user data of the current period and the previous period
  • the second database is used to store the user data of the period in which the generation time of the target user is in the current period and the next period.
  • the aforementioned pieces of user data of the target user may include newly generated data of the target user and various pieces of historical data; the separate storage module 706 may store the newly generated data of the target user in the current period database and the first In the database and the second database, each piece of historical data of the target user is separately stored in the current cycle database, the historical database and the first database according to the period in which each piece of historical data of the target user is generated.
  • the separate storage module 706 can write the newly generated data of the target user into the current cycle database, write the newly generated data of the target user into the operation log generated by the current cycle database, and send the target user asynchronously.
  • the newly generated data of is written into the first database and the second database.
  • the aforementioned database allocation request module may also be used to request the target user to allocate a new current period database and a new second database before entering the next period;
  • the data separation storage device of the present application may also include Data migration module (not shown in the figure), the data migration module is used to migrate the data in the current period database of the target user corresponding to the current period to the historical database of the target user after entering the next period.
  • the second database corresponding to the current cycle of the target user is used as the new first database of the target user.
  • the current cycle database corresponding to the current cycle of the target user and the first database corresponding to the current cycle of the target user are destroyed.
  • the data separation storage device of the present application may further include a user division module (not shown in the figure), and the user division module is used to perform fragmentation processing on user data according to the user dimension, and each segment after the fragmentation processing The user data of the segmented users are respectively used as the pieces of user data of the target user.
  • a user division module (not shown in the figure)
  • the user division module is used to perform fragmentation processing on user data according to the user dimension, and each segment after the fragmentation processing The user data of the segmented users are respectively used as the pieces of user data of the target user.
  • the data separation storage device of the present application may further include a first request routing module (not shown in the figure), and the first request routing module is configured to query the user data modification request of the target user.
  • the generation period information of the user data to be modified When the period determined according to the queried generation period information is the current period, the user data modification request is routed to the current period database corresponding to the target user for data modification.
  • the period determined by the information is a historical period, the user data modification request is routed to the historical database corresponding to the target user for data modification.
  • the data separation storage device of the present application may further include a second request routing module (not shown in the figure), and the second request routing module is configured to receive a user data query request from a target user according to the query
  • the query condition carried in the request determines the query type; when the query type is a cycle query, if the query cycle determined according to the query condition is the current cycle, the user data query request is routed to the current cycle database corresponding to the target user for data query, If the query period determined according to the query conditions is a historical period, the user data query request is routed to the historical database corresponding to the target user for data query; when the query type is query by period, the start of the query period determined according to the query conditions Time and end time: According to the start time and end time, determine the target database of the target user that matches the start time and end time, and route the user data query request to the target database for data query.
  • the data separation storage device of the present application may further include the above-mentioned first request routing module and second request routing module.
  • Each module in the above-mentioned data separation storage device can be implemented in whole or in part by software, hardware, and a combination thereof.
  • the above-mentioned modules may be embedded in the form of hardware or independent of the processor in the computer equipment, or may be stored in the memory of the computer equipment in the form of software, so that the processor can call and execute the operations corresponding to the above-mentioned modules.
  • a computer device is provided.
  • the computer device may be a server, and its internal structure diagram may be as shown in FIG. 8.
  • the computer equipment includes a processor, a memory, and a network interface connected through a system bus.
  • the processor of the computer device is used to provide calculation and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system, a computer program, and a database.
  • the internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • the computer program is executed by the processor to realize a data separation storage method.
  • FIG. 8 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied.
  • the specific computer device may Including more or fewer parts than shown in the figure, or combining some parts, or having a different arrangement of parts.
  • a computer device including a memory, a processor, and a computer program stored in the memory and running on the processor.
  • the processor executes the computer program, the following steps are implemented: Obtain various items of a target user User data; respectively determine the period in which each piece of user data of the target user is generated; according to the period of each generation time, separate and store each piece of user data of the target user into multiple databases.
  • the processor further implements the following steps when executing the computer program: requesting to allocate the current cycle database, historical database, first database, and second database to the target user;
  • the following steps are specifically implemented: according to the period of each generation time, the user data of the target user is separated and stored in the current period database, In the historical database, the first database and the second database; among them, the current period database is used to store the user data of the target user's generation time period as the current period, and the historical database is used to store the target user's generation time period as the history Periodic user data.
  • the first database is used to store the target user’s generation time in the current period and user data in the previous period.
  • the second database is used to store the target user’s generation time in the current period and the next period. Periodic user data.
  • each piece of user data of the target user mentioned above includes newly generated data of the target user and various pieces of historical data; the processor executes the computer program to realize the above-mentioned pieces of user data of the target user according to the period of each generation time.
  • the following steps are specifically implemented: store the newly generated data of the target user in the current period database, the first database and the second database, respectively Middle; According to the period in which each piece of historical data of the target user is generated, separate and store each piece of historical data of the target user into the current period database, the historical database and the first database.
  • the processor executes the computer program to implement the above-mentioned step of storing the newly generated data of the target user in the current period database, the first database and the second database respectively, the following steps are specifically implemented:
  • the generated data is written into the current cycle database;
  • the processor further implements the following steps when executing the computer program: before entering the next cycle, requesting the target user to be allocated a new current cycle database and a new second database; after entering the next cycle, the current The data in the current period database of the target user corresponding to the period is migrated to the historical database of the target user, and the second database corresponding to the current period of the target user is taken as the new first database of the target user; after the data migration is completed, the target is destroyed The current period database corresponding to the current period of the user, and the first database corresponding to the current period of the target user.
  • the processor further implements the following steps when executing the computer program: user data is segmented according to the user dimension, and the user data of each segmented user after the segmentation processing is used as each piece of user data of the target user.
  • the processor further implements the following steps when executing the computer program: when receiving the user data modification request of the target user, query the generation period information of the user data to be modified; and the period determined according to the queried generation period information is In the current cycle, the user data modification request is routed to the current cycle database corresponding to the target user for data modification; when the cycle determined according to the queried generation cycle information is a historical cycle, the user data modification request is routed to the history corresponding to the target user The database performs data modification.
  • the processor further implements the following steps when executing the computer program: when receiving the user data query request of the target user, the query type is determined according to the query conditions carried in the query request; when the query type is a periodic query, if If the query period determined according to the query conditions is the current period, the user data query request is routed to the current period database corresponding to the target user for data query.
  • the user data query request is routed to The historical database corresponding to the target user performs data query; when the query type is query by time period, the start time and end time corresponding to the query period determined according to the query conditions; according to the start time and end time, determine the start time and end time The target database of the target user matching the time, the user data query request is routed to the target database for data query.
  • a computer-readable storage medium on which a computer program is stored.
  • the computer program is executed by a processor, the following steps are realized: each piece of user data of the target user is obtained; and each piece of the target user is determined respectively.
  • the period of the generation time of the user data; according to the period of each generation time, each piece of user data of the target user is stored separately in multiple databases.
  • the following steps are also implemented: request to allocate the current cycle database, historical database, first database, and second database to the target user; the computer program is executed by the processor to realize the above-mentioned generation according to each
  • the following steps are specifically implemented: According to the cycle of each generation time, the user data of the target user is separately stored in the current cycle Database, historical database, first database and second database; among them, the current period database is used to store the user data of the target user's generation time period, and the historical database is used to store the target user's generation time period User data of the historical period.
  • the first database is used to store the target user’s generation time in the current period and user data in the previous period.
  • the second database is used to store the target user’s generation time in the current period and the previous period. User data for the next cycle.
  • each piece of user data of the target user mentioned above includes newly generated data of the target user and various pieces of historical data; the computer program is executed by the processor to realize the above-mentioned period according to the generation time of each target user.
  • the following steps are specifically implemented: store the newly generated data of the target user in the current period database, the first database and the second database, respectively.
  • each piece of historical data of the target user is separately stored in the current cycle database, the historical database and the first database.
  • the computer program when executed by the processor to realize the above-mentioned steps of storing the newly generated data of the target user in the current period database, the first database and the second database, the following steps are specifically implemented:
  • the newly generated data is written into the current cycle database;
  • the following steps are also implemented: before entering the next cycle, requesting the target user to be allocated a new current cycle database and a new second database; after entering the next cycle, The data in the current cycle database of the target user corresponding to the current cycle is migrated to the historical database of the target user, and the second database corresponding to the current cycle of the target user is taken as the new first database of the target user; after the data migration is completed, it is destroyed The current period database corresponding to the current period of the target user, and the first database corresponding to the current period of the target user.
  • user data is segmented according to the user dimension, and the user data of each segmented user after the segmentation processing is used as each piece of user data of the target user. .
  • the following steps are also implemented: upon receiving the user data modification request of the target user, query the generation period information of the user data to be modified; in the period determined according to the queried generation period information When it is the current period, the user data modification request is routed to the current period database corresponding to the target user for data modification; when the period determined according to the queried generation period information is the historical period, the user data modification request is routed to the target user corresponding Historical database for data modification.
  • the following steps are further implemented: when a user data query request from a target user is received, the query type is determined according to the query conditions carried in the query request; when the query type is a periodic query, If the query period determined according to the query conditions is the current period, the user data query request is routed to the current period database corresponding to the target user for data query, and if the query period determined according to the query conditions is the historical period, the user data query request is routed Query data in the historical database corresponding to the target user; when the query type is query by time period, the start time and end time corresponding to the query period determined according to the query conditions; according to the start time and end time, determine the start time and the end time The target database of the target user whose end time matches, the user data query request is routed to the target database for data query.
  • Non-volatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory may include random access memory (RAM) or external cache memory.
  • RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Channel (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

Abstract

A data separation and storage method and apparatus, a computer device and a storage medium. The method comprises: obtaining each piece of user data of a target user (S202); respectively determining a period in which the generation time of each piece of user data of the target user is (S204); and separating and storing these pieces of user data of the target user into a plurality of databases according to the period of each generation time (S206). By using the method, cold and hot data can be separated, the calculation approach can be simplified, and the hysteresis of separation and storage of newly generated data can be avoided.

Description

数据分离存储方法、装置、计算机设备和存储介质Data separation storage method, device, computer equipment and storage medium 技术领域Technical field
本申请涉及数据存储技术领域,特别是涉及一种数据分离存储方法、装置、计算机设备和存储介质。This application relates to the field of data storage technology, and in particular, to a data separation storage method, device, computer equipment, and storage medium.
背景技术Background technique
随着计算机技术和互联网技术的迅速发展,用户可以很容易地接入互联网,并通过与互联网上的服务器进行业务交互,获得服务器提供的各类服务。服务器可以为多个不同的用户提供服务,并针对每个用户,保存该用户的用户数据。对于一些服务器的一些用户,其用户数据的数据条数往往会较多,使得总的数据量过大,针对数据量大的数据往往需要进行数据拆分。With the rapid development of computer technology and Internet technology, users can easily access the Internet and interact with servers on the Internet to obtain various services provided by the servers. The server can provide services for multiple different users, and for each user, save the user data of the user. For some users of some servers, the number of pieces of user data tends to be large, making the total amount of data too large, and data with a large amount of data often needs to be split.
传统的用户数据的数据拆分方案是按照用户维度分库分表,将所有用户的用户数据拆分到多个数据库。当数据增长到数据库的限制容量后,需要将现有数据库拆分,一分为二,例如A数据库拆分为A1数据库和A2数据库,然后再将A1数据库和A2数据库中多余的数据删除。然而,同一用户的所有用户数据仍存在一起,大量的冷数据存在,会造成热点数据的存储和查询耗时增加,影响了热点数据的使用。因此,对冷热数据的有效处理和存储愈发重要。The traditional data splitting scheme of user data is to split the database and tables according to the user dimension, and split the user data of all users into multiple databases. When the data grows to the limited capacity of the database, the existing database needs to be split into two. For example, the A database is split into the A1 database and the A2 database, and then the redundant data in the A1 and A2 databases are deleted. However, all user data of the same user still exists together, and the existence of a large amount of cold data will cause the storage and query of hot data to increase time-consuming, and affect the use of hot data. Therefore, effective processing and storage of hot and cold data is becoming more and more important.
传统的冷热数据分离方式是基于数据的热度值进行分离,其热度值的计算需要考虑访问开始时间、访问结束时间、访问量和单位时间长度等多种因素,不但计算方式较复杂,而且由于需要用到访问量,仅适合对有访问量的历史数据的分离,不适合对新生成数据的数据直接分离,新生成数据分离存储具有滞后性。The traditional method of separating hot and cold data is based on the heat value of the data. The calculation of the heat value needs to consider many factors such as the visit start time, the visit end time, the amount of visits, and the length of unit time. Not only is the calculation method more complicated, but also due to The amount of visits needed is only suitable for the separation of historical data with visits. It is not suitable for the direct separation of newly generated data. The separation and storage of newly generated data has a lag.
发明内容Summary of the invention
基于此,有必要针对上述技术问题,提供一种能够实现冷热数据分离,且能简化计算方式,并能够避免新生成数据分离存储滞后性的数据分离存储方法、装置、计算机设备和存储介质。Based on this, it is necessary to address the above technical problems to provide a data separation storage method, device, computer equipment, and storage medium that can realize cold and hot data separation, simplify calculation methods, and avoid the hysteresis of newly generated data separation and storage.
一种数据分离存储方法,所述方法包括:获取目标用户的各条用户数据;分别确定目标用户的各条用户数据的生成时间所处周期;根据各生成时间所处周期,将目标用户的各条用户数据分离存储到多个数据库中。A data separation storage method, the method includes: acquiring each piece of user data of a target user; respectively determining the generation time period of each piece of user data of the target user; according to the period of each generation time, dividing each piece of the target user Pieces of user data are stored separately in multiple databases.
在一个实施例中,上述的方法还包括:请求为目标用户分配当前周期数据库、历史数据库、第一数据库和第二数据库;上述的根据各生成时间所处周期,将目标用户的各条用户数据分离存储到多个数据库中,包括:根据各生成时间所处周期,将目标用户的各条用户数据分离存储到当前周期数据库、历史数据库、第一数据库和第二数据库中;其中,当前周期数据库用于存储目标用户的生成时间所处周期为当前周期的用户数据,历史数据库用于存储目标用户的生成时间所处周期为历史周期的用户数据,第一数据库用于存储目标用户的生成时间所处周期为当前周期以及上一周期的用户数据,第二数据库用于存储目标用户的生成时间所处周期为当前周期以及下一周期的用户数据。In one embodiment, the above method further includes: requesting to allocate a current period database, a historical database, a first database, and a second database to the target user; Separately stored in multiple databases, including: according to the period of each generation time, separate and store each piece of user data of the target user into the current period database, the historical database, the first database and the second database; among them, the current period database It is used to store the user data whose generation time of the target user is in the current cycle, the historical database is used to store the user data whose generation time of the target user is in the historical period, and the first database is used to store the generation time of the target user. The processing period is the user data of the current period and the previous period, and the second database is used to store the user data of the current period and the next period in which the generation time of the target user is located.
在一个实施例中,上述的目标用户的各条用户数据包括目标用户的新生成数据和各条历史数据;上述的根据各生成时间所处周期,将目标用户的各条用户数据分离存储到当前周期数据库、历史数据库、第一数据库和第二数据库中,包括:将目标用户的新生成数据分别存储到当前周期数据库、第一数据库和第二数据库中;按照目标用户的各条历史数据的生成时间所处周期,将目标用户的各条历史数据分离存储到当前周期数据库、历史数据库和第一数据库中。In one embodiment, the aforementioned pieces of user data of the target user include newly generated data of the target user and pieces of historical data; the aforementioned pieces of user data of the target user are stored separately and stored in the current period according to the period of each generation time. The period database, the historical database, the first database and the second database include: storing the newly generated data of the target user in the current period database, the first database and the second database respectively; according to the generation of each piece of historical data of the target user When the time is in the cycle, each piece of historical data of the target user is stored separately in the current cycle database, the historical database and the first database.
在一个实施例中,上述的将目标用户的新生成数据分别存储到当前周期数据库、第一数据库和第二数据库中,包括:将目标用户的新生成数据写入当前周期数据库中;根据将目标用户的新生成数据写入当前周期数据库产生的操作日志,并通过异步方式将目标用户的新生成数据写入第一数据库和第二数据库中。In one embodiment, the above-mentioned storing the newly generated data of the target user in the current period database, the first database and the second database respectively includes: writing the newly generated data of the target user into the current period database; The newly generated data of the user is written into the operation log generated by the current periodic database, and the newly generated data of the target user is written into the first database and the second database in an asynchronous manner.
在一个实施例中,上述的方法还包括:在进入下一周期之前,请求为目标用户分配新的当前周期数据库和新的第二数据库;在进入下一周期之后,将当前周期对应的目标用户的当前周期数据库中的数据,迁移到目标用户的历史数据库,将目标用户的当前周期对应的第二数据库作为目标用户的新的第一数据库;在数据迁移完成后,销毁目标用户的当前周期对应的当前周期数据库,以 及目标用户的当前周期对应的第一数据库。In one embodiment, the above method further includes: before entering the next period, requesting to allocate a new current period database and a new second database for the target user; after entering the next period, assigning the target user corresponding to the current period The data in the current cycle database of the target user is migrated to the historical database of the target user, and the second database corresponding to the current cycle of the target user is used as the new first database of the target user; after the data migration is completed, the current cycle corresponding to the target user is destroyed The current period database of the target user, and the first database corresponding to the current period of the target user.
在一个实施例中,上述的方法还包括:按照用户维度对用户数据进行分片处理,分片处理之后的各分片用户的用户数据分别作为目标用户的各条用户数据。In an embodiment, the above method further includes: segmenting the user data according to the user dimension, and the user data of each segmented user after the segmentation processing is used as each piece of user data of the target user.
在一个实施例中,上述的方法还包括:In an embodiment, the above method further includes:
接收到目标用户的用户数据修改请求时,查询待修改用户数据的生成周期信息;在根据查询到的生成周期信息确定的周期为当前周期时,将用户数据修改请求路由到目标用户对应的当前周期数据库进行数据修改;在根据查询到的生成周期信息确定的周期为历史周期时,将用户数据修改请求路由到目标用户对应的历史数据库进行数据修改;When receiving the user data modification request of the target user, query the generation period information of the user data to be modified; when the period determined according to the queried generation period information is the current period, route the user data modification request to the current period corresponding to the target user The database performs data modification; when the period determined according to the queried generation period information is a historical period, the user data modification request is routed to the historical database corresponding to the target user for data modification;
或者/和Or/and
接收到目标用户的用户数据查询请求时,根据查询请求所携带的查询条件确定查询类型;在查询类型是按周期查询时,若根据查询条件确定的查询周期为当前周期,则将用户数据查询请求路由到目标用户对应的当前周期数据库进行数据查询,若根据查询条件确定的查询周期为历史周期,则将用户数据查询请求路由到目标用户对应的历史数据库进行数据查询;在查询类型是按时段查询时,根据查询条件确定的查询时段对应的起始时间和结束时间;根据起始时间和结束时间,确定与起始时间和结束时间匹配的目标用户的目标数据库,将用户数据查询请求路由到目标数据库进行数据查询。When a user data query request from a target user is received, the query type is determined according to the query conditions carried in the query request; when the query type is a periodical query, if the query period determined according to the query conditions is the current period, the user data query request Route to the current period database corresponding to the target user for data query. If the query period determined according to the query conditions is a historical period, then the user data query request is routed to the historical database corresponding to the target user for data query; when the query type is query by time period At the time, the start time and end time corresponding to the query period determined according to the query conditions; according to the start time and end time, determine the target database of the target user that matches the start time and end time, and route the user data query request to the target The database performs data query.
一种数据分离存储装置,该装置包括:A data separation storage device, which includes:
数据获取模块,用于获取目标用户的各条用户数据;The data acquisition module is used to acquire various pieces of user data of the target user;
周期确定模块,用于分别确定目标用户的各条用户数据的生成时间所处周期;The period determination module is used to respectively determine the period in which the generation time of each piece of user data of the target user is located;
分离存储模块,用于根据各生成时间所处周期,将目标用户的各条用户数据分离存储到多个数据库中。The separate storage module is used to separate and store each piece of user data of the target user into multiple databases according to the cycle of each generation time.
一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时实现以下步骤:A computer device includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor. The processor implements the following steps when the processor executes the computer program:
获取目标用户的各条用户数据;Obtain various pieces of user data of the target user;
分别确定目标用户的各条用户数据的生成时间所处周期;Respectively determine the period in which each piece of user data of the target user is generated;
根据各生成时间所处周期,将目标用户的各条用户数据分离存储到多个数据库中。According to the cycle of each generation time, each piece of user data of the target user is stored separately in multiple databases.
一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:A computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
获取目标用户的各条用户数据;Obtain various pieces of user data of the target user;
分别确定目标用户的各条用户数据的生成时间所处周期;Respectively determine the period in which each piece of user data of the target user is generated;
根据各生成时间所处周期,将目标用户的各条用户数据分离存储到多个数据库中。According to the cycle of each generation time, each piece of user data of the target user is stored separately in multiple databases.
上述数据分离存储方法、装置、计算机设备和存储介质,是获取目标用户的各条用户数据,分别确定目标用户的各条用户数据的生成时间所处周期,根据各该生成时间所处周期,将目标用户的各条用户数据分离存储到多个数据库中。本申请实施例中,由于是基于生成时间所处周期对目标用户的各条用户数据进行分离存储,只需要根据各条用户数据的生成时间确定对应的所处周期即可,简化了计算方式,同时,对于新生成数据也可以直接按照本申请实施例方案进行分离存储,避免新生成数据分离存储的滞后性,而且,由于是根据各生成时间所处周期将目标用户的各条用户数据分离存储到多个不同数据库中,能够实现冷热数据物理上的分离。The above-mentioned data separation storage method, device, computer equipment and storage medium are to obtain each piece of user data of the target user, respectively determine the period in which each piece of user data of the target user is generated, and according to the period in which the generation time is located, Each piece of user data of the target user is stored separately in multiple databases. In the embodiment of the present application, since each piece of user data of the target user is stored separately based on the period of the generation time, it is only necessary to determine the corresponding period according to the generation time of each piece of user data, which simplifies the calculation method. At the same time, the newly generated data can also be separated and stored directly according to the embodiment of the application to avoid the hysteresis of the separation and storage of the newly generated data. Moreover, because each piece of user data of the target user is stored separately according to the period of each generation time In multiple different databases, the physical separation of hot and cold data can be achieved.
附图说明Description of the drawings
图1为一个实施例中数据分离存储方法的应用环境图;Figure 1 is an application environment diagram of a data separation storage method in an embodiment;
图2为一个实施例中数据分离存储方法的流程示意图;FIG. 2 is a schematic flowchart of a method for data separation and storage in an embodiment;
图3为一个实施例中的数据分离存储步骤的细化流程示意图;FIG. 3 is a detailed flowchart of the data separation and storage step in an embodiment;
图4为一个实施例中的新生成数据存储步骤的细化流程示意图;FIG. 4 is a detailed flow diagram of a step of storing newly generated data in an embodiment;
图5为另一个实施例中数据分离存储步骤的流程示意图;FIG. 5 is a schematic flowchart of a data separation and storage step in another embodiment;
图6为一个实施例中连续两周数据分离存储的示例图;6 is an example diagram of data separation and storage for two consecutive weeks in an embodiment;
图7为一个实施例中数据分离存储装置的结构框图;FIG. 7 is a structural block diagram of a data separation storage device in an embodiment;
图8为一个实施例中计算机设备的内部结构图。Fig. 8 is an internal structure diagram of a computer device in an embodiment.
具体实施方式detailed description
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions, and advantages of this application clearer, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application, and are not used to limit the present application.
可以理解,本申请所使用的术语“第一”、“第二”等可在本文中用于描述各种元件,但这些元件不受这些术语限制。这些术语仅用于将第一个元件与另一个元件区分。举例来说,在不脱离本申请的范围的情况下,可以将第一客户端称为第二客户端,且类似地,可将第二客户端称为第一客户端。第一客户端和第二客户端两者都是客户端,但其不是同一客户端。此外,可以理解,本申请所使用的术语“或者/和”,描述关联对象的关联关系,表示可以存在三种关系,例如,A或者/和B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或者”的关系。It can be understood that the terms "first", "second", etc. used in this application can be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from another element. For example, without departing from the scope of the present application, the first client may be referred to as the second client, and similarly, the second client may be referred to as the first client. Both the first client and the second client are clients, but they are not the same client. In addition, it can be understood that the term "or/and" used in this application describes the association relationship of associated objects, indicating that there can be three types of relationships, for example, A or/and B can mean that A alone exists, and both A and A exist at the same time. B, there are three cases of B alone. The character "/" generally indicates that the associated objects before and after are in an "or" relationship.
下面以订单数据存储为例,来说明现有技术存在的问题。传统的订单数据的拆分方案为是订单数据按照会员维度分库分表,将所有会员的订单数据拆分到多个(例如32个)数据库中,当数据增长到数据库的限制容量后,需要将现有数据库拆分,一分为二。但同一个会员的所有时间段内的数据仍存在一起,然而用户对数据的访问基本90%落在最近一段时间(例如最近1-2年)的热点数据中,而大量的冷数据存在,会造成热点数据的存储和查询耗时增加,影响了热点数据的使用。The following takes order data storage as an example to illustrate the problems existing in the prior art. The traditional order data splitting scheme is that the order data is divided into database and table according to the member dimension, and the order data of all members is split into multiple (for example, 32) databases. When the data grows to the limited capacity of the database, it is required Split the existing database into two. However, the data for all time periods of the same member still exists together. However, 90% of the user's access to the data basically falls in the hot data of the most recent period of time (such as the last 1-2 years), and the existence of a large amount of cold data will cause As a result, the storage and query time of hotspot data increases, which affects the use of hotspot data.
本申请提供的数据分离存储方法,可以应用于如图1所示的应用环境中。该应用环境中包括终端102、网络104、服务器106和数据库设备108,终端102服务器106和数据库设备108之间均可以通过网络104实现可通信的连接。该由终端102、网络104、服务器106和数据库设备108构成的网络系统可以是基于互联网,也可以基于局域网,还可以基于互联网和局域网的组合网,在此不做赘述。The data separation storage method provided in this application can be applied to the application environment as shown in FIG. 1. The application environment includes a terminal 102, a network 104, a server 106, and a database device 108. The terminal 102, the server 106 and the database device 108 can all be connected through the network 104 for communication. The network system composed of the terminal 102, the network 104, the server 106, and the database device 108 may be based on the Internet, or a local area network, or a combined network of the Internet and a local area network, which will not be repeated here.
终端102可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑和便携式可穿戴设备。同时,图1中示出的是终端102的数量为两个的情 况,但本申请并不对终端102的数量进行限制,也可以包括更多或者更少的终端。终端102上运行有应用程序,该应用程序可以是购物应用程序、通信应用程序或者其他应用程序。数据库设备108包括多个数据库或者数据库集群。The terminal 102 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices. At the same time, FIG. 1 shows a case where the number of terminals 102 is two, but this application does not limit the number of terminals 102, and it may also include more or less terminals. An application program runs on the terminal 102, and the application program may be a shopping application, a communication application, or other applications. The database device 108 includes multiple databases or database clusters.
网络104用于实现终端102与服务器106、服务器106与数据库设备108等之间的网络连接,可以包括多种类型的有线或无线网络。网络104都可以包括互联网、局域网(“LAN”)、广域网(“WAN”)、内部网、移动电话网络、虚拟专用网(VPN)、蜂窝式或其它移动通信网络、蓝牙、NFC或其任何组合。网络104进行数据传输时也会基于相应的通讯协议,例如网页浏览器接收网页相应的业务代码时会基于HTTP通讯协议,移动应用程序接收的业务代码时可以基于Websocket通讯协议。The network 104 is used to implement the network connection between the terminal 102 and the server 106, the server 106 and the database device 108, etc., and may include multiple types of wired or wireless networks. The network 104 may include the Internet, a local area network ("LAN"), a wide area network ("WAN"), an intranet, a mobile phone network, a virtual private network (VPN), a cellular or other mobile communication network, Bluetooth, NFC, or any combination thereof . The data transmission on the network 104 is also based on the corresponding communication protocol. For example, when the web browser receives the corresponding service code of the webpage, it will be based on the HTTP communication protocol, and the service code received by the mobile application may be based on the Websocket communication protocol.
服务器106可以用独立的服务器或者是多个服务器组成的服务器集群来实现。在运行过程中,服务器106可以获取目标用户的各条用户数据,分别确定所述目标用户的各条用户数据的生成时间所处周期,根据各所述生成时间所处周期,将所述目标用户的各条用户数据分离存储到多个数据库中。如此,能够实现冷热数据分离。The server 106 may be implemented as an independent server or a server cluster composed of multiple servers. During the running process, the server 106 can obtain each piece of user data of the target user, respectively determine the period of the generation time of each piece of user data of the target user, and according to the period of each generation time, the target user Each piece of user data is stored separately in multiple databases. In this way, the cold and hot data can be separated.
在一个实施例中,如图2所示,提供了一种数据分离存储方法,以该方法应用于图1中的服务器为例进行说明,包括以下步骤:In one embodiment, as shown in FIG. 2, a data separation storage method is provided. Taking the method applied to the server in FIG. 1 as an example for description, the method includes the following steps:
步骤202,获取目标用户的各条用户数据。Step 202: Obtain various pieces of user data of the target user.
这里,目标用户可以是销售平台用户,具体可以是销售平台的全部用户,也可以是销售平台的部分用户,例如,从销售平台的全部用户中筛选出的一部分用户。目标用户还可以是其他类型平台用户。对于销售平台用户,用户数据可以包括订单数据。目标用户的数量可以是一个或者多个。Here, the target users may be users of the sales platform, specifically all users of the sales platform, or some users of the sales platform, for example, a part of users selected from all users of the sales platform. The target user can also be other types of platform users. For sales platform users, user data may include order data. The number of target users can be one or more.
具体地,服务器可以从历史数据和当前数据中获取目标用户的各条用户数据,这里,当前数据可以是新生成数据,也可以当前周期中生成的数据。Specifically, the server may obtain various pieces of user data of the target user from historical data and current data. Here, the current data may be newly generated data or data generated in the current cycle.
步骤204,分别确定目标用户的各条用户数据的生成时间所处周期;Step 204, respectively determine the period in which the generation time of each piece of user data of the target user is located;
这里,生成时间所处周期指生成时间所在的周期。周期的划分方式可以根据实际情况设定,例如,按年划分、按月划分或者按日划分等,对于按年划分可以是每一个年份一个周期,也可以是每多个年份一个周期,按月划分或者按 日划分等同理。Here, the period in which the generation time is located refers to the period in which the generation time is located. The division method of the cycle can be set according to the actual situation, for example, divided by year, divided by month, or divided by day, etc. For the division by year, it can be a cycle per year, or it can be a cycle per multiple years, by month Division or division by day is equivalent.
具体地,服务器可以查询目标用户的各条用户数据的生成时间,根据查询到各条用户数据的生成时间,确定目标用户的各条用户数据的生成时间所处周期。其中,所查询的生成时间的精度可以根据周期划分方式确定,例如,按年划分,则可以仅查询生成年份信息。Specifically, the server may query the generation time of each piece of user data of the target user, and determine the period of the generation time of each piece of user data of the target user according to the generation time of each piece of user data that is queried. Wherein, the accuracy of the generation time that is queried can be determined according to the period division method, for example, if it is divided by year, only the generation year information can be queried.
步骤206,根据各生成时间所处周期,将目标用户的各条用户数据分离存储到多个数据库中。Step 206: Separately store each piece of user data of the target user into multiple databases according to the period of each generation time.
这里,数据库的个数可以根据实际需要确定。Here, the number of databases can be determined according to actual needs.
具体地,服务器可以根据在步骤204中获得的各生成时间所处周期,将目标用户的各条用户数据按照预设的数据分离规则分离存储到多个数据库中,其中,数据分离规则可以根据实际需要设定,同一条用户数据可以根据需要仅存储在一个数据库,也可以存储在多个数据库中。Specifically, the server can separate and store each piece of user data of the target user into multiple databases according to preset data separation rules according to the period of each generation time obtained in step 204, where the data separation rules can be based on actual conditions. It needs to be set. The same piece of user data can be stored in only one database or in multiple databases as required.
上述数据分离存储方法中,是获取目标用户的各条用户数据,分别确定目标用户的各条用户数据的生成时间所处周期,根据各该生成时间所处周期,将目标用户的各条用户数据分离存储到多个数据库中。本实施例中,由于是基于生成时间所处周期对目标用户的各条用户数据进行分离存储,只需要根据各条用户数据的生成时间确定对应的所处周期即可,简化了计算方式,同时,对于新生成数据也可以直接按照本实施例的方案进行分离存储,避免新生成数据分离存储的滞后性,而且,由于是根据各生成时间所处周期将目标用户的各条用户数据分离存储到多个不同数据库中,能够实现冷热数据物理上的分离,可以减少热点数据的存储和查询耗时,避免或者减少冷数据对热点数据的使用的影响。In the above data separation and storage method, each piece of user data of the target user is obtained, and the period of the generation time of each piece of user data of the target user is determined respectively, and the period of each piece of user data of the target user is determined according to the period of the generation time. Separately stored in multiple databases. In this embodiment, since each piece of user data of the target user is stored separately based on the period of the generation time, it is only necessary to determine the corresponding period according to the generation time of each piece of user data, which simplifies the calculation method, and at the same time For newly generated data, it is also possible to separate and store the newly generated data directly according to the scheme of this embodiment to avoid the hysteresis of the separate storage of newly generated data. Moreover, because each piece of user data of the target user is stored separately according to the period of each generation time In multiple different databases, the physical separation of hot and cold data can be achieved, which can reduce the time-consuming storage and query of hot data, and avoid or reduce the impact of cold data on the use of hot data.
在一个实施例中,本申请的数据分离存储方法还可以包括步骤:请求为目标用户分配当前周期数据库、历史数据库、第一数据库和第二数据库;上述的根据各生成时间所处周期,将目标用户的各条用户数据分离存储到多个数据库中的步骤,可以包括步骤:根据各生成时间所处周期,将目标用户的各条用户数据分离存储到当前周期数据库、历史数据库、第一数据库和第二数据库中;其中,当前周期数据库用于存储目标用户的生成时间所处周期为当前周期的用 户数据,历史数据库用于存储目标用户的生成时间所处周期为历史周期的用户数据,第一数据库用于存储目标用户的生成时间所处周期为当前周期以及上一周期的用户数据,第二数据库用于存储目标用户的生成时间所处周期为当前周期以及下一周期的用户数据。In one embodiment, the data separation storage method of the present application may further include the steps of: requesting to allocate the current period database, historical database, first database, and second database to the target user; the above-mentioned target users are allocated according to the period of each generation time. The step of storing each piece of user data of the user separately into multiple databases may include the step of: according to the period of each generation time, each piece of user data of the target user is separately stored in the current period database, the historical database, the first database and The second database; where the current period database is used to store user data whose target user’s generation time is in the current period, and the historical database is used to store user data whose target user’s generation time is in the historical period. The first The database is used to store the user data of the current period and the previous period in which the generation time of the target user is in the period, and the second database is used to store the user data in the current period and the next period in which the generation time of the target user is in the period.
其中,历史周期为目标用户的第一个用户数据的产生时间对应的周期到上一周期的各个周期,上一周期、当前周期和下一周期为时间上紧邻的三个周期,随着时间的推移,同一周期的表述方式也可以是不同的。例如,在2019年,2018年、2019年和2020年分别为上一周期、当前周期和下一周期,在2020年,2019年为上一周期。Among them, the historical period is the period corresponding to the generation time of the first user data of the target user to the previous period. The previous period, the current period and the next period are three periods immediately adjacent in time. Over time, the expression of the same period can also be different. For example, in 2019, 2018, 2019, and 2020 are the previous cycle, the current cycle, and the next cycle, respectively, and in 2020, 2019 is the previous cycle.
以按年份划分周期且用户数据为订单为例进行说明,同一用户的订单数据分布在4个数据库中:历史订单数据库、当前年份订单数据库、上一年份和当前年份订单数据库、以及下一年份和当前年份订单数据库。其中,上一年份为当前年份减1的年份,下一年份为当前年份加1的年份。历史订单数据库、当前年份订单数据库、上一年份和当前年份订单数据库、以及下一年份和当前年份订单数据库,分别相当于上述的历史数据库、当前周期数据库、第一数据库和第二数据库。Taking the period divided by year and user data as orders as an example, the order data of the same user is distributed in 4 databases: historical order database, current year order database, previous year and current year order database, and next year and The current year order database. Among them, the previous year is the year minus 1 from the current year, and the next year is the year plus 1 from the current year. The historical order database, the current year order database, the previous year and current year order database, and the next year and current year order database are respectively equivalent to the aforementioned historical database, current period database, first database and second database.
本实施例方案中,将目标用户的各条用户数据分离存储到当前周期数据库、历史数据库、第一数据库和第二数据库中,实现了冷热用户数据的隔离存储。此外,由于当前周期数据库、历史数据库和第一数据库分别对应存储有生成时间所处周期为当前周期的用户数据、生成时间所处周期为历史周期的用户数据、和生成时间所处周期为当前周期以及上一周期的用户数据,对于热点数据的操作(例如查询或者存储)可以路由到当前周期数据库或者第一数据库进行操作,可以提升热点数据的处理效率。同时,当前周期数据库、第一数据库和第二数据库都存储有当前周期的用户数据,且第一数据库和第二数据库还分别用于存储上一周期的用户数据和下一周期的用户数据,如此在发生周期变更(例如进入下一周期)时,将当前周期数据库中的数据迁移到历史数据库并对第二数据库进行身份变更,即由第二数据库变更为第一数据库,而不需要废弃掉这两个数据库,即发生周期变更时,废弃掉的数据库数量较少,可以提升变更效率, 同时提升方案的时间延续性。In the solution of this embodiment, each piece of user data of the target user is separately stored in the current period database, the historical database, the first database, and the second database, which realizes the isolated storage of hot and cold user data. In addition, since the current cycle database, the historical database and the first database respectively store user data whose generation time is in the current cycle, user data whose generation time is in the historical cycle, and the generation time is in the current cycle. As well as the user data of the previous period, operations on hot data (such as query or storage) can be routed to the current period database or the first database for operations, which can improve the processing efficiency of hot data. At the same time, the current period database, the first database and the second database all store the user data of the current period, and the first database and the second database are also used to store the user data of the previous period and the user data of the next period, respectively. When a cycle change occurs (for example, entering the next cycle), the data in the current cycle database is migrated to the historical database and the identity of the second database is changed, that is, the second database is changed to the first database without discarding this Two databases, that is, when a periodic change occurs, the number of abandoned databases is small, which can improve the efficiency of the change and improve the time continuity of the solution.
在一个实施例中,上述的目标用户的各条用户数据可以包括目标用户的新生成数据和各条历史数据;如图3所示,上述的根据各生成时间所处周期,将目标用户的各条用户数据分离存储到当前周期数据库、历史数据库、第一数据库和第二数据库中的步骤,可以包括如下步骤:In one embodiment, the aforementioned pieces of user data of the target user may include the newly generated data of the target user and various pieces of historical data; as shown in FIG. 3, the aforementioned pieces of user data of the target user are changed according to the period of each generation time. The step of storing the pieces of user data separately in the current period database, the historical database, the first database and the second database may include the following steps:
步骤302,将目标用户的新生成数据分别存储到当前周期数据库、第一数据库和第二数据库中;Step 302: Store the newly generated data of the target user in the current period database, the first database and the second database respectively;
步骤304,按照目标用户的各条历史数据的生成时间所处周期,将目标用户的各条历史数据分离存储到当前周期数据库、历史数据库和第一数据库中。Step 304: Separately store each piece of historical data of the target user in the current period database, the historical database and the first database according to the period in which each piece of historical data of the target user is generated.
本实施例中,对于新生成数据可以直接进行存储,即不需要确定生成时间所处周期,可以提升数据分离存储的效率。In this embodiment, the newly generated data can be directly stored, that is, there is no need to determine the period of the generation time, and the efficiency of data separation and storage can be improved.
在一个实施例中,如图4所示,上述的将目标用户的新生成数据分别存储到当前周期数据库、第一数据库和第二数据库中的步骤,可以包括如下步骤:In one embodiment, as shown in FIG. 4, the step of storing the newly generated data of the target user in the current period database, the first database, and the second database, respectively, may include the following steps:
步骤402,将目标用户的新生成数据写入当前周期数据库中;Step 402: Write the newly generated data of the target user into the current cycle database;
步骤404,根据将目标用户的新生成数据写入当前周期数据库产生的操作日志,并通过异步方式将目标用户的新生成数据写入第一数据库和第二数据库中。Step 404: Write the newly generated data of the target user into the operation log generated by the current periodic database, and write the newly generated data of the target user into the first database and the second database in an asynchronous manner.
具体地,服务器可以将目标用户的新生成数据写入当前周期数据库中,在将目标用户的新生成数据写入当前周期数据库时,会产生操作日志,该操作日志一般为二进制日志(binlog),可以通过异步方式对该操作日志进行解析处理,根据解析处理结果目标用户的新生成数据将插入第一数据库和第二数据库中,如此,不影响基于该新生成数据的数据处理流程,例如用户订单提交流程。Specifically, the server can write the newly generated data of the target user into the current cycle database. When writing the newly generated data of the target user into the current cycle database, an operation log is generated. The operation log is generally a binary log (binlog). The operation log can be parsed in an asynchronous manner, and the newly generated data of the target user will be inserted into the first database and the second database according to the result of the analytic processing, so that it does not affect the data processing flow based on the newly generated data, such as user orders The submission process.
在一个实施例中,如图5所示,提供了一种数据分离存储方法,以该方法应用于图1中的服务器为例进行说明,如图5所示,该实施例中的数据分离存储方法,除了包括上述的步骤202、步骤204和步骤206之外,还包括以下步骤:In one embodiment, as shown in FIG. 5, a data separation storage method is provided. The method is applied to the server in FIG. 1 as an example for description. As shown in FIG. 5, the data separation storage method in this embodiment The method includes the following steps in addition to the above-mentioned step 202, step 204, and step 206:
步骤502,在进入下一周期之前,请求为目标用户分配新的当前周期数据库和新的第二数据库;Step 502, before entering the next cycle, request to allocate a new current cycle database and a new second database to the target user;
步骤504,在进入下一周期之后,将当前周期对应的目标用户的当前周期数据库中的数据迁移到目标用户的历史数据库,将目标用户的当前周期对应的第 二数据库作为目标用户的新的第一数据库;Step 504: After entering the next cycle, migrate the data in the current cycle database of the target user corresponding to the current cycle to the historical database of the target user, and use the second database corresponding to the current cycle of the target user as the new first database of the target user. A database;
步骤506,在数据迁移完成后,销毁目标用户的当前周期对应的当前周期数据库,以及目标用户的当前周期对应的第一数据库。Step 506: After the data migration is completed, destroy the current period database corresponding to the current period of the target user and the first database corresponding to the current period of the target user.
本实施例方案,对数据量快速增长的数据库,有非常好的时间扩展性,可以无限扩展实施。The solution of this embodiment has very good time scalability for a database with a rapidly growing data volume, and can be implemented infinitely extended.
在一个实施例中的数据分离存储方法还可以包括步骤:按照用户维度对用户数据进行分片处理,分片处理之后的各分片用户的用户数据分别作为目标用户的各条用户数据。The data separation and storage method in an embodiment may further include the step of fragmenting user data according to the user dimension, and the user data of each fragmented user after the fragmentation processing is used as each piece of user data of the target user.
具体地,将全部会员的订单数据按照会员维度分成n个分片,其中,n为正整数,大小可以根据实际需要设定。同一用户的多条用户数据一般在同一分片,也就是说,将全部会员的订单数据按照会员分成多个组,每组用户的用户数据可以分别作为目标用户的各条用户数据,按照上述实施例的方式进行分离存储,如此,每个分片用户可以分别对应有上述的多个(四个)数据库,不同分片用户的用户数据可以并行的进行分离存储,可以进一步减少热点数据的存储和查询耗时。Specifically, the order data of all members is divided into n segments according to the member dimension, where n is a positive integer, and the size can be set according to actual needs. Multiple pieces of user data of the same user are generally in the same shard, that is to say, the order data of all members is divided into multiple groups according to the members, and the user data of each group of users can be used as the pieces of user data of the target user, according to the above implementation In this way, each shard user can correspond to the above-mentioned multiple (four) databases, and the user data of different shard users can be separated and stored in parallel, which can further reduce the storage and storage of hot data. The query is time consuming.
在一个实施例中的数据分离存储方法还可以包括步骤:接收到目标用户的用户数据修改请求时,查询待修改用户数据的生成周期信息;在根据查询到的生成周期信息确定的周期为当前周期时,将用户数据修改请求路由到目标用户对应的当前周期数据库进行数据修改;在根据查询到的生成周期信息确定的周期为历史周期时,将用户数据修改请求路由到目标用户对应的历史数据库进行数据修改。The data separation storage method in one embodiment may further include the steps of: when a user data modification request of the target user is received, query the generation period information of the user data to be modified; when the period determined according to the queried generation period information is the current period When the user data modification request is routed to the current period database corresponding to the target user for data modification; when the period determined according to the queried generation period information is a historical period, the user data modification request is routed to the historical database corresponding to the target user for data modification. Data modification.
这里,生成周期信息指生成时间的周期信息,即生成时间所处的周期。其中,待修改用户数据可以根据用户数据修改请求确定。本实施例中,将不同用户数据修改请求路由到当前周期数据库或者历史数据库进行数据修改,可以将冷热数据的修改分开处理,可以提升处理效率。Here, the generation period information refers to the period information of the generation time, that is, the period in which the generation time is located. Among them, the user data to be modified can be determined according to the user data modification request. In this embodiment, different user data modification requests are routed to the current period database or historical database for data modification, and the modification of cold and hot data can be processed separately, which can improve processing efficiency.
在一个实施例中的数据分离存储方法还可以包括步骤:接收到目标用户的用户数据查询请求时,根据查询请求所携带的查询条件确定查询类型;在查询类型是按周期查询时,若根据查询条件确定的查询周期为当前周期,则将用户 数据查询请求路由到目标用户对应的当前周期数据库进行数据查询,若根据查询条件确定的查询周期为历史周期,则将用户数据查询请求路由到目标用户对应的历史数据库进行数据查询;在查询类型是按时段查询时,根据查询条件确定的查询时段对应的起始时间和结束时间;根据起始时间和结束时间,确定与起始时间和结束时间匹配的目标用户的目标数据库,将用户数据查询请求路由到目标数据库进行数据查询。The data separation storage method in one embodiment may further include the step of: when a user data query request from a target user is received, the query type is determined according to the query conditions carried in the query request; when the query type is a periodic query, if the query is based on the query If the query period determined by the condition is the current period, the user data query request is routed to the current period database corresponding to the target user for data query. If the query period determined according to the query condition is the historical period, the user data query request is routed to the target user Corresponding historical database for data query; when the query type is query by time period, the start time and end time corresponding to the query period determined according to the query conditions; according to the start time and end time, it is determined to match the start time and end time The target database of the target user, the user data query request is routed to the target database for data query.
其中,根据起始时间和结束时间,确定与起始时间和结束时间匹配的目标用户的目标数据库的步骤,具体可以包括步骤:检测所述起始时间和结束时间是否均落在目标用户的当前周期数据库或者历史数据库对应的时段;若是,则将该当前周期数据库或者历史数据库确定为目标数据库;若否,则检测述起始时间和结束时间是否均落在目标用户的第一数据库,若是,则将该第一数据库确定为目标数据库;若否,则将历史数据库和当前数据库作为目标数据库。即优先在单一数据库中进行查询,在单一数据库都不能与起始时间和结束时间匹配时,才进行跨数据库查询,如此可以尽量避免跨数据库查询,尽可能地提升对用户数据查询请求的响应效率。对于需要跨数据库查询的场景,可以将查询时段拆分成与历史数据库和当前数据库匹配的两个子查询时段,基于这两个子查询时段分别在对应的历史数据库和当前数据库分别进行数据查询,将得到的两个查询结果进行数据汇聚,得到最终的数据查询结果。Wherein, the step of determining the target database of the target user matching the start time and the end time according to the start time and the end time may specifically include the step of detecting whether the start time and the end time both fall within the current target user's Period database or historical database corresponding to the time period; if yes, determine the current period database or historical database as the target database; if not, check whether the start time and end time both fall in the first database of the target user, if yes, Then the first database is determined as the target database; if not, the historical database and the current database are used as the target database. That is to say, query in a single database is preferred, and cross-database query is performed when a single database cannot match the start time and end time, so that cross-database queries can be avoided as much as possible, and the response efficiency to user data query requests can be improved as much as possible . For scenarios that require cross-database queries, the query period can be split into two sub-query periods that match the historical database and the current database. Based on these two sub-query periods, data queries are performed on the corresponding historical database and the current database respectively, and you will get The two query results are aggregated to obtain the final data query result.
为了便于理解本发明的方案,以下以将上述一个实施例中的数据分离存储方法应用于会员的订单数据分离存储为例进行说明。本实施例中的数据分离存储方法包括如下步骤:In order to facilitate the understanding of the solution of the present invention, the following is an example of applying the data separation storage method in the foregoing embodiment to the separate storage of member order data. The data separation storage method in this embodiment includes the following steps:
步骤一:按照会员维度分成n个分片,按照各个分片的会员拆分全量的订单数据。Step 1: Divide into n segments according to the member dimension, and split the full amount of order data according to the members of each segment.
其中,每个分片的会员数量可以是相等的也可以是不等的。Among them, the number of members in each shard can be equal or unequal.
具体地,先将全部会员按照会员维度分成n个分片,再按照各个分片的会员对全量的订单数据进行拆分,如此,同一会员的多条订单数据在同一分片。Specifically, all members are first divided into n segments according to the member dimension, and then the full amount of order data is split according to the members of each segment, so that multiple pieces of order data of the same member are in the same segment.
步骤二:为每一个分片,申请history数据库、now数据库、before&now 数据库和now&after数据库这四个数据库。Step 2: For each shard, apply for four databases: history database, now database, before&now database and now&after database.
其中,history数据库指历史订单数据库,now数据库指当前年份d订单的数据库,before&now数据库指当前年份-1(即上一年份)和当前年份订单的数据库,now&after数据库指当前年份&当前年份+1(即下一年份)订单的数据库。Among them, the history database refers to the historical order database, the now database refers to the database of orders in the current year, the before&now database refers to the database of current year-1 (that is, the previous year) and the current year's orders, and the now&after database refers to the current year&current year+1 ( That is, the database of orders for the next year.
这里的history数据库、now数据库、before&now数据库和now&after数据库,分别相当于上述实施例中的历史数据库、当前周期数据库、第一数据库和第二数据库。The history database, now database, before&now database, and now&after database here are respectively equivalent to the history database, current period database, first database, and second database in the foregoing embodiment.
步骤三:定义数据存储路由规则,该路由规则用于指示服务器中的服务程序读写对应数据库;Step 3: Define data storage routing rules, which are used to instruct the service program in the server to read and write the corresponding database;
其中,数据存储路由规则可以包括新订单存储规则、历史订单修改规则和订单查询规则。Among them, the data storage routing rules may include new order storage rules, historical order modification rules, and order query rules.
新订单存储规则:在订单下单的年份为当前年份,路由到now数据库存储;New order storage rule: the year when the order is placed is the current year, routed to the now database for storage;
历史订单修改规则:查询历史订单的下单年份,如果是当前年份,路由到now数据库修改;如果是历史年份,路由到history数据库修改;Historical order modification rules: query the year of placing the historical order, if it is the current year, route to the now database for modification; if it is a historical year, route to the history database for modification;
订单查询规则:如果是按照年份查询,查询当前年份,路由到now数据库查询,查询历史年份,路由到history数据库查询;如果查询条件为时间段,即开始时间到结束时间,如果时间段落now数据库对应的时段,路由到now数据库查询,如果时间段落在before&now数据库对应的时段,路由到before&now数据库查询,如果时间段落在history数据库对应的时段,路由到history数据库查询。Order query rules: If query by year, query the current year, route to the now database query, query the history year, route to the history database query; if the query condition is a time period, that is, the start time to the end time, if the time period corresponds to the now database The time period is routed to the now database for query. If the time period is in the period corresponding to the before&now database, it is routed to the before&now database for query. If the time period is in the period corresponding to the history database, it is routed to the history database for query.
本实施例方案是考虑对外提供的查询服务,一般涉及最近三个月/六个月/某一年的请求,因此不涉及跨两个数据库汇聚结果场景。但根据实际需要,也可以进行跨数据库查询。The solution of this embodiment is to consider the externally provided query service, which generally involves requests in the last three months/six months/a certain year, and therefore does not involve a scenario where results are aggregated across two databases. However, cross-database queries can also be performed according to actual needs.
步骤四:建立now数据库、before&now数据库和now&after数据库之间异步关联写入机制;Step 4: Establish an asynchronous association writing mechanism among the now database, before&now database and now&after database;
具体地,可以使用数据库二进制日志解析组件RDRS,将now数据库所有操作,写入到before&now数据库和now&after数据库中,保证三个数据库中当前数据一致性。Specifically, the database binary log analysis component RDRS can be used to write all operations of the now database into the before&now database and the now&after database to ensure the consistency of the current data in the three databases.
举例说明,参见图6所示,在当前年份为2019年时,为某个分片的用户申请了历史订单数据库、18+19年订单数据库、19年数据库以及19+20年订单数据,历史订单数据库用于存储订单存储对应用户的从开始时间到2018年底的订单数据,18+19年订单数据库用于存储订单存储对应用户的2018年和2019年两年的订单数据,19+20年订单数据库用于存储订单存储对应用户的2019年和2020年两年的订单数据。在终端应用上产生的订单数据按照产生年份相应地存储到这四个数据库中,具体地,历史订单数据按照产生年份相应地存储到历史订单数据库、18+19年订单数据库或者19年数据库,2019年份新产生的数据存储到19年数据库,并根据18+19年订单数据库、19年数据库以及19+20年订单数据库的异步关联写入机制,采用异步方式存储到18+19年订单数据库以及19+20年订单数据库。For example, as shown in Figure 6, when the current year is 2019, a historical order database, 18+19 year order database, 19 year database, and 19+20 year order data are applied for a sharded user. Historical orders The database is used to store the order data of the corresponding user from the start time to the end of 2018, the 18+19 order database is used to store the order data of the corresponding user in 2018 and 2019, and the 19+20 order database It is used to store the order data of the corresponding user in 2019 and 2020. The order data generated on the terminal application is stored in these four databases according to the year of production. Specifically, the historical order data is stored in the historical order database, the 18+19 year order database or the 19 year database according to the year of production, 2019 The newly generated data of the year is stored in the 19 year database, and is stored in the 18+19 year order database and 19 year order database in an asynchronous manner according to the asynchronous association write mechanism of the 18+19 year order database, the 19 year database and the 19+20 year order database. +20 years of order database.
步骤五:新的切换周期前准备Step 5: Preparation before the new switching cycle
进入下一年前,提前申请新的now数据库和新的now&after数据库,并在数据库路由规则中制定新的年份,路由到新的now数据库和新的now&after数据库中;Before entering the next year, apply for a new now database and a new now&after database in advance, and formulate a new year in the database routing rules to route to the new now database and the new now&after database;
步骤六:归档;Step 6: File;
具体地,进入下一年后,将上一年的now数据库,归档到history数据库中。Specifically, after entering the next year, archive the now database of the previous year into the history database.
步骤七:清理多余数据;Step 7: Clean up redundant data;
具体地,将上一年的now数据库和before&now两份数据库销毁,完成切割。Specifically, the now database and the before&now database of the previous year will be destroyed to complete the cutting.
举例说明,参见图6所示,在进入2020年之前,提前为对应用户申请新的now数据库和新的now&after数据库,即20年订单数据和20+21年订单数据库,在进入2020年之后,将19年数据库的数据归档到历史订单数据库,将18+19年订单数据库、19年数据库销毁。For example, as shown in Figure 6, before entering 2020, apply for a new now database and a new now&after database for the corresponding user in advance, that is, 20-year order data and 20+21-year order database. After entering 2020, will The data of the 19-year database is archived to the historical order database, and the 18+19-year order database and the 19-year database are destroyed.
应该理解的是,虽然图2-5的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图2-5中的至少一部分步骤可以包括多个子步骤或者多个阶段, 这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the various steps in the flowcharts of FIGS. 2-5 are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, there is no strict order for the execution of these steps, and these steps can be executed in other orders. Moreover, at least part of the steps in Figures 2-5 may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. These sub-steps or stages The execution order of is not necessarily performed sequentially, but may be performed alternately or alternately with at least a part of other steps or sub-steps or stages of other steps.
在一个实施例中,如图7所示,提供了一种数据分离存储装置,包括:数据获取模块702、周期确定模块704和分离存储模块706,其中:In one embodiment, as shown in FIG. 7, a data separation storage device is provided, including: a data acquisition module 702, a period determination module 704, and a separation storage module 706, wherein:
数据获取模块702,用于获取目标用户的各条用户数据;The data acquisition module 702 is used to acquire various pieces of user data of the target user;
周期确定模块704,用于分别确定目标用户的各条用户数据的生成时间所处周期;The period determining module 704 is used to determine the period in which the generation time of each piece of user data of the target user is located;
分离存储模块706,用于根据各生成时间所处周期,将目标用户的各条用户数据分离存储到多个数据库中。The separate storage module 706 is used to separate and store each piece of user data of the target user into multiple databases according to the period of each generation time.
在一个实施例中,本申请的数据分离存储装置还可以包括:数据库分配请求模块(图中未示出),该数据库分配请求模块用于请求为目标用户分配当前周期数据库、历史数据库、第一数据库和第二数据库;分离存储模块706可以根据各生成时间所处周期,将目标用户的各条用户数据分离存储到当前周期数据库、历史数据库、第一数据库和第二数据库中;其中,当前周期数据库用于存储目标用户的生成时间所处周期为当前周期的用户数据,历史数据库用于存储目标用户的生成时间所处周期为历史周期的用户数据,第一数据库用于存储目标用户的生成时间所处周期为当前周期以及上一周期的用户数据,第二数据库用于存储目标用户的生成时间所处周期为当前周期以及下一周期的用户数据。In an embodiment, the data separation storage device of the present application may further include: a database allocation request module (not shown in the figure), the database allocation request module is used to request the target user to allocate the current period database, historical database, first Database and the second database; the separate storage module 706 can separate and store each piece of user data of the target user into the current period database, the historical database, the first database and the second database according to the period of each generation time; among them, the current period The database is used to store the user data whose generation time of the target user is in the current period, the historical database is used to store the user data whose generation time is the target user in the historical period, and the first database is used to store the generation time of the target user The period is the user data of the current period and the previous period, and the second database is used to store the user data of the period in which the generation time of the target user is in the current period and the next period.
在一个实施例中,上述的目标用户的各条用户数据可以包括目标用户的新生成数据和各条历史数据;分离存储模块706可以将目标用户的新生成数据分别存储到当前周期数据库、第一数据库和第二数据库中,按照目标用户的各条历史数据的生成时间所处周期,将目标用户的各条历史数据分离存储到当前周期数据库、历史数据库和第一数据库中。In one embodiment, the aforementioned pieces of user data of the target user may include newly generated data of the target user and various pieces of historical data; the separate storage module 706 may store the newly generated data of the target user in the current period database and the first In the database and the second database, each piece of historical data of the target user is separately stored in the current cycle database, the historical database and the first database according to the period in which each piece of historical data of the target user is generated.
在一个实施例中,分离存储模块706可以将目标用户的新生成数据写入当前周期数据库中,根据将目标用户的新生成数据写入当前周期数据库产生的操作日志,并通过异步方式将目标用户的新生成数据写入第一数据库和第二数据 库中。In one embodiment, the separate storage module 706 can write the newly generated data of the target user into the current cycle database, write the newly generated data of the target user into the operation log generated by the current cycle database, and send the target user asynchronously. The newly generated data of is written into the first database and the second database.
在一个实施例中,上述的数据库分配请求模块还可以用于在进入下一周期之前,请求为目标用户分配新的当前周期数据库和新的第二数据库;本申请的数据分离存储装置还可以包括数据迁移模块(图中未示出),该数据迁移模块用于在进入下一周期之后,将当前周期对应的目标用户的当前周期数据库中的数据,迁移到目标用户的历史数据库,将目标用户的当前周期对应的第二数据库作为目标用户的新的第一数据库,在数据迁移完成后,销毁目标用户的当前周期对应的当前周期数据库,以及目标用户的当前周期对应的第一数据库。In one embodiment, the aforementioned database allocation request module may also be used to request the target user to allocate a new current period database and a new second database before entering the next period; the data separation storage device of the present application may also include Data migration module (not shown in the figure), the data migration module is used to migrate the data in the current period database of the target user corresponding to the current period to the historical database of the target user after entering the next period. The second database corresponding to the current cycle of the target user is used as the new first database of the target user. After the data migration is completed, the current cycle database corresponding to the current cycle of the target user and the first database corresponding to the current cycle of the target user are destroyed.
在一个实施例中,本申请的数据分离存储装置还可以包括用户划分模块(图中未示出),该用户划分模块用于按照用户维度对用户数据进行分片处理,分片处理之后的各分片用户的用户数据分别作为目标用户的各条用户数据。In an embodiment, the data separation storage device of the present application may further include a user division module (not shown in the figure), and the user division module is used to perform fragmentation processing on user data according to the user dimension, and each segment after the fragmentation processing The user data of the segmented users are respectively used as the pieces of user data of the target user.
在一个实施例中,本申请的数据分离存储装置还可以包括第一请求路由模块(图中未示出),该第一请求路由模块用于在接收到目标用户的用户数据修改请求时,查询待修改用户数据的生成周期信息,在根据查询到的生成周期信息确定的周期为当前周期时,将用户数据修改请求路由到目标用户对应的当前周期数据库进行数据修改,在根据查询到的生成周期信息确定的周期为历史周期时,将用户数据修改请求路由到目标用户对应的历史数据库进行数据修改。In an embodiment, the data separation storage device of the present application may further include a first request routing module (not shown in the figure), and the first request routing module is configured to query the user data modification request of the target user. The generation period information of the user data to be modified. When the period determined according to the queried generation period information is the current period, the user data modification request is routed to the current period database corresponding to the target user for data modification. When the period determined by the information is a historical period, the user data modification request is routed to the historical database corresponding to the target user for data modification.
在一个实施例中,本申请的数据分离存储装置还可以包括第二请求路由模块(图中未示出),该第二请求路由模块用于接收到目标用户的用户数据查询请求时,根据查询请求所携带的查询条件确定查询类型;在查询类型是按周期查询时,若根据查询条件确定的查询周期为当前周期,则将用户数据查询请求路由到目标用户对应的当前周期数据库进行数据查询,若根据查询条件确定的查询周期为历史周期,则将用户数据查询请求路由到目标用户对应的历史数据库进行数据查询;在查询类型是按时段查询时,根据查询条件确定的查询时段对应的起始时间和结束时间;根据起始时间和结束时间,确定与起始时间和结束时间匹配的目标用户的目标数据库,将用户数据查询请求路由到目标数据库进行数据查询。In one embodiment, the data separation storage device of the present application may further include a second request routing module (not shown in the figure), and the second request routing module is configured to receive a user data query request from a target user according to the query The query condition carried in the request determines the query type; when the query type is a cycle query, if the query cycle determined according to the query condition is the current cycle, the user data query request is routed to the current cycle database corresponding to the target user for data query, If the query period determined according to the query conditions is a historical period, the user data query request is routed to the historical database corresponding to the target user for data query; when the query type is query by period, the start of the query period determined according to the query conditions Time and end time: According to the start time and end time, determine the target database of the target user that matches the start time and end time, and route the user data query request to the target database for data query.
在一个实施例中,本申请的数据分离存储装置还可以包括上述的第一请求 路由模块和第二请求路由模块。In an embodiment, the data separation storage device of the present application may further include the above-mentioned first request routing module and second request routing module.
关于数据分离存储装置的具体限定可以参见上文中对于数据分离存储方法的限定,在此不再赘述。上述数据分离存储装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。For the specific definition of the data separation storage device, please refer to the above definition of the data separation storage method, which will not be repeated here. Each module in the above-mentioned data separation storage device can be implemented in whole or in part by software, hardware, and a combination thereof. The above-mentioned modules may be embedded in the form of hardware or independent of the processor in the computer equipment, or may be stored in the memory of the computer equipment in the form of software, so that the processor can call and execute the operations corresponding to the above-mentioned modules.
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图8所示。该计算机设备包括通过系统总线连接的处理器、存储器和网络接口。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种数据分离存储方法。In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. 8. The computer equipment includes a processor, a memory, and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide calculation and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. The computer program is executed by the processor to realize a data separation storage method.
本领域技术人员可以理解,图8中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in FIG. 8 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may Including more or fewer parts than shown in the figure, or combining some parts, or having a different arrangement of parts.
在一个实施例中,提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时实现以下步骤:获取目标用户的各条用户数据;分别确定目标用户的各条用户数据的生成时间所处周期;根据各生成时间所处周期,将目标用户的各条用户数据分离存储到多个数据库中。In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, the following steps are implemented: Obtain various items of a target user User data; respectively determine the period in which each piece of user data of the target user is generated; according to the period of each generation time, separate and store each piece of user data of the target user into multiple databases.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:请求为目标用户分配当前周期数据库、历史数据库、第一数据库和第二数据库;处理器执行计算机程序实现上述的根据各生成时间所处周期,将目标用户的各条用户数据分离存储到多个数据库中的步骤时,具体实现以下步骤:根据各生成时间所 处周期,将目标用户的各条用户数据分离存储到当前周期数据库、历史数据库、第一数据库和第二数据库中;其中,当前周期数据库用于存储目标用户的生成时间所处周期为当前周期的用户数据,历史数据库用于存储目标用户的生成时间所处周期为历史周期的用户数据,第一数据库用于存储目标用户的生成时间所处周期为当前周期以及上一周期的用户数据,第二数据库用于存储目标用户的生成时间所处周期为当前周期以及下一周期的用户数据。In one embodiment, the processor further implements the following steps when executing the computer program: requesting to allocate the current cycle database, historical database, first database, and second database to the target user; When the user data of the target user is separated and stored in multiple databases, the following steps are specifically implemented: according to the period of each generation time, the user data of the target user is separated and stored in the current period database, In the historical database, the first database and the second database; among them, the current period database is used to store the user data of the target user's generation time period as the current period, and the historical database is used to store the target user's generation time period as the history Periodic user data. The first database is used to store the target user’s generation time in the current period and user data in the previous period. The second database is used to store the target user’s generation time in the current period and the next period. Periodic user data.
在一个实施例中,上述的目标用户的各条用户数据包括目标用户的新生成数据和各条历史数据;处理器执行计算机程序实现上述的根据各生成时间所处周期,将目标用户的各条用户数据分离存储到当前周期数据库、历史数据库、第一数据库和第二数据库中的步骤时,具体实现以下步骤:将目标用户的新生成数据分别存储到当前周期数据库、第一数据库和第二数据库中;按照目标用户的各条历史数据的生成时间所处周期,将目标用户的各条历史数据分离存储到当前周期数据库、历史数据库和第一数据库中。In one embodiment, each piece of user data of the target user mentioned above includes newly generated data of the target user and various pieces of historical data; the processor executes the computer program to realize the above-mentioned pieces of user data of the target user according to the period of each generation time. When user data is stored separately in the current period database, historical database, the first database and the second database, the following steps are specifically implemented: store the newly generated data of the target user in the current period database, the first database and the second database, respectively Middle; According to the period in which each piece of historical data of the target user is generated, separate and store each piece of historical data of the target user into the current period database, the historical database and the first database.
在一个实施例中,处理器执行计算机程序实现上述的将目标用户的新生成数据分别存储到当前周期数据库、第一数据库和第二数据库中的步骤时,具体实现以下步骤:将目标用户的新生成数据写入当前周期数据库中;In one embodiment, when the processor executes the computer program to implement the above-mentioned step of storing the newly generated data of the target user in the current period database, the first database and the second database respectively, the following steps are specifically implemented: The generated data is written into the current cycle database;
根据将目标用户的新生成数据写入当前周期数据库产生的操作日志,并通过异步方式将目标用户的新生成数据写入第一数据库和第二数据库中。Write the newly generated data of the target user into the operation log generated by the current cycle database, and write the newly generated data of the target user into the first database and the second database in an asynchronous manner.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:在进入下一周期之前,请求为目标用户分配新的当前周期数据库和新的第二数据库;在进入下一周期之后,将当前周期对应的目标用户的当前周期数据库中的数据,迁移到目标用户的历史数据库,将目标用户的当前周期对应的第二数据库作为目标用户的新的第一数据库;在数据迁移完成后,销毁目标用户的当前周期对应的当前周期数据库,以及目标用户的当前周期对应的第一数据库。In one embodiment, the processor further implements the following steps when executing the computer program: before entering the next cycle, requesting the target user to be allocated a new current cycle database and a new second database; after entering the next cycle, the current The data in the current period database of the target user corresponding to the period is migrated to the historical database of the target user, and the second database corresponding to the current period of the target user is taken as the new first database of the target user; after the data migration is completed, the target is destroyed The current period database corresponding to the current period of the user, and the first database corresponding to the current period of the target user.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:按照用户维度对用户数据进行分片处理,分片处理之后的各分片用户的用户数据分别作为目标用户的各条用户数据。In an embodiment, the processor further implements the following steps when executing the computer program: user data is segmented according to the user dimension, and the user data of each segmented user after the segmentation processing is used as each piece of user data of the target user.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:接收到目标 用户的用户数据修改请求时,查询待修改用户数据的生成周期信息;在根据查询到的生成周期信息确定的周期为当前周期时,将用户数据修改请求路由到目标用户对应的当前周期数据库进行数据修改;在根据查询到的生成周期信息确定的周期为历史周期时,将用户数据修改请求路由到目标用户对应的历史数据库进行数据修改。In one embodiment, the processor further implements the following steps when executing the computer program: when receiving the user data modification request of the target user, query the generation period information of the user data to be modified; and the period determined according to the queried generation period information is In the current cycle, the user data modification request is routed to the current cycle database corresponding to the target user for data modification; when the cycle determined according to the queried generation cycle information is a historical cycle, the user data modification request is routed to the history corresponding to the target user The database performs data modification.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:接收到目标用户的用户数据查询请求时,根据查询请求所携带的查询条件确定查询类型;在查询类型是按周期查询时,若根据查询条件确定的查询周期为当前周期,则将用户数据查询请求路由到目标用户对应的当前周期数据库进行数据查询,若根据查询条件确定的查询周期为历史周期,则将用户数据查询请求路由到目标用户对应的历史数据库进行数据查询;在查询类型是按时段查询时,根据查询条件确定的查询时段对应的起始时间和结束时间;根据起始时间和结束时间,确定与起始时间和结束时间匹配的目标用户的目标数据库,将用户数据查询请求路由到目标数据库进行数据查询。In one embodiment, the processor further implements the following steps when executing the computer program: when receiving the user data query request of the target user, the query type is determined according to the query conditions carried in the query request; when the query type is a periodic query, if If the query period determined according to the query conditions is the current period, the user data query request is routed to the current period database corresponding to the target user for data query. If the query period determined according to the query conditions is the historical period, the user data query request is routed to The historical database corresponding to the target user performs data query; when the query type is query by time period, the start time and end time corresponding to the query period determined according to the query conditions; according to the start time and end time, determine the start time and end time The target database of the target user matching the time, the user data query request is routed to the target database for data query.
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:获取目标用户的各条用户数据;分别确定目标用户的各条用户数据的生成时间所处周期;根据各生成时间所处周期,将目标用户的各条用户数据分离存储到多个数据库中。In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are realized: each piece of user data of the target user is obtained; and each piece of the target user is determined respectively. The period of the generation time of the user data; according to the period of each generation time, each piece of user data of the target user is stored separately in multiple databases.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:请求为目标用户分配当前周期数据库、历史数据库、第一数据库和第二数据库;计算机程序被处理器执行实现上述的根据各生成时间所处周期,将目标用户的各条用户数据分离存储到多个数据库中的步骤时,具体实现以下步骤:根据各生成时间所处周期,将目标用户的各条用户数据分离存储到当前周期数据库、历史数据库、第一数据库和第二数据库中;其中,当前周期数据库用于存储目标用户的生成时间所处周期为当前周期的用户数据,历史数据库用于存储目标用户的生成时间所处周期为历史周期的用户数据,第一数据库用于存储目标用户的生成时间所处周期为当前周期以及上一周期的用户数据,第二数据库用于存储目标用户的生成时间所处周期为当前周期以及下一周期的用户数据。In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: request to allocate the current cycle database, historical database, first database, and second database to the target user; the computer program is executed by the processor to realize the above-mentioned generation according to each When the time is in the cycle, when the user data of the target user is separated and stored in multiple databases, the following steps are specifically implemented: According to the cycle of each generation time, the user data of the target user is separately stored in the current cycle Database, historical database, first database and second database; among them, the current period database is used to store the user data of the target user's generation time period, and the historical database is used to store the target user's generation time period User data of the historical period. The first database is used to store the target user’s generation time in the current period and user data in the previous period. The second database is used to store the target user’s generation time in the current period and the previous period. User data for the next cycle.
在一个实施例中,上述的目标用户的各条用户数据包括目标用户的新生成数据和各条历史数据;计算机程序被处理器执行实现上述的根据各生成时间所处周期,将目标用户的各条用户数据分离存储到当前周期数据库、历史数据库、第一数据库和第二数据库中的步骤时,具体实现以下步骤:将目标用户的新生成数据分别存储到当前周期数据库、第一数据库和第二数据库中;按照目标用户的各条历史数据的生成时间所处周期,将目标用户的各条历史数据分离存储到当前周期数据库、历史数据库和第一数据库中。In one embodiment, each piece of user data of the target user mentioned above includes newly generated data of the target user and various pieces of historical data; the computer program is executed by the processor to realize the above-mentioned period according to the generation time of each target user. When the user data is stored separately in the current period database, the historical database, the first database, and the second database, the following steps are specifically implemented: store the newly generated data of the target user in the current period database, the first database and the second database, respectively. In the database; according to the cycle of the generation time of each piece of historical data of the target user, each piece of historical data of the target user is separately stored in the current cycle database, the historical database and the first database.
在一个实施例中,计算机程序被处理器执行实现上述的将目标用户的新生成数据分别存储到当前周期数据库、第一数据库和第二数据库中的步骤时,具体实现以下步骤:将目标用户的新生成数据写入当前周期数据库中;In one embodiment, when the computer program is executed by the processor to realize the above-mentioned steps of storing the newly generated data of the target user in the current period database, the first database and the second database, the following steps are specifically implemented: The newly generated data is written into the current cycle database;
根据将目标用户的新生成数据写入当前周期数据库产生的操作日志,并通过异步方式将目标用户的新生成数据写入第一数据库和第二数据库中。Write the newly generated data of the target user into the operation log generated by the current cycle database, and write the newly generated data of the target user into the first database and the second database in an asynchronous manner.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:在进入下一周期之前,请求为目标用户分配新的当前周期数据库和新的第二数据库;在进入下一周期之后,将当前周期对应的目标用户的当前周期数据库中的数据,迁移到目标用户的历史数据库,将目标用户的当前周期对应的第二数据库作为目标用户的新的第一数据库;在数据迁移完成后,销毁目标用户的当前周期对应的当前周期数据库,以及目标用户的当前周期对应的第一数据库。In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: before entering the next cycle, requesting the target user to be allocated a new current cycle database and a new second database; after entering the next cycle, The data in the current cycle database of the target user corresponding to the current cycle is migrated to the historical database of the target user, and the second database corresponding to the current cycle of the target user is taken as the new first database of the target user; after the data migration is completed, it is destroyed The current period database corresponding to the current period of the target user, and the first database corresponding to the current period of the target user.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:按照用户维度对用户数据进行分片处理,分片处理之后的各分片用户的用户数据分别作为目标用户的各条用户数据。In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: user data is segmented according to the user dimension, and the user data of each segmented user after the segmentation processing is used as each piece of user data of the target user. .
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:接收到目标用户的用户数据修改请求时,查询待修改用户数据的生成周期信息;在根据查询到的生成周期信息确定的周期为当前周期时,将用户数据修改请求路由到目标用户对应的当前周期数据库进行数据修改;在根据查询到的生成周期信息确定的周期为历史周期时,将用户数据修改请求路由到目标用户对应的历史数据库进行数据修改。In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: upon receiving the user data modification request of the target user, query the generation period information of the user data to be modified; in the period determined according to the queried generation period information When it is the current period, the user data modification request is routed to the current period database corresponding to the target user for data modification; when the period determined according to the queried generation period information is the historical period, the user data modification request is routed to the target user corresponding Historical database for data modification.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:接收到目 标用户的用户数据查询请求时,根据查询请求所携带的查询条件确定查询类型;在查询类型是按周期查询时,若根据查询条件确定的查询周期为当前周期,则将用户数据查询请求路由到目标用户对应的当前周期数据库进行数据查询,若根据查询条件确定的查询周期为历史周期,则将用户数据查询请求路由到目标用户对应的历史数据库进行数据查询;在查询类型是按时段查询时,根据查询条件确定的查询时段对应的起始时间和结束时间;根据起始时间和结束时间,确定与起始时间和结束时间匹配的目标用户的目标数据库,将用户数据查询请求路由到目标数据库进行数据查询。In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: when a user data query request from a target user is received, the query type is determined according to the query conditions carried in the query request; when the query type is a periodic query, If the query period determined according to the query conditions is the current period, the user data query request is routed to the current period database corresponding to the target user for data query, and if the query period determined according to the query conditions is the historical period, the user data query request is routed Query data in the historical database corresponding to the target user; when the query type is query by time period, the start time and end time corresponding to the query period determined according to the query conditions; according to the start time and end time, determine the start time and the end time The target database of the target user whose end time matches, the user data query request is routed to the target database for data query.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage. In the medium, when the computer program is executed, it may include the procedures of the above-mentioned method embodiments. Wherein, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and/or volatile memory. Non-volatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not a limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Channel (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be It is considered as the range described in this specification.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only express several implementation manners of the present application, and their description is relatively specific and detailed, but they should not be understood as a limitation on the scope of the invention patent. It should be pointed out that for those of ordinary skill in the art, without departing from the concept of this application, several modifications and improvements can be made, and these all fall within the protection scope of this application. Therefore, the scope of protection of the patent of this application shall be subject to the appended claims.

Claims (10)

  1. 一种数据分离存储方法,所述方法包括:A data separation storage method, the method includes:
    获取目标用户的各条用户数据;Obtain various pieces of user data of the target user;
    分别确定所述目标用户的各条用户数据的生成时间所处周期;Respectively determine the period in which the generation time of each piece of user data of the target user is in;
    根据各所述生成时间所处周期,将所述目标用户的各条用户数据分离存储到多个数据库中。According to the period of each generation time, each piece of user data of the target user is separately stored in multiple databases.
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:请求为所述目标用户分配当前周期数据库、历史数据库、第一数据库和第二数据库;The method according to claim 1, wherein the method further comprises: requesting to allocate a current period database, a historical database, a first database, and a second database to the target user;
    所述根据各所述生成时间所处周期,将所述目标用户的各条用户数据分离存储到多个数据库中,包括:根据各所述生成时间所处周期,将所述目标用户的各条用户数据分离存储到所述当前周期数据库、所述历史数据库、所述第一数据库和所述第二数据库中;Said separating and storing each piece of user data of the target user into multiple databases according to the period of each generation time includes: storing each piece of the target user according to the period of each generation time. User data is stored separately in the current period database, the historical database, the first database and the second database;
    其中,所述当前周期数据库用于存储所述目标用户的所述生成时间所处周期为当前周期的用户数据,所述历史数据库用于存储所述目标用户的所述生成时间所处周期为历史周期的用户数据,所述第一数据库用于存储所述目标用户的所述生成时间所处周期为当前周期以及上一周期的用户数据,所述第二数据库用于存储所述目标用户的所述生成时间所处周期为当前周期以及下一周期的用户数据。Wherein, the current period database is used to store user data in which the period of the generation time of the target user is the current period, and the history database is used to store the period in which the generation time of the target user is in the history Periodic user data, the first database is used to store user data in the current period and the previous period of the generation time of the target user, and the second database is used to store all user data of the target user The period of the generation time is the user data of the current period and the next period.
  3. 根据权利要求2所述的方法,其特征在于,所述目标用户的各条用户数据包括所述目标用户的新生成数据和各条历史数据;The method according to claim 2, wherein each piece of user data of the target user includes newly generated data of the target user and each piece of historical data;
    所述根据各所述生成时间所处周期,将所述目标用户的各条用户数据分离存储到所述当前周期数据库、所述历史数据库、所述第一数据库和所述第二数据库中,包括:Said storing each piece of user data of said target user separately in said current period database, said historical database, said first database and said second database according to the period in which each said generation time is located, including :
    将所述目标用户的新生成数据分别存储到所述当前周期数据库、所述第一数据库和所述第二数据库中;Storing the newly generated data of the target user in the current period database, the first database and the second database respectively;
    按照所述目标用户的各条历史数据的生成时间所处周期,将所述目标用户的各条历史数据分离存储到所述当前周期数据库、所述历史数据库和所述第一数据库中。Separately store each piece of historical data of the target user in the current period database, the historical database, and the first database according to the period in which each piece of historical data of the target user is generated.
  4. 根据权利要求3所述的方法,其特征在于,所述将所述目标用户的新生 成数据分别存储到所述当前周期数据库、所述第一数据库和所述第二数据库中,包括:The method according to claim 3, wherein said storing the new birth data of the target user in the current period database, the first database and the second database, respectively, comprises:
    将所述目标用户的新生成数据写入所述当前周期数据库中;Write the newly generated data of the target user into the current cycle database;
    根据将所述目标用户的新生成数据写入所述当前周期数据库产生的操作日志,并通过异步方式将所述目标用户的新生成数据写入所述第一数据库和所述第二数据库中。According to the operation log generated by writing the newly generated data of the target user into the current periodic database, and writing the newly generated data of the target user into the first database and the second database in an asynchronous manner.
  5. 根据权利要求2至4任意一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 2 to 4, wherein the method further comprises:
    在进入下一周期之前,请求为所述目标用户分配新的当前周期数据库和新的第二数据库;Before entering the next cycle, request to allocate a new current cycle database and a new second database to the target user;
    在进入下一周期之后,将当前周期对应的所述目标用户的当前周期数据库中的数据,迁移到所述目标用户的历史数据库,将所述目标用户的当前周期对应的第二数据库作为所述目标用户的新的第一数据库;After entering the next cycle, the data in the current cycle database of the target user corresponding to the current cycle is migrated to the historical database of the target user, and the second database corresponding to the current cycle of the target user is used as the The new first database of target users;
    在数据迁移完成后,销毁所述目标用户的当前周期对应的当前周期数据库,以及所述目标用户的当前周期对应的第一数据库。After the data migration is completed, the current period database corresponding to the current period of the target user and the first database corresponding to the current period of the target user are destroyed.
  6. 根据权利要求2至4任意一项所述的方法,其特征在于,所述方法还包括:按照用户维度对用户数据进行分片处理,分片处理之后的各分片用户的用户数据分别作为所述目标用户的各条用户数据。The method according to any one of claims 2 to 4, characterized in that the method further comprises: fragmenting user data according to the user dimension, and the user data of each fragmented user after the fragmentation processing is used as the user data. Describe each piece of user data of the target user.
  7. 根据权利要求2或3所述的方法,其特征在于,所述方法还包括:The method according to claim 2 or 3, wherein the method further comprises:
    接收到所述目标用户的用户数据修改请求时,查询待修改用户数据的生成周期信息;When receiving the user data modification request of the target user, query the generation period information of the user data to be modified;
    在根据查询到的生成周期信息确定的周期为当前周期时,将所述用户数据修改请求路由到所述目标用户对应的当前周期数据库进行数据修改;When the period determined according to the queried generation period information is the current period, routing the user data modification request to the current period database corresponding to the target user for data modification;
    在根据查询到的生成周期信息确定的周期为历史周期时,将所述用户数据修改请求路由到所述目标用户对应的历史数据库进行数据修改;When the period determined according to the queried generation period information is a historical period, routing the user data modification request to the historical database corresponding to the target user for data modification;
    或者/和Or/and
    接收到所述目标用户的用户数据查询请求时,根据所述查询请求所携带的查询条件确定查询类型;When receiving the user data query request of the target user, determine the query type according to the query condition carried in the query request;
    在所述查询类型是按周期查询时,若根据所述查询条件确定的查询周期为当前周期,则将所述用户数据查询请求路由到所述目标用户对应的当前周期数据库进行数据查询,若根据所述查询条件确定的查询周期为历史周期,则将所述用户数据查询请求路由到所述目标用户对应的历史数据库进行数据查询;When the query type is a periodical query, if the query period determined according to the query conditions is the current period, the user data query request is routed to the current period database corresponding to the target user for data query, if If the query period determined by the query condition is a historical period, the user data query request is routed to the historical database corresponding to the target user for data query;
    在所述查询类型是按时段查询时,根据所述查询条件确定的查询时段对应的起始时间和结束时间;When the query type is query by time period, the start time and end time corresponding to the query time period determined according to the query conditions;
    根据所述起始时间和所述结束时间,确定与所述起始时间和所述结束时间匹配的所述目标用户的目标数据库,将所述用户数据查询请求路由到所述目标数据库进行数据查询。According to the start time and the end time, determine the target database of the target user that matches the start time and the end time, and route the user data query request to the target database for data query .
  8. 一种数据分离存储装置,其特征在于,所述装置包括:A data separation storage device, characterized in that the device comprises:
    数据获取模块,用于获取目标用户的各条用户数据;The data acquisition module is used to acquire various pieces of user data of the target user;
    周期确定模块,用于分别确定所述目标用户的各条用户数据的生成时间所处周期;A cycle determining module, configured to separately determine the cycle in which the generation time of each piece of user data of the target user is located;
    分离存储模块,用于根据各所述生成时间所处周期,将所述目标用户的各条用户数据分离存储到多个数据库中。The separate storage module is used to separate and store each piece of user data of the target user into multiple databases according to the period of each generation time.
  9. 一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至7中任一项所述方法的步骤。A computer device, comprising a memory, a processor, and a computer program stored on the memory and running on the processor, wherein the processor implements any one of claims 1 to 7 when the computer program is executed The steps of the method.
  10. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至7中任一项所述的方法的步骤。A computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the method according to any one of claims 1 to 7 when the computer program is executed by a processor.
PCT/CN2020/105962 2019-09-27 2020-07-30 Data separation and storage method and apparatus, computer device and storage medium WO2021057253A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CA3156068A CA3156068A1 (en) 2019-09-27 2020-07-30 Method of separately storing data, device, computer equipment and storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910924306.9 2019-09-27
CN201910924306.9A CN110795427B (en) 2019-09-27 2019-09-27 Data separation storage method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2021057253A1 true WO2021057253A1 (en) 2021-04-01

Family

ID=69439997

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/105962 WO2021057253A1 (en) 2019-09-27 2020-07-30 Data separation and storage method and apparatus, computer device and storage medium

Country Status (3)

Country Link
CN (1) CN110795427B (en)
CA (1) CA3156068A1 (en)
WO (1) WO2021057253A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114296826A (en) * 2021-12-29 2022-04-08 中国电信股份有限公司 Data loading method and device, electronic equipment and nonvolatile storage medium

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110795427B (en) * 2019-09-27 2022-10-11 苏宁云计算有限公司 Data separation storage method and device, computer equipment and storage medium
CN113704346A (en) * 2020-05-20 2021-11-26 杭州海康威视数字技术股份有限公司 Hbase table cold and hot data conversion method and device and electronic equipment
CN111625600B (en) * 2020-05-21 2023-10-31 杭州安恒信息技术股份有限公司 Data storage processing method, system, computer equipment and storage medium
CN112286935A (en) * 2020-10-30 2021-01-29 上海淇玥信息技术有限公司 Scheduling method and device based on scheduling platform and electronic equipment
CN112380217B (en) * 2020-11-17 2024-04-12 安徽鸿程光电有限公司 Data processing method, device, equipment and medium
CN112631517B (en) * 2020-12-24 2021-09-03 北京百度网讯科技有限公司 Data storage method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7716135B2 (en) * 2004-01-29 2010-05-11 International Business Machines Corporation Incremental compliance environment, an enterprise-wide system for detecting fraud
CN103605805A (en) * 2013-12-09 2014-02-26 冶金自动化研究设计院 Storage method of massive time series data
CN104063441A (en) * 2014-06-12 2014-09-24 北京东进航空科技股份有限公司 Database operation maintenance system and data operation maintenance method thereof
CN105162622A (en) * 2015-08-03 2015-12-16 瑞斯康达科技发展股份有限公司 Storage method and system
CN110795427A (en) * 2019-09-27 2020-02-14 苏宁云计算有限公司 Data separation storage method and device, computer equipment and storage medium

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5212788A (en) * 1990-05-22 1993-05-18 Digital Equipment Corporation System and method for consistent timestamping in distributed computer databases
US5448625A (en) * 1993-04-13 1995-09-05 Msi Electronics Inc. Telephone advertising method and apparatus
CN102495862B (en) * 2011-11-24 2014-04-16 神华集团有限责任公司 Data integrating method and system for coal liquefying device
CN103793382B (en) * 2012-10-26 2019-09-20 腾讯科技(北京)有限公司 A kind of data processing method and system of database
CN103617161A (en) * 2013-09-26 2014-03-05 金蝶软件(中国)有限公司 Data storing method and device for SAAS mode
CN107704590A (en) * 2017-09-30 2018-02-16 深圳市华傲数据技术有限公司 A kind of data processing method and system based on data warehouse
CN107807969A (en) * 2017-10-18 2018-03-16 上海华电电力发展有限公司 New time series data storage method for power plant
CN108427772B (en) * 2018-04-10 2020-07-28 携程商旅信息服务(上海)有限公司 Online report generation method, system, equipment and storage medium
CN109360048A (en) * 2018-09-26 2019-02-19 中国平安人寿保险股份有限公司 Order generation method, system, computer equipment and storage medium
CN109408508A (en) * 2018-09-30 2019-03-01 广州恩业电子科技有限公司 The storage and querying method of monitoring data, device and computer equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7716135B2 (en) * 2004-01-29 2010-05-11 International Business Machines Corporation Incremental compliance environment, an enterprise-wide system for detecting fraud
CN103605805A (en) * 2013-12-09 2014-02-26 冶金自动化研究设计院 Storage method of massive time series data
CN104063441A (en) * 2014-06-12 2014-09-24 北京东进航空科技股份有限公司 Database operation maintenance system and data operation maintenance method thereof
CN105162622A (en) * 2015-08-03 2015-12-16 瑞斯康达科技发展股份有限公司 Storage method and system
CN110795427A (en) * 2019-09-27 2020-02-14 苏宁云计算有限公司 Data separation storage method and device, computer equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114296826A (en) * 2021-12-29 2022-04-08 中国电信股份有限公司 Data loading method and device, electronic equipment and nonvolatile storage medium

Also Published As

Publication number Publication date
CN110795427A (en) 2020-02-14
CA3156068A1 (en) 2021-04-01
CN110795427B (en) 2022-10-11

Similar Documents

Publication Publication Date Title
WO2021057253A1 (en) Data separation and storage method and apparatus, computer device and storage medium
WO2021003985A1 (en) Blockchain data archiving storage method and apparatus, computer device and storage medium
US10459899B1 (en) Splitting database partitions
US10719260B2 (en) Techniques for storing and retrieving data from a computing device
CN107710200B (en) System and method for parallelizing hash-based operators in SMP databases
US20190121926A1 (en) Graph centrality calculation method and apparatus, and storage medium
WO2017167095A1 (en) Model training method and device
WO2016180055A1 (en) Method, device and system for storing and reading data
WO2019001017A1 (en) Inter-cluster data migration method and system, server, and computer storage medium
US20150281114A1 (en) Systems and methods for allocating work for various types of services among nodes in a distributed computing system
JP2016502370A (en) Method and apparatus for matching flow tables and switch
WO2018161881A1 (en) Structuralized data processing method, data storage medium, and computer apparatus
WO2018036549A1 (en) Distributed database query method and device, and management system
WO2020052379A1 (en) Method and apparatus for processing metadata of object in distributed storage system
CN112015820A (en) Method, system, electronic device and storage medium for implementing distributed graph database
US20140279044A1 (en) System and method for omni-channel identity matching
WO2022111313A1 (en) Request processing method and micro-service system
CN115039089A (en) Warm tier storage for search services
WO2017174013A1 (en) Data storage management method and apparatus, and data storage system
CN112613271A (en) Data paging method and device, computer equipment and storage medium
US10083121B2 (en) Storage system and storage method
CN110888872A (en) Data storage method and device, computer equipment and storage medium
CN111178024A (en) Data table splicing method and device, computer equipment and storage medium
CN113448739B (en) Data processing method and device
CN113297226B (en) Data storage method, data reading device, electronic equipment and medium

Legal Events

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

Ref document number: 20869347

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 3156068

Country of ref document: CA

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20869347

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 20869347

Country of ref document: EP

Kind code of ref document: A1