CN110781258B - Packet query method and device, electronic equipment and readable storage medium - Google Patents

Packet query method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN110781258B
CN110781258B CN201910872156.1A CN201910872156A CN110781258B CN 110781258 B CN110781258 B CN 110781258B CN 201910872156 A CN201910872156 A CN 201910872156A CN 110781258 B CN110781258 B CN 110781258B
Authority
CN
China
Prior art keywords
preset
information
dimension information
subset
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910872156.1A
Other languages
Chinese (zh)
Other versions
CN110781258A (en
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.)
Beijing Sankuai Online Technology Co Ltd
Original Assignee
Beijing Sankuai Online 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 Beijing Sankuai Online Technology Co Ltd filed Critical Beijing Sankuai Online Technology Co Ltd
Priority to CN201910872156.1A priority Critical patent/CN110781258B/en
Publication of CN110781258A publication Critical patent/CN110781258A/en
Application granted granted Critical
Publication of CN110781258B publication Critical patent/CN110781258B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/29Geographical information databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9537Spatial or temporal dependent retrieval, e.g. spatiotemporal queries

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Remote Sensing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the disclosure provides a packet query method, a packet query device, an electronic device and a readable storage medium, wherein the method comprises the following steps: selecting target dimension information from the preset dimension information, and dividing a preset object set into one or more object subsets according to the target dimension information; if the data volume of one object subset is larger than a preset data volume threshold value, new target dimension information is selected from the dimension information again, and the object subset is used as a new preset object set to continue dividing; if the data volume of one of the object subsets is less than or equal to the data volume threshold, generating a grouping identification of the object subsets; storing object information of a preset object set according to the grouping identification of the object subset; and inquiring the stored object information according to the grouping identification corresponding to the object subset. The preset object set can be divided into object subsets with the data volume smaller than the data volume threshold value, so that the storage uniformity is ensured, and the query performance is improved.

Description

