Label processing method and device of database, computer equipment and storage medium
By generating digital identifiers for user tags and converting them into bitmap data, the label system is generated, and the analysis pressure caused by excessive user tags in the database is solved, which improves data query efficiency and storage space utilization.
Patent Information
- Application Number
- CN202510765655.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-10
- Publication Date
- 2025-07-08
AI Technical Summary
The number of user tags in the database is too high, resulting in too much analysis pressure.
By generating the digital identifier corresponding to the user tag and converting the user data table into bitmap data, the bitmap data generates a tag system to reduce the analysis pressure of the database.
It effectively reduces the database's analysis pressure on labels, improves data query efficiency and storage space utilization.
Smart Images

Figure CN120277250A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data processing, and in particular, to a method and apparatus for processing labels in a database, a computer device, and a storage medium. Background Art
[0002] With the rapid development of Internet and Internet of Things technologies, user databases have collected user data of hundreds of millions of users. Different users have multiple different labels, such as a large number of labels like age, gender, occupation, etc. Through the analysis of user labels, scenarios such as precise advertisement placement and user portrait generation can be carried out.
[0003] However, the number of user labels in the database is very large. The ultra-large scale of label quantity results in a very high analysis pressure on the database for labels. Summary of the Invention
[0004] Embodiments of this application provide a method and apparatus for processing labels in a database, a computer device, and a storage medium, which can reduce the analysis pressure of the database on labels.
[0005] In a first aspect, an embodiment of this application provides a method for processing labels in a database, which includes: Obtain a user data table, where different rows in the user data table represent user data of different users, and different columns represent user label data under different user label types. The user data includes user labels and multiple pieces of user label data; Generate a digital identifier corresponding to each user label in the user data table, and store the correspondence between the user label and the digital identifier; Obtain a query label set, where the query label set includes multiple different query label types, and the query label type carries a query label filtering condition; For each query label type, filter each row in the user data table through the corresponding query label filtering condition, and add the digital identifier corresponding to the row that meets the query label filtering condition to the digital identifier set corresponding to the query label type, to obtain a digital identifier set corresponding to each query label type; Perform bitmap storage processing on each digital identifier set to obtain bitmap data corresponding to each digital identifier set; Generate a label system corresponding to the user data table according to multiple pieces of the bitmap data.
[0006] In a second aspect, an embodiment of this application further provides an apparatus for processing labels in a database, which includes: A transceiver unit, configured to obtain a user data table, where different rows in the user data table represent user data of different users, and different columns represent user label data under different user label types, and the user data includes user labels and a plurality of user label data; A processing unit, configured to generate a digital identifier corresponding to each user label in the user data table and store the correspondence between the user label and the digital identifier; obtain a query label set, where the query label set includes a plurality of different query label types, and the query label type carries a query label filtering condition; For each of the query label types, filter each row in the user data table through the corresponding query label filtering condition, and add the digital identifier corresponding to the row that meets the query label filtering condition to the digital identifier set corresponding to the query label type, to obtain a digital identifier set corresponding to each of the query label types; perform bitmap storage processing on each of the digital identifier sets to obtain bitmap data corresponding to each of the digital identifier sets; generate a label system corresponding to the user data table according to the plurality of bitmap data.
[0007] In a third aspect, an embodiment of the present application further provides a computer device, which includes a memory and a processor, where a computer program is stored on the memory, and when the processor executes the computer program, the above method is implemented.
[0008] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, where the storage medium stores a computer program, and the computer program includes program instructions, and when the program instructions are executed by a processor, the above method can be implemented.
[0009] The embodiments of the present application provide a method, an apparatus, a computer device, and a storage medium for processing tags in a database. Among them, the method includes: obtaining a user data table, where different rows in the user data table represent user data of different users, and different columns represent user tag data under different user tag types, and the user data includes user tags and a plurality of user tag data; generating a digital identifier corresponding to each user tag in the user data table, and storing the correspondence between the user tag and the digital identifier; obtaining a query tag set, where the query tag set includes a plurality of different query tag types, and the query tag type carries a query tag filtering condition; for each of the query tag types, filtering each row in the user data table through the corresponding query tag filtering condition, and adding the digital identifier corresponding to the row that meets the query tag filtering condition to the digital identifier set corresponding to the query tag type, so as to obtain a digital identifier set corresponding to each of the query tag types; performing bitmap storage processing on each of the digital identifier sets to obtain bitmap data corresponding to each of the digital identifier sets; generating a tag system corresponding to the user data table according to the plurality of bitmap data. By pre-generating bitmap data corresponding to a plurality of query tag types respectively and generating a tag system corresponding to the user data table according to the bitmap data, and performing tag analysis through the bitmap data in the tag system, the present application embodiment can reduce the analysis pressure of the database on tags. Brief Description of the Drawings
[0010] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the accompanying drawings required for the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0011] Figure 1 It is a flowchart of the method for processing tags in a database provided by the embodiments of the present application; Figure 2 It is a schematic diagram of a user data table in the method for processing tags in a database provided by the embodiments of the present application; Figure 3 It is a schematic diagram of a sub-process of the method for processing tags in a database provided by the embodiments of the present application; Figure 4 It is a schematic diagram of generating a digital identifier in the method for processing tags in a database provided by the embodiments of the present application; Figure 5 It is a schematic diagram of generating a digital identifier set in the method for processing tags in a database provided by the embodiments of the present application; Figure 6Another schematic diagram of the sub - process of the label processing method for the database provided by the embodiments of the present application; Figure 7 A schematic diagram of a data query process for the label processing method of the database provided by the embodiments of the present application; Figure 8 A schematic diagram of a process for data query in the label processing method of the database provided by the embodiments of the present application; Figure 9 Another schematic diagram of the process for data query in the label processing method of the database provided by the embodiments of the present application; Figure 10 A schematic block diagram of the label processing device for the database provided by the embodiments of the present application; Figure 11 A schematic block diagram of the computer device provided by the embodiments of the present application. Detailed implementation manners
[0012] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0013] It should be understood that when used in this specification and the appended claims, the terms "comprises" and "comprising" indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[0014] It should also be understood that the terms used in this specification of the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in this specification of the present application and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an", and "the" are intended to include the plural forms.
[0015] It should be further understood that the term "and / or" used in this specification of the present application and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0016] The embodiments of the present application provide a label processing method, device, computer device, and storage medium for a database.
[0017] The execution subject of the label processing method of the database can be the label processing device of the database provided in the embodiments of the present application, or a computer device integrated with the label processing device of the database. Among them, the label processing device of the database can be implemented in a hardware or software manner, and the computer device can be a terminal or a server.
[0018] The computer device obtains a user data table, where different rows in the user data table represent user data of different users, and different columns represent user label data under different user label types. The user data includes user labels and multiple user label data; generates digital identifiers corresponding to each user label in the user data table, and stores the correspondence between the user labels and the digital identifiers; obtains a query label set, where the query label set includes multiple different query label types, and the query label type carries a query label filtering condition; for each query label type, filters each row in the user data table through the corresponding query label filtering condition, and adds the digital identifiers corresponding to the rows that meet the query label filtering condition to the digital identifier set corresponding to the query label type, to obtain a digital identifier set corresponding to each query label type; performs bitmap storage processing on each digital identifier set to obtain bitmap data corresponding to each digital identifier set; generates a label system corresponding to the user data table according to the multiple bitmap data. By pre-generating bitmap data corresponding to multiple query label types respectively and generating a label system corresponding to the user data table according to the bitmap data, and performing label analysis through the bitmap data in the label system, the analysis pressure of the database on labels can be reduced.
[0019] For ease of understanding, in this embodiment, the label processing system is used as the execution subject to illustrate the label processing method of the database provided in the present application, and the label processing system is deployed in the above computer device.
[0020] Figure 1 is a schematic flowchart of the label processing method of the database provided in the embodiments of the present application. As Figure 1 shown, the method includes the following steps S110 - S160.
[0021] S110. Obtain a user data table, where different rows in the user data table represent user data of different users, and different columns represent user label data under different user label types. The user data includes user labels and multiple user label data.
[0022] In this embodiment, the user data table is a table in a database, and the database can be a local database of the device where the label processing system is located, or an external database, such as a database located in other devices, or an external database such as a cloud database.
[0023] In some embodiments, the label processing system generates a bitmap for each label (query label type) at intervals of a preset duration. For example, if the preset duration is 1 day, then each label of the same type corresponds to a bitmap data every day. At this time, the user data table in step S110 is the user data table within the preset duration, and the corresponding bitmap data calculated is the bitmap data corresponding to the preset duration. It can be seen that in some embodiments, the labels in this embodiment are calculated as T + 1, and each label corresponds to a bitmap every day.
[0024] S120. Generate digital identifiers corresponding to each user label in the user data table, and store the correspondence between the user label and the digital identifier.
[0025] In this embodiment, digital identifiers corresponding to each user label are generated in sequence in the user data table. As Figure 2 shown, after obtaining the user data table, a unique digital identifier (ID) needs to be generated for each user in the user data table.
[0026] In some embodiments, please refer to Figure 3 . Step S120 includes: S1201. For each user label in the user data table, determine whether there is a digital identifier corresponding to the user label in the preset correspondence between the user label and the digital identifier; S1202. If there is the corresponding digital identifier, use the corresponding digital identifier as the digital identifier of the corresponding user label; S1203. If there is no such corresponding digital identifier, generate a digital identifier for the corresponding user label through a preset unified numbering module.
[0027] Specifically, as Figure 4 shown, a unified numbering module is preset in the label processing system provided in this embodiment. The unified numbering module generates a unique digital identifier for a user when the user makes a first request, and returns the previously recorded digital identifier for multiple requests from the same user.
[0028] S130. Obtain a query label set, where the query label set includes multiple different query label types, and the query label type carries a query label filtering condition.
[0029] In this embodiment, the query label set can be a label set preset in the system or a label set input by the user. The query label set includes multiple different query label types, and the query label type carries a query label filtering condition.
[0030] For example, taking a simple example (which will be much more complex in actual applications), the user label types in the user data table include gender and age, and the query label types include male gender, teenager, and male teenager. At this time, the filtering condition for "male gender" is gender = "male", the filtering condition for "teenager" is age < 18, and the filtering condition for "male teenager" is gender = "male" and age < 18.
[0031] Among them, the query label types in the query label set of this embodiment can be flexibly configured as needed. By configuration, the query label types that need to be frequently queried can be written into the query label set, thereby improving the subsequent data query efficiency.
[0032] S140. For each of the query label types, filter each row in the user data table through the corresponding query label filtering condition, and add the digital identifiers corresponding to the rows that meet the query label filtering condition to the digital identifier set corresponding to the query label type, so as to obtain the digital identifier sets corresponding to each of the query label types.
[0033] In this embodiment, after obtaining the query label set, it is necessary to generate corresponding bitmap data for each query label type in the query label set. First, it is necessary to calculate the digital identifier sets corresponding to the query label types.
[0034] Specifically, as Figure 5 shown, for the query label type - male gender, the filtering condition is gender = "male". First, find the column data of "gender" in the user data table, then filter out the rows where gender = "male" in this column data, and write the digital identifiers in the filtered rows into the corresponding digital identifier set to obtain the digital identifier set [1, 2]; for the query label type - teenager, the filtering condition is age < 18. First, find the column data of "age" in the user data table, then filter out the rows where age < 18 in this column data, and write the digital identifiers in the filtered rows into the corresponding digital identifier set to obtain the digital identifier set [1, 3]; for the query label type - male teenager, the filtering condition is gender = "male" and age < 18. First, find the data of the "male" column and the "age" column in the user data table, then obtain the digital identifier set [1, 2] where gender = "male" and the digital identifier set [1, 3] where age < 18, and then perform an "and" operation on the digital identifier set [1, 2] and the digital identifier set [1, 3] to obtain the digital identifier set [1]. At this time, the digital identifier set [1] is the digital identifier set corresponding to the query label type - male teenager.
[0035] S150. Perform bitmap storage processing on each of the digital identifier sets to obtain the bitmap data corresponding to each of the digital identifier sets.
[0036] In this embodiment, to reduce the storage space of the label system, this embodiment needs to store data according to the data characteristics in the digital identifier set. In some embodiments, this embodiment reduces the storage space by means of a chunking strategy and dynamically selecting the container type, achieving an excellent balance between the space efficiency and the computing performance of the system; please refer to Figure 6 , step S150 includes: S1501. For each of the digital identifier sets, perform chunking processing on the digital identifier set according to a preset integer range to obtain a plurality of data chunks; S1502. For each of the data chunks, determine the target storage container corresponding to the data chunk from a plurality of preset types of storage containers according to the data characteristics in the data chunk; S1503. Store each of the data chunks into the corresponding target storage container respectively to generate the bitmap data.
[0037] In this embodiment, for each digital identifier set, it is divided into a plurality of data chunks (Blocks) according to the integer range. The size of each data chunk is 2 16 (i.e., 0 - 65535). Each data chunk dynamically selects the optimal container type for storage according to characteristics such as data density, so as to compress the space.
[0038] Specifically, determining the storage container type corresponding to the data chunk according to the data characteristics in the data chunk includes: obtaining the number of integers in the data chunk; if the number of integers is less than a preset number threshold, determining an array container as the target storage container corresponding to the data chunk; if the number of integers is greater than or equal to the preset number threshold and the degree of consecutive integers in the data chunk is less than a preset length threshold, determining a bitmap container as the target storage container corresponding to the data chunk; if the number of integers is greater than or equal to the preset number threshold and the degree of consecutive integers in the data chunk is greater than or equal to the preset length threshold, determining a run-length container as the target storage container corresponding to the data chunk.
[0039] Taking a simple example, for the digital identifier set [1, 3, 5, 8], the preset integer range is 5 data lengths. At this time, the digital identifier set [1, 3, 5, 8] is split into two data chunks, [1, 3, 5] and [8]. The number of integers in the [1, 3, 5] chunk is 3, and the number of integers in the [8] chunk is 1. In practical applications, a digital identifier set generally includes a large amount of data, and the above example is only for illustration.
[0040] The array container uses an array to store integers and is suitable for sparse data situations, that is, the data has a large interval. For example, if the number of integers in a data block is less than 4096, the array container is used to store them because in this case, using the array container saves more space than using the bitmap container. For example, for data block [8], the storage of the corresponding data in the bitmap container is [0 0 0 0 0 0 0 7], while the storage in the array container is [8]. It can be seen that using the array container saves more space than using the bitmap container at this time.
[0041] The bitmap container uses a bit array with a length of 65536 to store data and is suitable for dense data situations, that is, the data has a small interval. For example, if the number of integers in a container is greater than or equal to 4096, the bitmap container is used to store them because in this case, using the bitmap container saves more space than using the array container.
[0042] The run container is set with Run - length Encoding (RLE), and RLE is a compression algorithm suitable for continuous repeated data situations. In this embodiment, if a series of consecutive integers exist in the bitmap, then a run container can be used to store the start value and length of these consecutive integers, thereby saving space. Among them, the degree of consecutive integers in the above - mentioned data block refers to the consecutive repeated data obtained after converting the data in the database into a bitmap. For example, if there are consecutive repeated "1"s from 1 to 100, then these consecutive 100 "1"s are expressed as (1, 100), thereby saving storage space.
[0043] S160. Generate the label system corresponding to the user data table according to the multiple bitmap data.
[0044] In this embodiment, multiple bitmap data are stored in the label system.
[0045] Please refer to Figure 7 and Figure 8 , after obtaining the label system corresponding to the user data table, the method further includes: S1701a. Obtain a label query instruction for a target user, and the label query instruction carries the target user identifier of the target user; S1702a. Determine the target digital identifier corresponding to the target user identifier according to the correspondence between the user label and the digital identifier; S1703a. For each bitmap data in the label system, determine whether there is a value corresponding to the target digital identifier in the bitmap data, and determine the bitmap data with the corresponding value as the target bitmap data; S1704a. Determine the query tag type corresponding to the target bitmap data as the target tag type; S1705a. Output the target tag type.
[0046] Through this embodiment, all tags of a user can be queried. For example, if the target user identifier is use2, by querying the correspondence between user tags and digital identifiers, it is determined that the target digital identifier corresponding to use2 is 2. Then, in each bitmap data, the bitmap data with the value corresponding to the identifier 2 is searched. It should be noted that the digital identifier in this embodiment indicates the position serial number in the bitmap. For example, for the digital identifier 2, the second position in the bitmap is searched. If the second position is 1, it means that the corresponding value exists in the bitmap.
[0047] Please refer to Figure 7 and Figure 9 , after generating the tag system corresponding to the user data table according to the multiple bitmap data, the method further includes: S1701b. Obtain a user query instruction for the target query tag type; S1702b. In response to the user query instruction, determine the target bitmap data according to the tag system and the target query tag type; S1703b. Determine the target digital identifier set corresponding to the target bitmap data; S1704b. According to the correspondence between the user tag and the digital identifier, determine the user tags corresponding to each digital identifier in the target digital identifier set as the target user tags; S1705b. Output the target user tags.
[0048] Through this embodiment, all users under a tag can be queried. In some embodiments, the target query tag type includes multiple, and the user query instruction carries the target bitmap operation logic; determining the target bitmap data according to the tag system and the target query tag type includes: determining the bitmap data corresponding to each of the target query tag types in the tag system as candidate bitmap data; performing the target bitmap operation logic on the multiple candidate bitmap data to obtain the target bitmap data.
[0049] In this embodiment, the user can also query the data of the query tag types before the preset query tag types based on the tag system. For example, the preset query tag types are male gender, female gender, juvenile, and male juvenile. At this time, the target user tags entered include female gender and juvenile, and the target bitmap operation logic is "and". At this time, the tag to be queried is "female juvenile", and this tag is not preset in the tag system. When the query is triggered, the candidate bitmap data of female gender and the candidate bitmap data of juvenile can be obtained based on the tag system, and then the "and" operation is performed on the two obtained candidate bitmap data to obtain the target bitmap data.
[0050] In this embodiment, after obtaining the query result set (target tag type and / or target user tag), when extracting (outputting) the result set, the paging and sorting functions are supported.
[0051] In summary, in this embodiment, a user data table is obtained. Different rows in the user data table represent user data of different users, and different columns represent user tag data under different user tag types. The user data includes user tags and multiple user tag data; digital identifiers corresponding to each user tag are generated in the user data table, and the correspondence between the user tags and the digital identifiers is stored; a query tag set is obtained, and the query tag set includes multiple different query tag types, and the query tag type carries a query tag filtering condition; for each query tag type, each row in the user data table is filtered through the corresponding query tag filtering condition, and the digital identifiers corresponding to the rows that meet the query tag filtering condition are added to the digital identifier set corresponding to the query tag type to obtain the digital identifier sets corresponding to each query tag type; bitmap storage processing is performed on each digital identifier set to obtain the bitmap data corresponding to each digital identifier set; a tag system corresponding to the user data table is generated according to the multiple bitmap data. In the embodiment of the present application, by pre-generating the bitmap data corresponding to multiple query tag types respectively and generating the tag system corresponding to the user data table according to the bitmap data, and performing tag analysis through the bitmap data in the tag system, the analysis pressure of the database on tags can be reduced.
[0052] Figure 10 It is a schematic block diagram of a tag processing device 1000 for a database provided by an embodiment of the present application. As Figure 10 shown, corresponding to the above database tag processing method, the present application also provides a tag processing device 1000 for a database. The tag processing device 1000 for the database includes units for executing the above database tag processing method. Specifically, please refer to Figure 10 . The tag processing device 1000 for the database includes a transceiver unit 1001 and a processing unit 1002, where: A transceiver unit 1001, configured to obtain a user data table, where different rows in the user data table represent user data of different users, and different columns represent user label data under different user label types, and the user data includes user labels and a plurality of user label data; A processing unit 1002, configured to generate a digital identifier corresponding to each user label in the user data table and store the correspondence between the user label and the digital identifier; obtain a query label set, where the query label set includes a plurality of different query label types, and the query label type carries a query label filtering condition; for each of the query label types, filter each row in the user data table through the corresponding query label filtering condition, and add the digital identifiers corresponding to the rows that meet the query label filtering condition to the digital identifier set corresponding to the query label type, to obtain a digital identifier set corresponding to each of the query label types; perform bitmap storage processing on each of the digital identifier sets to obtain bitmap data corresponding to each of the digital identifier sets; generate a label system corresponding to the user data table according to the plurality of bitmap data.
[0053] In some embodiments, when the processing unit 1002 executes the step of performing bitmap storage processing on each of the digital identifier sets to obtain bitmap data corresponding to each of the digital identifier sets, it is specifically configured to: For each of the digital identifier sets, perform block processing on the digital identifier set according to a preset integer range to obtain a plurality of data blocks; For each of the data blocks, determine a target storage container corresponding to the data block from a plurality of preset types of storage containers according to the data characteristics in the data block; Store each of the data blocks in the corresponding target storage container to generate the bitmap data.
[0054] In some embodiments, when the processing unit 1002 executes the step of determining the storage container type corresponding to the data block according to the data characteristics in the data block, it is specifically configured to: Obtain the number of integers in the data block; if the number of integers is less than a preset number threshold, determine an array container as the target storage container corresponding to the data block; if the number of integers is greater than or equal to the preset number threshold and the degree of consecutive integers in the data block is less than a preset length threshold, determine a bitmap container as the target storage container corresponding to the data block; if the number of integers is greater than or equal to the preset number threshold and the degree of consecutive integers in the data block is greater than or equal to the preset length threshold, determine a run container as the target storage container corresponding to the data block.
[0055] In some embodiments, after the processing unit 1002 executes the step of generating the tag system corresponding to the user data table according to the plurality of bitmap data, it is further configured to: Obtain, through the transceiver unit 1001, a tag query instruction for a target user, where the tag query instruction carries a target user identifier of the target user; determine a target digital identifier corresponding to the target user identifier according to the correspondence between the user tags and the digital identifiers; for each bitmap data in the tag system, determine whether there is a value corresponding to the target digital identifier in the bitmap data, and determine the bitmap data with the corresponding value as the target bitmap data; determine the query tag type corresponding to the target bitmap data as the target tag type; output the target tag type through the transceiver unit 1001.
[0056] In some embodiments, after the processing unit 1002 executes the step of generating the tag system corresponding to the user data table according to the plurality of bitmap data, it is further configured to: Obtain, through the transceiver unit 1001, a user query instruction for a target query tag type; in response to the user query instruction, determine the target bitmap data according to the tag system and the target query tag type; determine a target set of digital identifiers corresponding to the target bitmap data; according to the correspondence between the user tags and the digital identifiers, determine the user tags corresponding to each digital identifier in the target set of digital identifiers as the target user tags; output the target user tags through the transceiver unit 1001.
[0057] In some embodiments, the target query tag type includes a plurality, and the user query instruction carries a target bitmap operation logic; when the processing unit 1002 executes the step of determining the target bitmap data according to the tag system and the target query tag type, it is specifically configured to: Determine the bitmap data corresponding to each of the target query tag types in the tag system as candidate bitmap data; perform the target bitmap operation logic on the plurality of candidate bitmap data to obtain the target bitmap data.
[0058] In some embodiments, when the processing unit 1002 executes the step of generating digital identifiers corresponding to each user tag in the user data table, it is specifically configured to: For each user tag in the user data table, determine whether there is a digital identifier corresponding to the user tag in the preset correspondence between the user tags and the digital identifiers; if there is the corresponding digital identifier, use the corresponding digital identifier as the digital identifier of the corresponding user tag; if there is no the corresponding digital identifier, generate a digital identifier for the corresponding user tag through a preset unified numbering module.
[0059] In summary, in the embodiments of the present application, by pre-generating bitmap data corresponding to multiple query tag types respectively and generating a tag system for the user data table according to the bitmap data, and performing tag analysis through the bitmap data in the tag system, the analysis pressure of the database on tags can be reduced.
[0060] It should be noted that those skilled in the art can clearly understand the specific implementation processes of the above-mentioned tag processing device of the database and each unit. They can refer to the corresponding descriptions in the foregoing method embodiments. For the sake of convenience and brevity of description, they will not be elaborated here.
[0061] The above-mentioned tag processing device of the database can be implemented in the form of a computer program, and this computer program can run on a computer device as shown in Figure 11 shown.
[0062] Please refer to Figure 11 , Figure 11 which is a schematic block diagram of a computer device provided by the embodiments of the present application. The computer device 1100 can be a terminal or a server.
[0063] Referring to Figure 11 , the computer device 1100 includes a processor 1102, a memory, and a network interface 1105 connected through a system bus 1101. Among them, the memory can include a non-volatile storage medium 1103 and an internal memory 1104.
[0064] The non-volatile storage medium 1103 can store an operating system 11031 and a computer program 11032. The computer program 11032 includes program instructions. When the program instructions are executed, the processor 1102 can be caused to execute a method for processing tags in a database.
[0065] The processor 1102 is used to provide computing and control capabilities to support the operation of the entire computer device 1100.
[0066] The internal memory 1104 provides an environment for the operation of the computer program 11032 in the non-volatile storage medium 1103. When the computer program 11032 is executed by the processor 1102, the processor 1102 can be caused to execute a method for processing tags in a database.
[0067] The network interface 1105 is used for network communication with other devices. Those skilled in the art can understand that Figure 11The structure shown is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device 1100 to which the solution of this application is applied. Specifically, the computer device 1100 may include more or fewer components than those shown in the figure, or combine some components, or have a different component layout.
[0068] Among them, the processor 1102 is used to run the computer program 11032 stored in the memory to implement the following steps: Obtain a user data table, where different rows in the user data table represent user data of different users, and different columns represent user tag data under different user tag types. The user data includes user tags and multiple user tag data; Generate digital identifiers corresponding to each user tag in the user data table, and store the correspondence between the user tags and the digital identifiers; Obtain a query tag set, where the query tag set includes multiple different query tag types, and the query tag type carries a query tag filtering condition; For each of the query tag types, filter each row in the user data table through the corresponding query tag filtering condition, and add the digital identifiers corresponding to the rows that meet the query tag filtering condition to the digital identifier set corresponding to the query tag type, to obtain a digital identifier set corresponding to each of the query tag types; Perform bitmap storage processing on each of the digital identifier sets to obtain bitmap data corresponding to each of the digital identifier sets; Generate a tag system corresponding to the user data table according to the multiple bitmap data.
[0069] It should be understood that in the embodiments of this application, the processor 1102 may be a central processing unit (CPU), and this processor 1102 may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or this processor may also be any conventional processor, etc.
[0070] Those of ordinary skill in the art can understand that all or part of the processes in the methods of implementing the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the above method embodiments.
[0071] Therefore, the present application also provides a storage medium. The storage medium can be a computer-readable storage medium. The storage medium stores a computer program, where the computer program includes program instructions. When the program instructions are executed by a processor, the processor performs the following steps: Obtain a user data table, where different rows in the user data table represent user data of different users, and different columns represent user label data under different user label types. The user data includes user labels and multiple pieces of user label data; Generate digital identifiers corresponding to each user label in the user data table, and store the correspondence between the user labels and the digital identifiers; Obtain a query label set, where the query label set includes multiple different query label types, and the query label types carry query label filtering conditions; For each of the query label types, filter each row in the user data table through the corresponding query label filtering condition, and add the digital identifiers corresponding to the rows that meet the query label filtering condition to the digital identifier set corresponding to the query label type, to obtain digital identifier sets corresponding to each of the query label types; Perform bitmap storage processing on each of the digital identifier sets to obtain bitmap data corresponding to each of the digital identifier sets; Generate a label system corresponding to the user data table according to the multiple pieces of bitmap data.
[0072] The storage medium can be various computer-readable storage media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disc that can store program codes.
[0073] Those of ordinary skill in the art will appreciate that the units and algorithm steps of the examples described in connection with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been generally described in terms of function in the above description. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0074] In several embodiments provided by this application, it should be understood that the disclosed apparatus and method can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0075] The steps in the method embodiments of this application can be adjusted, combined, and deleted according to actual needs. The units in the apparatus embodiments of this application can be combined, divided, and deleted according to actual needs. In addition, the functional units in each embodiment of this application can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.
[0076] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of this application.
[0077] As described above, the above are only specific embodiments of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed by this application can easily think of various equivalent modifications or substitutions, and these modifications or substitutions should all be covered by the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.
Claims
1. A method for processing tags of a database, characterized in that, Including: Obtain a user data table, where different rows in the user data table represent user data of different users, and different columns represent user label data under different user label types. The user data includes user labels and multiple pieces of user label data; Generate digital identifiers corresponding to each user label in the user data table, and store the correspondence between the user labels and the digital identifiers; Obtain a query label set, where the query label set includes multiple different query label types, and the query label type carries a query label filtering condition; For each of the query label types, perform filtering processing on each row in the user data table through the corresponding query label filtering condition, and add the digital identifiers corresponding to the rows that meet the query label filtering condition to the digital identifier set corresponding to the query label type, to obtain digital identifier sets corresponding to each of the query label types; Perform bitmap storage processing on each of the digital identifier sets to obtain bitmap data corresponding to each of the digital identifier sets; Generate a label system corresponding to the user data table according to the multiple pieces of bitmap data.
2. The method according to claim 1, wherein The performing bitmap storage processing on each of the digital identifier sets to obtain bitmap data corresponding to each of the digital identifier sets includes: For each of the digital identifier sets, perform block processing on the digital identifier set according to a preset integer range to obtain multiple data blocks; For each of the data blocks, determine a target storage container corresponding to the data block from multiple preset types of storage containers according to the data characteristics in the data block; Store each of the data blocks into the corresponding target storage container to generate the bitmap data.
3. The method according to claim 2, wherein The determining the storage container type corresponding to the data block according to the data characteristics in the data block includes: Obtain the number of integers in the data block; If the number of integers is less than a preset number threshold, determine an array container as the target storage container corresponding to the data block; If the number of integers is greater than or equal to the preset number threshold and the degree of consecutive integers in the data block is less than a preset length threshold, determine a bitmap container as the target storage container corresponding to the data block; If the number of integers is greater than or equal to the preset number threshold and the degree of consecutive integers in the data block is greater than or equal to the preset length threshold, determine a run-length container as the target storage container corresponding to the data block.
4. The method according to claim 1, wherein After generating the label system corresponding to the user data table according to the multiple pieces of bitmap data, the method further includes: Obtain a label query instruction for a target user, where the label query instruction carries a target user identifier of the target user; According to the correspondence between the user labels and the digital identifiers, determine a target digital identifier corresponding to the target user identifier; For each piece of bitmap data in the label system, determine whether there is a value corresponding to the target digital identifier in the bitmap data, and determine the bitmap data with the corresponding value as the target bitmap data; Determine the query label type corresponding to the target bitmap data as the target label type; Output the target label type.
5. The method according to claim 1, characterized in that, After generating the tag system corresponding to the user data table according to the multiple bitmap data, the method further includes: Obtaining a user query instruction for a target query tag type; In response to the user query instruction, determining target bitmap data according to the tag system and the target query tag type; Determining a target digital identifier set corresponding to the target bitmap data; According to the correspondence between the user tags and the digital identifiers, determining the user tags corresponding to each digital identifier in the target digital identifier set as target user tags; Outputting the target user tags.
6. The method according to claim 5, wherein The target query tag type includes multiple types, and the user query instruction carries a target bitmap operation logic; the determining the target bitmap data according to the tag system and the target query tag type includes: Determining the bitmap data corresponding to each of the target query tag types in the tag system as candidate bitmap data; Performing the target bitmap operation logic on the multiple candidate bitmap data to obtain the target bitmap data.
7. The method according to claim 1, characterized in that The generating, in the user data table, digital identifiers corresponding to each user tag includes: For each user tag in the user data table, determining whether there is a digital identifier corresponding to the user tag in the preset correspondence between the user tags and the digital identifiers; If there is the corresponding digital identifier, using the corresponding digital identifier as the digital identifier of the corresponding user tag; If there is no such corresponding digital identifier, generating a digital identifier for the corresponding user tag through a preset unified numbering module.
8. A label processing device for a database, characterized in that Including: A transceiver unit, configured to obtain a user data table, where different rows in the user data table represent user data of different users, and different columns represent user tag data under different user tag types, and the user data includes user tags and multiple user tag data; A processing unit, configured to generate digital identifiers corresponding to each user tag in the user data table and store the correspondence between the user tags and the digital identifiers; Obtaining a query tag set, where the query tag set includes multiple different query tag types, and the query tag type carries a query tag filtering condition; For each of the query tag types, filtering each row in the user data table through the corresponding query tag filtering condition, and adding the digital identifiers corresponding to the rows that meet the query tag filtering condition to the digital identifier set corresponding to the query tag type, to obtain digital identifier sets corresponding to each of the query tag types; performing bitmap storage processing on each of the digital identifier sets to obtain bitmap data corresponding to each of the digital identifier sets; generating a tag system corresponding to the user data table according to the multiple bitmap data.
9. A computer device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the tag processing method for the database according to any one of claims 1-7.
10. A storage medium, characterized in that, The storage medium stores a computer program, and the computer program includes program instructions, and when the program instructions are executed by the processor, the processor is caused to execute the tag processing method for the database according to any one of claims 1-7.
Citation Information
Patent Citations
Data storage method and data storage devices and storage medium
CN107704527A
Bitmap-based user data analysis method and device and computer equipment
CN114328632A
Data query method, intelligent device and storage medium
CN119829618A