CN110827072A - Data query and storage method and system - Google Patents

Data query and storage method and system Download PDF

Info

Publication number
CN110827072A
CN110827072A CN201911052330.4A CN201911052330A CN110827072A CN 110827072 A CN110827072 A CN 110827072A CN 201911052330 A CN201911052330 A CN 201911052330A CN 110827072 A CN110827072 A CN 110827072A
Authority
CN
China
Prior art keywords
bitmap
triggered
event
data
time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911052330.4A
Other languages
Chinese (zh)
Inventor
黄文华
王帅
周家英
连文珑
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou Information Technology Co Ltd
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 Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN201911052330.4A priority Critical patent/CN110827072A/en
Publication of CN110827072A publication Critical patent/CN110827072A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • G06Q30/0207Discounts or incentives, e.g. coupons or rebates
    • G06Q30/0224Discounts or incentives, e.g. coupons or rebates based on user history
    • 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
    • G06F16/2228Indexing structures
    • G06F16/2246Trees, e.g. B+trees
    • 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/248Presentation of query results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • G06Q30/0207Discounts or incentives, e.g. coupons or rebates
    • G06Q30/0226Incentive systems for frequent usage, e.g. frequent flyer miles programs or point systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Strategic Management (AREA)
  • Finance (AREA)
  • Development Economics (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Data Mining & Analysis (AREA)
  • Game Theory and Decision Science (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • General Business, Economics & Management (AREA)
  • Software Systems (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a data query and storage method and system. The data storage method comprises the following steps: reading a bitmap from a storage device when an appointment event is triggered, wherein each bitmap is used for storing information that the appointment event is triggered within a period of time, and each bit in the bitmap corresponds to whether the appointment event is triggered at an appointment time; calculating the position of a bit needing to be operated in the bitmap according to the triggered time of the appointment event, and setting the bit of the position in the bitmap as a value representing that the appointment event is triggered; and writing the modified bitmap back to the storage device to replace the bitmap before modification.

Description

Data query and storage method and system
Technical Field
This specification relates to computer data storage technology.
Background
At present, in order to improve daily activity of commodities and enhance user viscosity, the following application scenarios are frequently encountered: the merchant needs to count the information of a certain action continuously executed by the user, and then, different strategies are formulated according to the statistical information for promotion or marketing. Such as: different numbers of points are given according to the number of times of continuous login of the user, the user can acquire Vip trial permission after continuously logging in for 7 days, and the user can acquire discount coupons of certain products after continuously logging in for 10 days.
However, in the conventional scheme, one card punching record corresponds to one piece of data (for example, one record in a database or one line of data in a log file), and the data includes information such as an identifier of a card punch, card punching time, and the like, which results in a large data volume, not only waste of storage space, but also excessive data loading during query, reduced query efficiency, and reduced concurrent throughput.
Disclosure of Invention
The specification provides a data query and storage method and system, which can save storage space, reduce delay and improve query efficiency.
The application discloses a data storage method, which comprises the following steps:
reading a bitmap from a storage device when an appointment event is triggered, wherein each bitmap is used for storing information that the appointment event is triggered within a period of time, and each bit in the bitmap corresponds to whether the appointment event is triggered at an appointment time;
calculating the position of a bit needing to be operated in the bitmap according to the triggered time of the appointment event, and setting the bit of the position in the bitmap as a value representing that the appointment event is triggered;
and writing the modified bitmap back to the storage device to replace the bitmap before modification.
In a preferred embodiment, the appointment event is a login operation or a card punching operation.
In a preferred embodiment, the storage device is a database server or a file storage server.
In a preferred embodiment, the reading a bitmap from the storage device when the contract event is triggered further comprises:
the appointed interface is called by a service system, and the service system transmits the triggering time of the appointed event and the main body identifier of the execution main body corresponding to the appointed event to the interface;
and inquiring a bitmap which belongs to the execution main body and covers the trigger time in the storage device according to the main body identification, and loading the bitmap.
The application also discloses a data query method, which comprises the following steps:
acquiring one or more bitmaps from a storage device according to the query condition;
analyzing each bitmap into information that an appointed event is triggered within a period of time, and storing the information in an appointed data structure, wherein the position of each bit in the bitmap is analyzed as the triggering time that the appointed event is triggered, and the value of each bit in the bitmap is analyzed as whether the appointed event is triggered at the corresponding triggering time;
and querying the data in the data structure, and returning a query result.
In a preferred embodiment, the data structure is a set of trees.
In a preferred embodiment, the querying the data in the data structure further includes:
and counting the number of times that the appointed event is triggered in the time period defined by the query condition through traversing the tree set.
In a preferred embodiment, the querying the data in the data structure further includes:
and counting the longest continuous triggering times and the corresponding triggering time of the appointed event in the time period defined by the query condition through traversing the tree set.
The application also discloses a data storage system comprising:
the reading module is used for reading a bitmap from a storage device when an appointment event is triggered, wherein each bitmap is used for storing information that the appointment event is triggered within a period of time, and each bit in the bitmap corresponds to whether the appointment event is triggered at an appointment time or not;
the modification module is used for calculating the position of a bit needing to be operated in the bitmap according to the time when the appointment event is triggered, and setting the bit of the position in the bitmap as a value representing that the appointment event is triggered;
and the storage module is used for writing the modified bitmap back to the storage device to replace the bitmap before modification.
In a preferred embodiment, the appointment event is a login operation or a card punching operation.
In a preferred embodiment, the storage device is a database server or a file storage server.
In a preferred embodiment, the method further comprises the following steps:
the first interface is used for being called by a service system and receiving the triggering time of the appointed event triggered and the main body identifier of the execution main body corresponding to the appointed event, wherein the triggering time is transmitted by the service system;
and the reading module inquires a bitmap which belongs to the execution main body and covers the trigger time in the storage device according to the main body identification, and loads the bitmap.
The application also discloses a data query system comprising:
the query module is used for acquiring one or more bitmaps from the storage equipment according to the query condition;
the analysis module is used for analyzing each bitmap into information that an appointed event is triggered within a period of time and storing the information in an appointed data structure, wherein the position of each bit in the bitmap is analyzed into the triggering time that the appointed event is triggered, and the value of each bit in the bitmap is analyzed into whether the appointed event is triggered at the corresponding triggering time;
and the feedback module is used for inquiring the data in the data structure and returning an inquiry result.
In a preferred embodiment, the data structure is a set of trees.
In a preferred example, the feedback module queries the data in the data structure by:
and counting the number of times that the appointed event is triggered in the time period defined by the query condition through traversing the tree set.
In a preferred example, the feedback module queries the data in the data structure by:
and counting the longest continuous triggering times and the corresponding triggering time of the appointed event in the time period defined by the query condition through traversing the tree set.
The application also discloses a data storage system comprising:
a memory for storing computer executable instructions; and the number of the first and second groups,
a processor, coupled with the memory, for implementing the steps in the method as described above when executing the computer-executable instructions.
The application also discloses a data query system comprising:
a memory for storing computer executable instructions; and the number of the first and second groups,
a processor, coupled with the memory, for implementing the steps in the method as described above when executing the computer-executable instructions.
The present application also discloses a computer-readable storage medium having stored therein computer-executable instructions which, when executed by a processor, implement the steps in the method as described above.
The data query and storage method and system provided by the embodiment of the specification can save storage space, reduce delay and improve query efficiency.
A large number of technical features are described in the specification, and are distributed in various technical solutions, so that the specification is too long if all possible combinations of the technical features (namely, the technical solutions) in the application are listed. In order to avoid this problem, the respective technical features disclosed in the above summary of the invention of the present specification, the respective technical features disclosed in the following embodiments and examples, and the respective technical features disclosed in the drawings may be freely combined with each other to constitute various new technical solutions (which should be regarded as having been described in the present specification) unless such a combination of the technical features is technically impossible. For example, in one example, the feature a + B + C is disclosed, in another example, the feature a + B + D + E is disclosed, and the features C and D are equivalent technical means for the same purpose, and technically only one feature is used, but not simultaneously employed, and the feature E can be technically combined with the feature C, then the solution of a + B + C + D should not be considered as being described because the technology is not feasible, and the solution of a + B + C + E should be considered as being described.
Drawings
FIG. 1 is a schematic flow chart diagram of a data query method according to a first embodiment of the present description;
FIG. 2 is a schematic flow chart diagram of a data storage method according to a second embodiment of the present description;
FIG. 3 is a schematic structural diagram of a data query system according to a third embodiment of the present specification;
FIG. 4 is a schematic structural diagram of a data storage system according to a fourth embodiment of the present description;
fig. 5 is a schematic diagram of a bitmap in a data query method according to a first embodiment of the present specification.
Detailed Description
In the following description, numerous technical details are set forth in order to provide a better understanding of the present application. However, it will be understood by those skilled in the art that the technical solutions claimed in the present application may be implemented without these technical details and with various changes and modifications based on the following embodiments.
Description of partial concepts:
bitmap: a Bitmap refers to a data structure, which is a set of multiple bits.
A main body: all calculations are performed based on the subject, such as user ID, product ID, policy ID, etc., for the entities around the calculation.
Continuous operator: operators for continuous cases where a statistical body performs or triggers an action, we refer to as continuous operators. For example, the maximum number of consecutive login days for the user is obtained, the main body is the user ID, and the triggered action is clicking a login button and successfully logging in.
Punching a card: the subject triggers an action we call a punch card.
The following first describes some of the points of the embodiments of the present specification:
in this embodiment, a continuous trigger event is recorded in a bitmap, one bit in the bitmap may record information on whether an appointment event is triggered once, a position of each bit may be mapped to an appointment time (e.g., a certain day), one bitmap may record trigger information of multiple events in a continuous time period, when an appointment event (e.g., a card punch or a login) is triggered, the bitmap is read, a position of a bit to be operated in the bitmap is calculated according to the trigger time of the appointment event, and then the bit is set, and the modified bitmap is stored. By the technical scheme, the storage space can be greatly saved.
Furthermore, during query, one or more bitmaps meeting the query conditions are read from the storage device and are analyzed into an appointed data structure, wherein the position of each bit in the bitmap is analyzed as the trigger time of an event, and specific query operation is performed in the data structure, so that the storage space is saved, the data amount to be read from the storage device is greatly reduced, the delay is reduced, and the query efficiency can be greatly improved through an efficient data structure (such as TreeSet).
Embodiments of the present description will be described in further detail below with reference to the accompanying drawings.
A first embodiment of the present specification relates to a data storage method, a flow of which is shown in fig. 1, the method including the steps of:
step 110: when a contract event is triggered, reading a bitmap from a storage device, wherein each bitmap is used for storing information that the contract event is triggered in a period of time, and each bit in the bitmap corresponds to whether the contract event is triggered at a contract time. For example, a bitmap may include 4 bytes, which have 32 bits, and is used to store whether a user triggers a certain operation (e.g., card punching, login, etc.) every day of a month, where each bit represents one day, and if the user triggers the operation, the corresponding position is set to 1, otherwise, the corresponding position is set to 0; as can be seen from FIG. 5, bit 1 of the first byte corresponds to punch-in condition No. 1 of the month (1 is punch-in, 0 is not punch-in), bit 2 of the 3 rd byte represents punch-in condition No. 18 of the month, bit 6 of the 4 th byte represents punch-in record No. 30 of the month, and so on.
Step 120: and calculating the position of the bit needing to be operated in the bitmap according to the triggered time of the appointment event, and setting the bit at the position in the bitmap as a value representing that the appointment event is triggered.
Step 130: and writing the modified bitmap back to the storage device to replace the bitmap before modification. The bitmap before modification is the one that was read from the storage device when the contract event was triggered.
Each step is explained in detail below.
For step 110:
optionally, in this embodiment of the present specification, the appointment event may be a login operation, or a card punching operation, or the like.
Alternatively, in the embodiments of the present specification, the storage device may be a database server, or a file storage server, or the like. That is, the bitmap may be stored in the database, for example, as a field in the database, or may be stored in a file.
Optionally, in the embodiments of the present specification, the meaning represented by the value of each bit in the bitmap may be set according to needs, for example, in one embodiment, 1 may be used to indicate that a card has been punched, and 0 may be used to indicate that no card has been punched, and in another embodiment, 0 may be used to indicate that a card has been punched, and 1 may be used to indicate that no card has been punched.
Note that in one embodiment, the same scene is in the same row (e.g., a record in the database) with the data of the same subject for one month, so that only the row of the month in which the requested time is located needs to be loaded.
More specifically, in one embodiment, the reading a bitmap from the storage device when the contract event is triggered further comprises the steps of:
firstly, a designated interface is called by a service system, and the service system transmits the triggering time of the appointed event and the main body identifier of the execution main body corresponding to the appointed event to the interface;
then, according to the main body mark, inquiring the bitmap which belongs to the execution main body and covers the trigger time in the storage device, and loading the bitmap.
Optionally, in another embodiment, the time when the contract event is triggered may not be transmitted, and the time when the interface is called is directly used as the time when the contract event is triggered.
Optionally, in an embodiment, after the specified interface is called by the service system, a validity check may be performed on the parameters incoming from the interface, and after the check is passed, steps such as querying and loading the bitmap are performed.
For step 120:
specifically, in this step, the position of the bit needing to be operated in the bitmap is calculated according to the time when the appointment event is triggered, and the bit at the position in the bitmap is set to a value representing that the appointment event is triggered. For example, a bitmap stores whether a user has punched a card every day of a month in 32 bits, and if the punching time is 8 th of the month, the 8 th bit in the bitmap may be set to 1. Each bit is set to 0 when the bitmap is initialized, and if no card is punched at the 10 th day, the 10 th bit of the bitmap is maintained as 0.
For step 130:
optionally, in one embodiment, the replaced bitmap may also be backed up before replacement.
In the above embodiment, by recording the continuous trigger event in the bitmap, one bit in the bitmap may record information on whether an appointment event is triggered once, a position of each bit may be mapped to an appointment time, one bitmap may record trigger information of a plurality of events in a continuous time period, when the appointment event is triggered, the bitmap is read, a position of a bit to be operated in the bitmap is calculated according to the trigger time of the appointment event, and then the bit is set, and the modified bitmap is stored, thereby greatly saving the storage space.
A second embodiment of the present specification relates to a data query method, as illustrated in fig. 2, including:
step 210: one or more bitmaps are retrieved from the storage device according to the query condition. For example, if a user in 2018 is queried for the longest consecutive number of login days in the last half of the year, and each month's login records are stored using a 4-byte bitmap, then the 6 bitmaps that replace the list 2018 of login records from 1 month to 6 months in the year can be read from the database.
Step 220: analyzing each bitmap into information that an appointed event is triggered within a period of time, and storing the information in an appointed data structure, wherein the position of each bit in the bitmap is analyzed as the triggering time that the appointed event is triggered, and the value of each bit in the bitmap is analyzed as whether the appointed event is triggered at the corresponding triggering time;
step 230: and querying the data in the data structure, and returning a query result.
Each step is explained in detail below.
For step 220:
optionally, in an embodiment, the triggering time and the information whether to be triggered corresponding to each bit in the bitmap are both saved in an agreed data structure.
Optionally, in an embodiment of the present specification, only the trigger time corresponding to the bit with the median value of 1 in the bitmap may be saved in an agreed data structure; it is also possible to save only the trigger time corresponding to the bit with a value of 0 in the bitmap into an agreed data structure.
Optionally, in one embodiment, the data structure is a set of trees. For example, if a 4-byte bitmap corresponds to 2019 for month 1, and the 5 th bit of the first byte is 1 (representing that a card has been punched), 2019-1-5 is added to the TreeSet, if the 2 nd bit of the 2 nd byte is 1, 2019-1-10 is added to the TreeSet, and so on. The tree Set (TreeSet) is a data structure of Java, which provides an ordered Set, has a de-duplication function, is convenient to use, and is a preferred data structure.
Optionally, in an embodiment, the information in the multiple bitmaps may be parsed into the same agreed data structure, for example, each 4-byte bitmap stores information about whether a user has logged in every day for one month, and the information in the 12 bitmaps may be parsed into the same TreeSet data structure, so that the information in the TreeSet is about whether the user has logged in every day for one year.
Alternatively, in other embodiments of the present description, other data structures in order may be used, such as linked lists, etc. In certain application scenarios, unordered data structures, such as sets, may also be used, as long as querying is facilitated.
For step 230:
optionally, in an embodiment, step 230 further includes the following steps: and counting the number of times that the appointed event is triggered in the time period limited by the query condition for traversing the tree set. Further, the method can also comprise the following steps: and counting the longest continuous triggering times and the corresponding triggering time of the appointed event in the time period defined by the query condition through traversing the tree set.
In the above embodiment, when querying, one or more bitmaps meeting the query condition are read from the storage device and parsed into an agreed data structure, where the position of each bit in the bitmap is parsed into the trigger time of the event, and a specific querying operation is performed in the data structure, so that not only is the storage space saved, the data amount to be read from the storage device is greatly reduced, and the delay is reduced, but also the querying efficiency can be greatly improved through an efficient data structure (e.g., TreeSet).
The first embodiment is an embodiment of a data storage method corresponding to the data query method of the present embodiment, and the technical details of the first embodiment may be applied to the present embodiment, and the technical details of the present embodiment may also be applied to the first embodiment.
A third embodiment of the present specification relates to a data storage system, as illustrated in fig. 3, including:
the reading module is used for reading a bitmap from a storage device when a contract event is triggered, wherein each bitmap is used for storing information that the contract event is triggered in a period of time, and each bit in the bitmap corresponds to whether the contract event is triggered at a contract time. Optionally, in an embodiment of the present specification, the appointment event is a login operation or a card punching operation, and the like. Optionally, in the embodiments of the present specification, the storage device is a database server or a file storage server, or the like, in other words, the bitmap may be stored in the database, for example, as a field in the database, or may be stored in a file. Optionally, in an embodiment, the same scene is in the same row (for example, one record in the database) with the data of the same subject for one month, so that only the record in the row of the month in which the request time is located needs to be loaded here.
The modification module is used for calculating the position of a bit needing to be operated in the bitmap according to the time when the appointment event is triggered, and setting the bit of the position in the bitmap as a value representing that the appointment event is triggered;
and the storage module is used for writing the modified bitmap back to the storage device to replace the bitmap before modification. Optionally, in one embodiment, the bitmap before modification is the bitmap that was read from the storage device when the contract event was triggered. Optionally, in one embodiment, the replaced bitmap may also be backed up before replacement. Optionally, in the embodiments of the present specification, the meaning represented by the value of each bit in the bitmap may be set according to needs, for example, in one embodiment, 1 may be used to indicate that a card has been punched, and 0 may be used to indicate that no card has been punched; in another embodiment, the reverse is also possible, with 0 indicating a punch-in and 1 indicating no punch-in.
Optionally, in an embodiment, the data storage system further includes:
and the first interface is used for being called by the service system and receiving the triggering time of the appointed event transmitted by the service system, and the main body identifier of the execution main body corresponding to the appointed event.
Correspondingly, the reading module inquires a bitmap which belongs to the execution main body and covers the trigger time in the storage device according to the main body identification, and loads the bitmap.
Optionally, in another embodiment, the time when the contract event is triggered may not be transmitted, and the time when the interface is called is directly used as the time when the contract event is triggered.
Optionally, in an embodiment, the data storage system further includes:
and the parameter validity checking module is used for checking the validity of the parameters transmitted from the interface after the specified interface is called by the service system.
The first embodiment is a method embodiment corresponding to the present embodiment, and the technical details in the first embodiment may be applied to the present embodiment, and the technical details in the present embodiment may also be applied to the first embodiment.
A fourth embodiment of the present specification relates to a data query system, as illustrated in fig. 4, including:
and the query module is used for acquiring one or more bitmaps from the storage equipment according to the query condition.
The analysis module is used for analyzing each bitmap into information that an appointed event is triggered in a period of time and storing the information in an appointed data structure, wherein the position of each bit in the bitmap is analyzed into the triggering time that the appointed event is triggered, and the value of each bit in the bitmap is analyzed into whether the appointed event is triggered at the corresponding triggering time. Optionally, in one embodiment, the data structure is a tree Set, wherein a tree Set (TreeSet) is a data structure of Java, which is operative to provide an ordered Set, and which has a de-duplication function, is convenient to use, and is therefore a preferred data structure. Additionally, in other embodiments of the present description, other data structures in order may be used, such as linked lists, and the like. Alternatively, in a specific application scenario, it is also possible if an unordered data structure, such as a set, is to be used, as long as querying is facilitated. Optionally, in an embodiment, the triggering time and the information whether to be triggered corresponding to each bit in the bitmap are both saved in an agreed data structure. Optionally, in an embodiment of the present specification, only the trigger time corresponding to the bit with the median value of 1 in the bitmap may be saved in an agreed data structure; it is also possible to save only the trigger time corresponding to the bit with a value of 0 in the bitmap into an agreed data structure.
And the feedback module is used for inquiring the data in the data structure and returning an inquiry result. Optionally, in an embodiment, the feedback module queries the data in the data structure by: and counting the number of times that the appointed event is triggered in the time period defined by the query condition through traversing the tree set. Further optionally, in an embodiment, through traversing the tree set, the number of times the appointment event is continuously triggered longest within the time period defined by the query condition and the corresponding trigger time are counted.
The second embodiment is a method embodiment corresponding to the present embodiment, and the technical details in the second embodiment may be applied to the present embodiment, and the technical details in the present embodiment may also be applied to the first embodiment.
It should be noted that, those skilled in the art should understand that the implementation functions of the modules shown in the embodiments of the data storage system and the data query system can be understood by referring to the related descriptions of the data storage method and the data query method. The functions of the modules shown in the embodiments of the data storage system and the data query system described above may be implemented by a program (executable instructions) running on a processor, and may also be implemented by specific logic circuits. The data storage system and the data query system in the embodiments of the present description may also be stored in a computer-readable storage medium if they are implemented in the form of software functional modules and sold or used as independent products. Based on such understanding, the technical solutions of the embodiments of the present specification may be essentially or partially implemented in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the methods described in the embodiments of the present specification. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read Only Memory (ROM), a magnetic disk, or an optical disk. Thus, embodiments of the present description are not limited to any specific combination of hardware and software.
Accordingly, the present specification embodiments also provide a computer-readable storage medium having stored therein computer-executable instructions that, when executed by a processor, implement the method embodiments of the present specification. Computer-readable storage media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable storage medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
In addition, the present specification embodiments also provide a data storage system and a data query system, which include a memory for storing computer executable instructions, and a processor; the processor is configured to implement the steps of the method embodiments described above when executing the computer-executable instructions in the memory.
In one embodiment, the computer-executable instructions may be for: reading a bitmap from a storage device when an appointment event is triggered, wherein each bitmap is used for storing information that the appointment event is triggered within a period of time, and each bit in the bitmap corresponds to whether the appointment event is triggered at an appointment time; calculating the position of a bit needing to be operated in the bitmap according to the triggered time of the appointment event, and setting the bit of the position in the bitmap as a value representing that the appointment event is triggered; and writing the modified bitmap back to the storage device to replace the bitmap before modification.
In another embodiment, the computer-executable instructions may be for: acquiring one or more bitmaps from a storage device according to the query condition; analyzing each bitmap into information that an appointed event is triggered within a period of time, and storing the information in an appointed data structure, wherein the position of each bit in the bitmap is analyzed as the triggering time that the appointed event is triggered, and the value of each bit in the bitmap is analyzed as whether the appointed event is triggered at the corresponding triggering time; and querying the data in the data structure, and returning a query result.
In one embodiment, the Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), or the like. The aforementioned memory may be a read-only memory (ROM), a Random Access Memory (RAM), a Flash memory (Flash), a hard disk, or a solid state disk. The steps of the method disclosed in the embodiments of the present invention may be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor. In one embodiment, the data storage system or data querying system further comprises a bus and a communication interface. The processor, memory and communication interface are all interconnected by a bus. The communication interface may be a wireless communication interface or a wired communication interface for enabling the processor to communicate with other devices.
It is noted that, in the present patent application, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, the use of the verb "comprise a" to define an element does not exclude the presence of another, same element in a process, method, article, or apparatus that comprises the element. In the present patent application, if it is mentioned that a certain action is executed according to a certain element, it means that the action is executed according to at least the element, and two cases are included: performing the action based only on the element, and performing the action based on the element and other elements. The expression of a plurality of, a plurality of and the like includes 2, 2 and more than 2, more than 2 and more than 2.
All documents mentioned in this specification are to be considered as being incorporated in their entirety into the disclosure of this specification so as to be subject to modification as necessary. It should be understood that the above description is only a preferred embodiment of the present disclosure, and is not intended to limit the scope of the present disclosure. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of the present disclosure should be included in the scope of protection of one or more embodiments of the present disclosure.
In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.

Claims (19)

1. A method of data storage, comprising:
reading a bitmap from a storage device when an appointment event is triggered, wherein each bitmap is used for storing information that the appointment event is triggered within a period of time, and each bit in the bitmap corresponds to whether the appointment event is triggered at an appointment time;
calculating the position of a bit needing to be operated in the bitmap according to the triggered time of the appointment event, and setting the bit of the position in the bitmap as a value representing that the appointment event is triggered;
and writing the modified bitmap back to the storage device to replace the bitmap before modification.
2. A data storage method as claimed in claim 1, wherein the appointment event is a login operation or a card punch operation.
3. A data storage method as claimed in claim 1, wherein said storage device is a database server or a file storage server.
4. The data storage method of claim 1, wherein said reading a bitmap from the storage device when the commitment event is triggered, further comprising:
the appointed interface is called by a service system, and the service system transmits the triggering time of the appointed event and the main body identifier of the execution main body corresponding to the appointed event to the interface;
and inquiring a bitmap which belongs to the execution main body and covers the trigger time in the storage device according to the main body identification, and loading the bitmap.
5. A method of data query, comprising:
acquiring one or more bitmaps from a storage device according to the query condition;
analyzing each bitmap into information that an appointed event is triggered within a period of time, and storing the information in an appointed data structure, wherein the position of each bit in the bitmap is analyzed as the triggering time that the appointed event is triggered, and the value of each bit in the bitmap is analyzed as whether the appointed event is triggered at the corresponding triggering time;
and querying the data in the data structure, and returning a query result.
6. The data query method of claim 1, wherein the data structure is a set of trees.
7. The data query method of claim 6, wherein the querying the data in the data structure further comprises:
and counting the number of times that the appointed event is triggered in the time period defined by the query condition through traversing the tree set.
8. The data query method of claim 7, wherein the querying the data in the data structure further comprises:
and counting the longest continuous triggering times and the corresponding triggering time of the appointed event in the time period defined by the query condition through traversing the tree set.
9. A data storage system, comprising:
the reading module is used for reading a bitmap from a storage device when an appointment event is triggered, wherein each bitmap is used for storing information that the appointment event is triggered within a period of time, and each bit in the bitmap corresponds to whether the appointment event is triggered at an appointment time or not;
the modification module is used for calculating the position of a bit needing to be operated in the bitmap according to the time when the appointment event is triggered, and setting the bit of the position in the bitmap as a value representing that the appointment event is triggered;
and the storage module is used for writing the modified bitmap back to the storage device to replace the bitmap before modification.
10. The data storage system of claim 9, wherein the appointment event is a login operation or a card punch operation.
11. The data storage system of claim 9, wherein the storage device is a database server or a file storage server.
12. The data storage system of claim 9, further comprising:
the first interface is used for being called by a service system and receiving the triggering time of the appointed event triggered and the main body identifier of the execution main body corresponding to the appointed event, wherein the triggering time is transmitted by the service system;
and the reading module inquires a bitmap which belongs to the execution main body and covers the trigger time in the storage device according to the main body identification, and loads the bitmap.
13. A data query system, comprising:
the query module is used for acquiring one or more bitmaps from the storage equipment according to the query condition;
the analysis module is used for analyzing each bitmap into information that an appointed event is triggered within a period of time and storing the information in an appointed data structure, wherein the position of each bit in the bitmap is analyzed into the triggering time that the appointed event is triggered, and the value of each bit in the bitmap is analyzed into whether the appointed event is triggered at the corresponding triggering time;
and the feedback module is used for inquiring the data in the data structure and returning an inquiry result.
14. The data query system of claim 13, wherein the data structure is a set of trees.
15. The data query system of claim 14, wherein the feedback module queries the data in the data structure by:
and counting the number of times that the appointed event is triggered in the time period defined by the query condition through traversing the tree set.
16. The data query system of claim 15, wherein the feedback module queries the data in the data structure by:
and counting the longest continuous triggering times and the corresponding triggering time of the appointed event in the time period defined by the query condition through traversing the tree set.
17. A data storage system, comprising:
a memory for storing computer executable instructions; and the number of the first and second groups,
a processor, coupled with the memory, for implementing the steps in the method of any of claims 1-4 when executing the computer-executable instructions.
18. A data query system, comprising:
a memory for storing computer executable instructions; and the number of the first and second groups,
a processor, coupled with the memory, for implementing the steps in the method of any of claims 5 to 8 when executing the computer-executable instructions.
19. A computer-readable storage medium having stored thereon computer-executable instructions which, when executed by a processor, implement the steps in the method of any one of claims 1 to 8.
CN201911052330.4A 2019-10-31 2019-10-31 Data query and storage method and system Pending CN110827072A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911052330.4A CN110827072A (en) 2019-10-31 2019-10-31 Data query and storage method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911052330.4A CN110827072A (en) 2019-10-31 2019-10-31 Data query and storage method and system

Publications (1)

Publication Number Publication Date
CN110827072A true CN110827072A (en) 2020-02-21

Family

ID=69551668

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911052330.4A Pending CN110827072A (en) 2019-10-31 2019-10-31 Data query and storage method and system

Country Status (1)

Country Link
CN (1) CN110827072A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113282247A (en) * 2021-06-24 2021-08-20 京东科技控股股份有限公司 Data storage method, data reading method, data storage device, data reading device and electronic equipment
CN114356972A (en) * 2021-12-03 2022-04-15 四川科瑞软件有限责任公司 Data processing method, and event time-based retrieval method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107239536A (en) * 2017-05-31 2017-10-10 北京凤凰理理它信息技术有限公司 Business datum querying method, device, system, storage medium and electronic equipment
CN109614399A (en) * 2018-11-15 2019-04-12 金蝶软件(中国)有限公司 Bitmap data querying method, device, computer equipment and storage medium
CN110523083A (en) * 2019-09-05 2019-12-03 网易(杭州)网络有限公司 Processing method, device and the server device of log-in events

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107239536A (en) * 2017-05-31 2017-10-10 北京凤凰理理它信息技术有限公司 Business datum querying method, device, system, storage medium and electronic equipment
CN109614399A (en) * 2018-11-15 2019-04-12 金蝶软件(中国)有限公司 Bitmap data querying method, device, computer equipment and storage medium
CN110523083A (en) * 2019-09-05 2019-12-03 网易(杭州)网络有限公司 Processing method, device and the server device of log-in events

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
LHAO 假装我会写代码: "利用Redis位运算快速实现签到统计功能", 《HTTPS://MP.WEIXIN.QQ.COM/S/EQNPVVYDJVJ-HZXURJXQZG》 *
尉鑫伟 一叶⽽而不不知秋: "【Redis】Bitmap在Redis中的应⽤", 《HTTPS://MP.WEIXIN.QQ.COM/S/6WYBQCGDXIG3GH75QAUX4W》 *
杨淑娟,张万礼: "《Java程序设计教程》", 28 February 2019, 西安电子科技大学出版社 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113282247A (en) * 2021-06-24 2021-08-20 京东科技控股股份有限公司 Data storage method, data reading method, data storage device, data reading device and electronic equipment
CN114356972A (en) * 2021-12-03 2022-04-15 四川科瑞软件有限责任公司 Data processing method, and event time-based retrieval method and device
CN114356972B (en) * 2021-12-03 2022-08-23 四川科瑞软件有限责任公司 Data processing method, and event time-based retrieval method and device

Similar Documents

Publication Publication Date Title
US9665632B2 (en) Managing activities over time in an activity graph
US10467636B2 (en) Implementing retail customer analytics data model in a distributed computing environment
US11664974B2 (en) Summary chains in distributed systems
CN107391532B (en) Data filtering method and device
US10282353B2 (en) Proactive duplicate identification
US20160132496A1 (en) Data filtering
CN110827072A (en) Data query and storage method and system
CN111367760A (en) Log collection method and device, computer equipment and storage medium
CN110321364B (en) Transaction data query method, device and terminal of credit card management system
CN113837584B (en) Service processing system and abnormal data processing method based on service processing system
CN109359109B (en) Data processing method and system based on distributed stream computing
CN114549068A (en) Short link generation method, equipment, device and computer readable storage medium
CN113535669A (en) File uploading method, downloading method and system
CN109597743B (en) Page circling method, click rate statistical method and related equipment
CN107515864A (en) The method and apparatus of control work flows
CN112527803B (en) Data processing method and device and computer equipment
CN104484357A (en) Data processing method and device and access frequency information processing method and device
CN116109322A (en) Data acquisition method, data acquisition device, and computer-readable storage medium
CN108140047B (en) Data processing apparatus and method, and data container structure
CN111045983B (en) Nuclear power station electronic file management method, device, terminal equipment and medium
CN110955547B (en) Management method, system, equipment and readable storage medium for interface abnormal information
CN113902415A (en) Financial data checking method and device, computer equipment and storage medium
CN108897873B (en) Method and device for generating job file, storage medium and processor
CN108810299B (en) Information analysis method, medium and equipment
CN110020348B (en) Early warning method and device for circled events

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20200221

RJ01 Rejection of invention patent application after publication