Packet query method and device, electronic equipment and readable storage medium
Technical Field
Embodiments of the present disclosure relate to the field of data storage technologies, and in particular, to a packet query method and apparatus, an electronic device, and a readable storage medium.
Background
Data can be stored in a group form, and in a location-based service system, objects with close distances, such as businesses, can be divided into the same group according to the location. Therefore, when the objects are read, a batch of objects with similar distances can be read at one time, the number of times of interaction with the memory is reduced, and the system performance is improved.
In the prior art, the storage can be performed in a manner of geohash coding. The method specifically comprises the following steps: firstly, dividing the whole area into a plurality of sub-areas; then, dividing the object into one of the sub-regions according to the position; and finally, carrying out the geohash coding on the region to obtain a geohash block, so that the objects belonging to the region have the same geohash coding and are stored in the same geohash block.
After the inventor researches the scheme, it is found that when the position distribution of the object is not uniform, the storage capacity of a part of the geohash block is large, and the storage capacity of a part of the geohash block is small, so that the query performance is reduced.
Disclosure of Invention
Embodiments of the present disclosure provide a packet query method, an apparatus, an electronic device, and a readable storage medium, which may further divide an object subset until a data amount of the object subset is smaller than a data amount threshold when the data amount of the object subset is larger than the data amount threshold, may ensure storage uniformity, and is beneficial to improving query performance.
According to a first aspect of embodiments of the present disclosure, there is provided a packet query method, the method including:
selecting position information from preset dimension information as target dimension information, and dividing a preset object set into one or more object subsets according to the target dimension information, wherein each object in each object set is in the same preset area range;
if the data volume of one of the object subsets is larger than a preset data volume threshold, selecting new target dimension information from the dimension information, and taking the object subset as a new preset object set, so as to enter the step of dividing the preset object set into one or more object subsets according to the target dimension information;
if the data volume of one of the object subsets is smaller than or equal to a preset data volume threshold, generating a grouping identifier corresponding to the object subset;
according to the grouping identification corresponding to the object subset, carrying out block storage on the object information of the preset object set;
and performing query processing on the object information stored in the block according to the grouping identification corresponding to the object subset.
According to a second aspect of embodiments of the present disclosure, there is provided a packet query apparatus, the apparatus including:
the preset object set splitting module is used for selecting position information from preset dimension information as target dimension information, and dividing the preset object set into one or more object subsets according to the target dimension information, wherein each object in each object set is in the same preset area range;
a circulation module, configured to select new target dimension information from the dimension information if the data amount of one of the object subsets is greater than a preset data amount threshold, and use the object subset as a new preset object set, so as to perform the step of dividing the preset object set into one or more object subsets according to the target dimension information;
the group identifier generating module is used for generating a group identifier corresponding to the object subset if the data volume of one of the object subsets is less than or equal to a preset data volume threshold;
the storage module is used for storing the object information of the preset object set in blocks according to the grouping identification corresponding to the object subset;
and the query processing module is used for performing query processing on the object information stored in the block according to the grouping identification corresponding to the object subset.
According to a third aspect of embodiments of the present disclosure, there is provided an electronic apparatus including:
a processor, a memory and a computer program stored on the memory and executable on the processor, the processor implementing the aforementioned packet query method when executing the program.
According to a fourth aspect of embodiments of the present disclosure, there is provided a readable storage medium, wherein instructions, when executed by a processor of an electronic device, enable the electronic device to perform the aforementioned group query method.
The embodiment of the disclosure provides a packet query method, a packet query device, an electronic device and a readable storage medium, wherein the method comprises the following steps: selecting position information from preset dimension information as target dimension information, and dividing a preset object set into one or more object subsets according to the target dimension information, wherein each object in each object set is in the same preset area range; if the data volume of one of the object subsets is larger than a preset data volume threshold, selecting new target dimension information from the dimension information, and taking the object subset as a new preset object set, so as to enter the step of dividing the preset object set into one or more object subsets according to the target dimension information; if the data volume of one of the object subsets is smaller than or equal to a preset data volume threshold, generating a grouping identifier corresponding to the object subset; according to the grouping identification corresponding to the object subset, carrying out block storage on the object information of the preset object set; and performing query processing on the object information stored in the block according to the grouping identification corresponding to the object subset. According to the embodiment of the disclosure, when the data volume of the object subset is greater than the data volume threshold, the object subset is further divided until the data volume of the object subset is less than the data volume threshold, so that the storage uniformity can be ensured, and the query performance can be improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings needed to be used in the description of the embodiments of the present disclosure will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present disclosure, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
FIG. 1 shows a flow diagram of the steps of a packet query method in one embodiment of the present disclosure;
FIG. 2 shows a flow diagram of the steps of a packet query method in another embodiment of the present disclosure;
FIG. 3 shows a block diagram of a packet lookup device in one embodiment of the disclosure;
fig. 4 shows a block diagram of a packet querying device in another embodiment of the present disclosure;
FIG. 5 shows a block diagram of an electronic device in an embodiment of the disclosure.
Detailed Description
Technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are some, but not all, of the embodiments of the present disclosure. All other embodiments, which can be obtained by a person skilled in the art without making creative efforts based on the embodiments of the present disclosure, belong to the protection scope of the embodiments of the present disclosure.
Example one
Referring to fig. 1, a flowchart illustrating steps of a packet query method in an embodiment of the present disclosure is shown, which is described in detail as follows.
Step 101, selecting position information from preset dimension information as target dimension information, and dividing a preset object set into one or more object subsets according to the target dimension information, wherein each object in each object set is in the same preset area range.
The preset dimension information may be set for an object, for example, in a take-away application scenario, the object is a merchant, and a location of the merchant, dish information of the merchant, a sales volume of the merchant, a grade of the merchant, and the like may be set for the merchant. It is understood that the preset dimension information can express the characteristics of the merchant from different angles and dimensions.
The target dimension information is used for dividing the preset object set, and the embodiment of the disclosure may preferentially use the position information to perform the division to obtain one or more object subsets, so that the position of the object in the same object subset is close to the preset object set, which may be an object set to be stored and queried.
Specifically, first, values of a preset object set in a position dimension, that is, position information, are arranged in order, for example, the ordering result is: OBJ1, OBJ2, OBJ3, OBJ4, OBJ5, OBJ6, OBJ7 and OBJ8, then dividing a preset object set into object subsets according to a preset number, and if the preset number is 4, obtaining the object subsets as follows: a first subset of OBJ1 and OBJ2, a second subset of OBJ3 and OBJ4, a third subset of OBJ5 and OBJ6, and a fourth subset of OBJ7 and OBJ 8.
In addition, the preset object set may be divided into a plurality of object subsets according to a certain difference threshold, for example, for any two objects in the preset object set, a distance between position information of the two objects is calculated, and if the distance is smaller than the preset distance threshold, the two objects are divided into the same object subset; otherwise, the objects are not divided into the same object subset.
And 102, if the data volume of one of the object subsets is greater than a preset data volume threshold, selecting new target dimension information from the dimension information, and taking the object subset as a new preset object set, so as to enter the step of dividing the preset object set into one or more object subsets according to the target dimension information.
The data size of the object subset can be determined by the number of objects contained in the object subset, and can be further determined by combining the number of objects, the number of object information of each object, and the occupied size of each object information. For example, for an object subset including M objects, the object M may be directly used as a data volume, and if each object corresponds to 4 object information: position, commodity information, sales volume, and rank, and then the product 4 × M of the number of objects and the number of object information of each object may be used as the data volume; in addition, if the occupied sizes of the object information are N1 bytes, N2 bytes, N3 bytes, and N4 bytes, respectively, the data amount may be further set to 4 × M (N1+ N2+ N3+ N4) which is the product of the number of objects, the number of object information items for each object, and the total occupied size of the object information items.
It should be noted that the data amount threshold is set to different values according to different statistical manners of the data amount, and the setting of the data amount threshold is not limited in the embodiments of the present disclosure.
The new target dimension information is different from the original target dimension information, and can be selected according to an actual application scene, or randomly selected, or the dimension information with the highest priority is selected as the target dimension information according to the priority of the dimension information. .
Embodiments of the present disclosure may further split the subset of objects into smaller subsets of objects when the amount of data of the subset of objects is greater than the data amount threshold, and this step is looped until the amount of data of each subset of objects is less than or equal to the data amount threshold, so that the amount of data of each subset of objects is evenly distributed. For example, if the set of preset objects includes: first, the OBJ1, the OBJ2, the OBJ3, …, and the OBJN are divided into two object subsets by using the position information as the target dimension information: at this time, if the data amounts of the object subsets OBJ11 to OBJN are greater than a preset data amount threshold, continuing to select the evaluation score of the object as target dimension information, and further dividing the object subsets OBJ11 to OBJN to obtain three object subsets: and if the data amount of the three object subsets is less than a preset data amount threshold value, the three object subsets are not continuously divided, so that the finally obtained object subsets comprise: OBJ1 to OBJ10, OBJ11 to OBJ30, OBJ31 to OBJ70, OBJ71 to OBJN.
In the embodiment of the present disclosure, objects having close or the same values of the target dimension information may be divided into the same object subset, so that the preset object set may be divided into one or more object subsets. Of course, the larger the number of object subsets, the more contributing to the improvement of the query efficiency.
Step 103, if the data amount of one of the object subsets is less than or equal to a preset data amount threshold, generating a group identifier corresponding to the object subset.
The group identifier may be randomly generated or generated according to a preset rule, which is not limited in the embodiments of the present disclosure.
It can be understood that the objects in the same object subset have the same or similar values on the target dimension information, correspond to the same group identifier, and belong to the same group.
And 104, storing the object information of the preset object set in blocks according to the grouping identification corresponding to the object subset.
In the embodiment of the present disclosure, objects having the same group identification may be stored to the same location, so that storage amounts of different locations are uniformly distributed. For example, if the set of preset objects includes: OBJ1, OBJ2, OBJ3, …, OBJN, so that object information of OBJ1 to OBJ10 belonging to the same group identification can be stored to the same location and object information of OBJ1 to OBJN belonging to the same group identification can be stored to another location.
And 105, performing query processing on the object information stored in the block according to the grouping identifier corresponding to the object subset.
Specifically, all objects corresponding to one group identifier can be read at one time, so that switching among a plurality of storage areas is avoided when data is read, and the query performance is improved.
In practical application, the query can be directly performed based on the group identifier, for example, for an instant task scene, the object information is merchant information, when a user initiates an instant task, one of merchants can be taken as a reference merchant to be carried in an instant task request, and when the platform receives the instant task request, the reference merchant is extracted first; then, determining the group identifier of the reference merchant as a target group identifier; and finally, inquiring all merchant information of the target grouping identifier, and returning to the platform interface, thereby realizing that all merchant information close to the reference merchant in the target dimension information is returned.
The embodiment of the disclosure has better query efficiency when querying the target dimension information, so that the object information with the similar value of the target dimension information can be queried at one time, and the interaction times with the memory are reduced.
In summary, an embodiment of the present disclosure provides a packet query method, where the method includes: selecting position information from preset dimension information as target dimension information, and dividing a preset object set into one or more object subsets according to the target dimension information, wherein each object in each object set is in the same preset area range; if the data volume of one of the object subsets is larger than a preset data volume threshold, selecting new target dimension information from the dimension information, and taking the object subset as a new preset object set, so as to enter the step of dividing the preset object set into one or more object subsets according to the target dimension information; if the data volume of one of the object subsets is smaller than or equal to a preset data volume threshold, generating a grouping identifier corresponding to the object subset; according to the grouping identification corresponding to the object subset, carrying out block storage on the object information of the preset object set; and performing query processing on the object information stored in the block according to the grouping identification corresponding to the object subset. According to the embodiment of the disclosure, when the data volume of the object subset is greater than the data volume threshold, the object subset is further divided until the data volume of the object subset is less than the data volume threshold, so that the storage uniformity can be ensured, and the query performance can be improved.
Example two
Referring to fig. 2, a flowchart illustrating specific steps of a packet query method in another embodiment of the present disclosure is shown, specifically as follows.
Step 201, selecting position information from preset dimension information as target dimension information.
This step can refer to the detailed description of step 101, and is not described herein again.
Step 202, dividing a preset object set into two object subsets according to the median of the preset object on the target dimension information.
Specifically, firstly, sorting values of preset objects on target dimension information, and then, taking the number located in the middle position as a median; and finally, taking the preset objects before and after the median as two object subsets. For example, the values of the preset object on the target dimension information D2 are respectively: 1. 2, 3, 4, 5, 6, 7, 8, 9, 10, the median is 5.5, so that 1, 2, 3, 4, 5 and 6, 7, 8, 9, 10 before 5.5 can be divided into two subsets of objects, respectively.
According to the embodiment of the disclosure, the preset object can be divided into two object subsets on each target dimension information according to the median, so that a structure similar to a binary tree is formed, and finally, the preset object is divided into a plurality of object subsets, and the data volume of each object subset is smaller than or equal to the preset data volume threshold, so that the data volume of the storage block corresponding to each grouping identifier is uniform.
Step 203, if the data volume of one of the object subsets is greater than a preset data volume threshold, determining the variance of a preset object on preset dimension information.
The variance can represent the concentration degree of the preset object on the preset dimension information, and the larger the variance is, the more dispersed the distribution of the preset object on the preset dimension information is; the smaller the variance, the more concentrated the distribution of the preset objects on the preset dimensional information. For example, the values of the preset object on the preset dimension information D1 are respectively: 10. 8, 10, 8, with variance of 1; the values of the preset object on the preset dimension information D2 are respectively: 1. 2, 3, 4, 5, 6, 7, 8, 9, 10, and the variance is 8.25, so that the distribution of the preset objects on the dimension information D2 is more dispersed and the distribution on the dimension information D1 is more concentrated.
In practical application, the variance calculation can directly call the existing interface function, and can write the function according to the variance formula. The embodiments of the present disclosure do not impose limitations thereon.
And 204, selecting new target dimension information from preset dimension information according to the variance, taking the object subset as a new preset object set, and dividing the preset object set into two object subsets according to the median of the preset object on the target dimension information.
Specifically, preset dimension information with the largest or larger variance may be selected as the target dimension information, and for example, for the dimension information D1 and D2 with the variance of 1 and the variance of 8.25 in step 101, the dimension information D2 may be selected as the target dimension information.
In practical application, if a plurality of pieces of dimensional information exist, the dimensional information with the largest variance can be selected as the target dimensional information; then selecting dimension information with the second largest variance as target dimension information; and repeating the steps until the data volume of the divided preset object subsets is less than or equal to a preset data volume threshold.
Optionally, in another embodiment of the present disclosure, the object is a merchant, and the location information includes longitude information and latitude information.
The embodiment of the disclosure is preferably applied to a location-based service platform, for example, on a take-out platform, merchant information of merchants in the same area may be stored in the same storage area, so that location information including longitude information and latitude information may be used as preset latitude information, and one of the longitude information and the latitude information may be selected as target latitude information.
The embodiment of the disclosure can preferentially aggregate the objects according to the positions, and is beneficial to improving the query efficiency of the position-based service platform.
Step 205, if the data amount of one of the object subsets is less than or equal to a preset data amount threshold, generating a group identifier corresponding to the object subset.
This step can refer to the detailed description of step 103, which is not repeated herein.
Step 206, recording the mapping relationship between each object in the object subset and the group identifier to obtain a first mapping relationship.
Specifically, the mapping relationship between the identifier of each object and the group identifier may be saved to a memory, a cache, or an external storage. Of course, the object identifier may be used as an index, so as to facilitate obtaining the group identifier according to the identifier of the root object.
Step 207, for each group identifier, according to the first mapping relationship, storing the object information of each object in the object subset corresponding to the group identifier to the same storage block.
The object information may be preset dimension information, or may be other information that needs to be stored and queried.
Specifically, a fixed-size memory block may be divided for each group identifier in order, so that object information corresponding to the group identifier may be stored to the memory block.
And 208, recording the mapping relation between the grouping identification of the object subset and the storage block to obtain a second mapping relation.
Specifically, the mapping relationship between the location of the storage block and the packet identifier may be saved to a memory, a cache, or an external storage. Of course, the group identifier may be used as an index, so as to facilitate obtaining the location of the storage block according to the identifier of the root object.
The embodiment of the disclosure can record the second mapping relationship, so that the query can be performed by combining the first mapping relationship and the second mapping relationship.
Step 209, in response to the query request for the target object set, dividing the target object set into target object subsets corresponding to the target group identifiers according to the first mapping relationship.
The target object set may be a subset of the preset object set or a preset object set, and of course, objects not in the preset object set may also be included, so that the result cannot be queried by the objects.
Specifically, a target grouping identifier of each target object in the target object set is determined according to the first mapping relation; thus, the target objects corresponding to the same target grouping identifier form a target object subset corresponding to the target grouping identifier.
And step 210, determining a target storage block corresponding to the target grouping identifier according to the second mapping relation.
It is understood that, when the physical address of the storage block is stored in the second mapping relationship, the physical address of the target storage block may be directly obtained here, so that the object information may be directly read from the address.
Step 211, reading object information from the target storage block to obtain candidate object information, and screening object information of the target object subset from the candidate object information.
In the embodiment of the disclosure, all object information corresponding to the group identifier related in the target object set can be read from the target storage block at one time to obtain candidate object information, and then unnecessary object information is filtered from the candidate object information, so that the interaction times with the memory can be reduced, and the query efficiency can be improved.
In summary, based on the first embodiment, the embodiment of the present disclosure provides another packet query method, which has the beneficial effects of the first embodiment, and in addition, the embodiment of the present disclosure may preferentially aggregate objects according to locations, which is beneficial to improving the query efficiency of the location-based service platform; target dimension information can be accurately selected according to the variance of preset dimension information, and the object subsets are accurately divided according to the median of the target dimension information; the first mapping relation and the second mapping relation can be recorded, and the grouping identification related to the target object set can be read from the target storage block at one time according to the first mapping relation and the second mapping relation, so that the interaction times with a memory can be reduced, and the query efficiency can be improved.
EXAMPLE III
Referring to fig. 3, a block diagram of a packet querying device in another embodiment of the present disclosure is shown, specifically as follows.
The preset object set splitting module 301 is configured to select position information from preset dimension information as target dimension information, and divide the preset object set into one or more object subsets according to the target dimension information, where each object in each object set is within the same preset region range.
A loop module 302, configured to select new target dimension information from the dimension information if the data amount of one of the object subsets is greater than a preset data amount threshold, and use the object subset as a new preset object set to enter the preset object set splitting module 301.
A grouping identifier generating module 303, configured to generate a grouping identifier corresponding to the object subset if the data amount of one of the object subsets is smaller than or equal to a preset data amount threshold.
And the storage module 304 is configured to store the object information of the preset object set in blocks according to the grouping identifier corresponding to the object subset.
And the query processing module 305 is configured to perform query processing on the object information stored in the block according to the group identifier corresponding to the object subset.
In summary, an embodiment of the present disclosure provides a packet query apparatus, which includes: the preset object set splitting module is used for selecting position information from preset dimension information as target dimension information, and dividing the preset object set into one or more object subsets according to the target dimension information, wherein each object in each object set is in the same preset area range; the circulation module is used for selecting new target dimension information from the dimension information if the data volume of one of the object subsets is larger than a preset data volume threshold value, and taking the object subset as a new preset object set to enter the preset object set splitting module; the group identifier generating module is used for generating a group identifier corresponding to the object subset if the data volume of one of the object subsets is less than or equal to a preset data volume threshold; the storage module is used for storing the object information of the preset object set in blocks according to the grouping identification corresponding to the object subset; and the query processing module is used for performing query processing on the object information stored in the block according to the grouping identification corresponding to the object subset. According to the embodiment of the disclosure, when the data volume of the object subset is greater than the data volume threshold, the object subset is further divided until the data volume of the object subset is less than the data volume threshold, so that the storage uniformity can be ensured, and the query performance can be improved.
The third embodiment is an embodiment of the apparatus corresponding to the first embodiment, and the detailed description may refer to the first embodiment, which is not repeated herein.
Example four
Referring to fig. 4, a block diagram of a packet forwarding apparatus in an embodiment of the present disclosure is shown, which is described in detail as follows.
A preset object set splitting module 401, configured to select position information from preset dimension information as target dimension information, and divide a preset object set into one or more object subsets according to the target dimension information, where each object in each object set is within the same preset area range; alternatively, in embodiments of the present disclosure,
the preset object set splitting submodule 4011 is configured to divide the preset object set into two object subsets according to a median of the preset object on the target dimension information.
A loop module 402, configured to select new target dimension information from the dimension information if the data amount of one of the object subsets is greater than a preset data amount threshold, and use the object subset as a new preset object set to enter the preset object set splitting module; optionally, in another embodiment of the disclosure, the object is a merchant, and the circulation module 402 includes:
the variance determining sub-module 4021 is configured to determine a variance of the preset object in the preset dimension information.
And the target dimension information selecting sub-module 4022 is used for selecting new target dimension information from preset dimension information according to the variance.
A grouping identifier generating module 403, configured to generate a grouping identifier corresponding to one of the object subsets if the data amount of the one of the object subsets is smaller than or equal to a preset data amount threshold.
A first mapping relation recording module 404, configured to record a mapping relation between each object in the object subset and the group identifier, so as to obtain a first mapping relation.
A storage module 405, configured to store the object information of the preset object set in blocks according to the group identifier corresponding to the object subset; optionally, in an embodiment of the present disclosure, the storage module 405 includes:
the storage sub-module 4051 is configured to, for each group identifier, store the object information of each object in the object subset corresponding to the group identifier to the same storage block according to the first mapping relationship.
The second mapping relation recording sub-module 4052 is configured to record a mapping relation between the group identifier of the object subset and the storage block, so as to obtain a second mapping relation.
The query processing module 406 is configured to perform query processing on the object information stored in a block according to the group identifier corresponding to the object subset; optionally, in another embodiment of the present disclosure, the query processing module 406 includes:
and the target object set partitioning submodule 4061 is configured to, in response to a query request for a target object set, partition the target object set into a target object subset corresponding to the target group identifier according to the first mapping relationship.
And the target storage block determining submodule 4062 is configured to determine, according to the second mapping relationship, a target storage block corresponding to the target packet identifier.
The query processing sub-module 4063 is configured to read object information from the target storage block to obtain candidate object information, and screen out object information of the target object subset from the candidate object information.
Optionally, in another embodiment of the present disclosure, the object is a merchant, and the preset latitude information includes longitude information and latitude information
In summary, based on the first embodiment, the embodiment of the present disclosure provides another packet query method, which has the beneficial effects of the first embodiment, and in addition, the embodiment of the present disclosure may preferentially aggregate objects according to locations, which is beneficial to improving the query efficiency of the location-based service platform; target dimension information can be accurately selected according to the variance of preset dimension information, and the object subsets are accurately divided according to the median of the target dimension information; the first mapping relation and the second mapping relation can be recorded, and the grouping identification related to the target object set can be read from the target storage block at one time according to the first mapping relation and the second mapping relation, so that the interaction times with a memory can be reduced, and the query efficiency can be improved.
The fourth embodiment is an embodiment of the apparatus corresponding to the second embodiment, and details can be found in the second embodiment and are not described herein again.
An embodiment of the present disclosure also provides an electronic device, referring to fig. 5, including: a processor 501, a memory 502 and a computer program 5021 stored on the memory 502 and executable on the processor, the processor 501 implementing the packet query method of the foregoing embodiments when executing the program.
Embodiments of the present disclosure also provide a readable storage medium, in which instructions, when executed by a processor of an electronic device, enable the electronic device to perform the group query method of the foregoing embodiments.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. In addition, embodiments of the present disclosure are not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the embodiments of the present disclosure as described herein, and any descriptions of specific languages are provided above to disclose the best modes of the embodiments of the present disclosure.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the present disclosure may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the disclosure, various features of the embodiments of the disclosure are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that is, claimed embodiments of the disclosure require more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of an embodiment of this disclosure.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
The various component embodiments of the disclosure may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in a packet querying device according to embodiments of the present disclosure. Embodiments of the present disclosure may also be implemented as an apparatus or device program for performing a portion or all of the methods described herein. Such programs implementing embodiments of the present disclosure may be stored on a computer readable medium or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit embodiments of the disclosure, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. Embodiments of the disclosure may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The above description is only for the purpose of illustrating the preferred embodiments of the present disclosure and is not to be construed as limiting the embodiments of the present disclosure, and any modifications, equivalents, improvements and the like that are made within the spirit and principle of the embodiments of the present disclosure are intended to be included within the scope of the embodiments of the present disclosure.
The above description is only a specific implementation of the embodiments of the present disclosure, but the scope of the embodiments of the present disclosure is not limited thereto, and any person skilled in the art can easily conceive of changes or substitutions within the technical scope of the embodiments of the present disclosure, and all the changes or substitutions should be covered by the scope of the embodiments of the present disclosure. Therefore, the protection scope of the embodiments of the present disclosure shall be subject to the protection scope of the claims.

Claims (9)

1. A method for packet based querying, the method comprising:
selecting position information from preset dimension information as target dimension information, and dividing a preset object set into one or more object subsets according to the target dimension information, wherein each object in each object set is in the same preset area range;
if the data volume of one of the object subsets is larger than a preset data volume threshold, selecting new target dimension information from the dimension information, and taking the object subset as a new preset object set, so as to enter the step of dividing the preset object set into one or more object subsets according to the target dimension information; the new target dimension information is different from the target dimension information;
if the data volume of one of the object subsets is smaller than or equal to a preset data volume threshold, generating a grouping identifier corresponding to the object subset;
according to the grouping identification corresponding to the object subset, carrying out block storage on the object information of the preset object set;
performing query processing on the object information stored in the block according to the grouping identification corresponding to the object subset;
the step of selecting new target dimension information from the dimension information includes:
determining the variance of a preset object on preset dimension information;
and selecting new target dimension information from preset dimension information according to the variance.
2. The method of claim 1, wherein the step of dividing the preset set of objects into one or more object subsets according to the target dimension information comprises:
and dividing the preset object set into two object subsets according to the median of the preset object on the target dimension information.
3. The method according to any one of claims 1 to 2, wherein after the step of generating the group identity corresponding to the subset of objects, the method further comprises:
and recording the mapping relation between each object in the object subset and the grouping identification to obtain a first mapping relation.
4. The method according to claim 3, wherein the step of storing the object information of the preset object set in blocks according to the grouping identifier corresponding to the object subset comprises:
and aiming at each group identifier, storing the object information of each object in the object subset corresponding to the group identifier into the same storage block according to the first mapping relation.
5. The method according to claim 4, wherein after the step of storing, for each group identifier, the object information of each object in the object subset corresponding to the group identifier into the same storage block according to the first mapping relationship, the method further comprises:
and recording the mapping relation between the grouping identification of the object subset and the storage block to obtain a second mapping relation.
6. The method according to claim 5, wherein the step of performing query processing on the object information stored in the block according to the group identifier corresponding to the subset of objects includes:
responding to a query request for a target object set, and dividing the target object set into a target object subset corresponding to a target grouping identifier according to the first mapping relation;
determining a target storage block corresponding to the target grouping identifier according to the second mapping relation;
reading object information from the target storage block to obtain candidate object information, and screening the object information of the target object subset from the candidate object information.
7. A packet querying device, the device comprising:
the preset object set splitting module is used for selecting position information from preset dimension information as target dimension information, and dividing the preset object set into one or more object subsets according to the target dimension information, wherein each object in each object set is in the same preset area range;
the circulation module is used for selecting new target dimension information from the dimension information if the data volume of one of the object subsets is larger than a preset data volume threshold value, and taking the object subset as a new preset object set to enter the preset object set splitting module; the new target dimension information is different from the target dimension information;
the group identifier generating module is used for generating a group identifier corresponding to the object subset if the data volume of one of the object subsets is less than or equal to a preset data volume threshold;
the storage module is used for storing the object information of the preset object set in blocks according to the grouping identification corresponding to the object subset;
the query processing module is used for performing query processing on the object information stored in the block according to the grouping identification corresponding to the object subset;
the circulation module includes:
the variance determining submodule is used for determining the variance of the preset object on the preset dimension information;
and the target dimension information selection submodule is used for selecting new target dimension information from preset dimension information according to the variance.
8. An electronic device, comprising:
processor, memory and computer program stored on the memory and executable on the processor, characterized in that the processor implements the packet query method according to one or more of claims 1-6 when executing the program.
9. A readable storage medium, characterized in that instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the group query method according to one or more of method claims 1-6.
CN201910872156.1A 2019-09-16 2019-09-16 Packet query method and device, electronic equipment and readable storage medium Active CN110781258B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910872156.1A CN110781258B (en) 2019-09-16 2019-09-16 Packet query method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910872156.1A CN110781258B (en) 2019-09-16 2019-09-16 Packet query method and device, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN110781258A CN110781258A (en) 2020-02-11
CN110781258B true CN110781258B (en) 2021-07-09

Family

ID=69383450

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910872156.1A Active CN110781258B (en) 2019-09-16 2019-09-16 Packet query method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN110781258B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021171102A1 (en) * 2020-02-27 2021-09-02 Telefonaktiebolaget Lm Ericsson (Publ) Geohash based auto-segmentation

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101975558A (en) * 2010-09-03 2011-02-16 东南大学 Rapid three-dimensional measurement method based on color grating projection
CN103617295A (en) * 2013-12-16 2014-03-05 北京锐安科技有限公司 Method and device for processing geographic information vector data

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101566986A (en) * 2008-04-21 2009-10-28 阿里巴巴集团控股有限公司 Method and device for processing data in online business processing
CN102722577B (en) * 2012-06-05 2018-02-27 中兴通讯股份有限公司 The determination method and device of index changeable weight
CN103366573A (en) * 2013-07-10 2013-10-23 中兴智能交通(无锡)有限公司 Vehicle running information tracking method and system based on cloud computing
CN104915717B (en) * 2015-06-02 2017-11-14 百度在线网络技术(北京)有限公司 Data processing method, Analysis of Knowledge Bases Reasoning method and relevant apparatus
CN104954063B (en) * 2015-06-24 2018-05-01 成都民航空管科技发展有限公司 A kind of ADS-B data merge method and system
US9699205B2 (en) * 2015-08-31 2017-07-04 Splunk Inc. Network security system
CN106021582B (en) * 2016-06-02 2020-06-05 腾讯科技(深圳)有限公司 Method for filtering position information, method and device for extracting effective webpage information
CN106886674B (en) * 2016-08-24 2019-07-23 阿里巴巴集团控股有限公司 A kind of geographical location Distance Batch calculation method and device
CN108090188B (en) * 2017-12-18 2021-05-07 国家计算机网络与信息安全管理中心 Method for analyzing and mining CDN domain name based on mass data
KR20190087217A (en) * 2018-01-16 2019-07-24 에스케이하이닉스 주식회사 Data storage device and operating method thereof
CN110059241A (en) * 2019-04-25 2019-07-26 网易(杭州)网络有限公司 Information query method and device, computer readable storage medium, electronic equipment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101975558A (en) * 2010-09-03 2011-02-16 东南大学 Rapid three-dimensional measurement method based on color grating projection
CN103617295A (en) * 2013-12-16 2014-03-05 北京锐安科技有限公司 Method and device for processing geographic information vector data

Also Published As

Publication number Publication date
CN110781258A (en) 2020-02-11

Similar Documents

Publication Publication Date Title
US20200136804A1 (en) Data processing method and apparatus
US20180181911A1 (en) Data object allocation method and apparatus and electronic device
CN107015985B (en) Data storage and acquisition method and device
CN108549690B (en) Spatial keyword query method and system based on spatial distance constraint
CN108021333B (en) System, device and method for randomly reading and writing data
CN111738737B (en) Method, device and equipment for generating digital property right certificate
CN110704418A (en) Block chain information query method, device and equipment
CN109117433B (en) Index tree object creation and index method and related device thereof
CN110781258B (en) Packet query method and device, electronic equipment and readable storage medium
CN107256233B (en) Data storage method and device
CN108399175B (en) Data storage and query method and device
CN112799972B (en) Implementation method and device of SSD mapping table, readable storage medium and electronic equipment
CN109726357B (en) Matrix multiplication computing method and computing device
CN110245978A (en) Policy evaluation, policy selection method and device in tactful group
US10606652B2 (en) Determining tenant priority based on resource utilization in separate time intervals and selecting requests from a particular tenant based on the priority
CN111125157B (en) Query data processing method and device, storage medium and processor
CN110019210A (en) Method for writing data and equipment
CN110347699B (en) Method and device for determining activity of entity related to identity card
CN114818458A (en) System parameter optimization method, device, computing equipment and medium
CN111369282B (en) Resource processing method and device
CN114691612A (en) Data writing method and device and data reading method and device
CN113988718A (en) Risk identification method, device and equipment
CN112861014A (en) Function recommendation method and device, electronic equipment and computer-readable storage medium
CN112190933A (en) Special effect processing method and device in game scene
CN109918488A (en) Method and apparatus for similar document retrieval

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
GR01 Patent grant
GR01 Patent grant