CN112364014B - Data query method, device, server and storage medium - Google Patents

Data query method, device, server and storage medium Download PDF

Info

Publication number
CN112364014B
CN112364014B CN202011159083.0A CN202011159083A CN112364014B CN 112364014 B CN112364014 B CN 112364014B CN 202011159083 A CN202011159083 A CN 202011159083A CN 112364014 B CN112364014 B CN 112364014B
Authority
CN
China
Prior art keywords
query
index
data
field
module
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
CN202011159083.0A
Other languages
Chinese (zh)
Other versions
CN112364014A (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 Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202011159083.0A priority Critical patent/CN112364014B/en
Publication of CN112364014A publication Critical patent/CN112364014A/en
Application granted granted Critical
Publication of CN112364014B publication Critical patent/CN112364014B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution

Landscapes

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

Abstract

The disclosure relates to a data query method, a data query device, a server and a storage medium. The data query method comprises the following steps: acquiring query conditions input by a user, wherein the query conditions comprise a first query field and key value information corresponding to the first query field; when a second query field in the pre-stored candidate indexes comprises a first query field, determining a target index matched with the key value information from the candidate indexes; a data identification associated with the target index is determined. By adopting the data query method, the device, the server and the storage medium, the problem that query efficiency is reduced when data stored in a database is excessive in the related technology can be solved.

Description

Data query method, device, server and storage medium
Technical Field
The disclosure relates to the technical field of communication, and in particular relates to a data query method, a data query device, a server and a storage medium.
Background
With the development of technology, the number of application platforms has proliferated, and massive data is stored in databases of each application platform.
Currently, in related technologies, a query needs to be performed in a database according to a query condition to obtain a query result matching the query condition. However, when there is too much data stored in the database, query efficiency may be reduced.
Disclosure of Invention
The disclosure provides a data query method, a data query device, a server and a storage medium, so as to at least solve the problem that query efficiency is reduced when data stored in a database is excessive in the related art.
The technical scheme of the present disclosure is as follows:
according to a first aspect of an embodiment of the present disclosure, there is provided a data query method, including:
acquiring query conditions input by a user, wherein the query conditions comprise a first query field and key value information corresponding to the first query field; when a second query field in the pre-stored candidate indexes comprises a first query field, determining a target index matched with the key value information from the candidate indexes; a data identification associated with the target index is determined.
According to a second aspect of embodiments of the present disclosure, there is provided a data query apparatus, including:
the acquisition module is configured to execute acquisition of query conditions input by a user, wherein the query conditions comprise a first query field and key value information corresponding to the first query field; a matching module configured to perform determining a target index matching the key value information from the candidate indexes when a second query field in the pre-stored candidate indexes includes the first query field; a determination module is configured to perform determining a data identification associated with the target index.
According to a third aspect of embodiments of the present disclosure, there is provided a server comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute instructions to implement the data query method as described in the first aspect.
According to a fourth aspect of embodiments of the present disclosure, there is provided a storage medium, which when executed by a processor of a server, enables the server to perform the data query method as described in the first aspect.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product, which when executed by a processor of a server, enables the server to perform the data query method as described in the first aspect.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
in the embodiment of the disclosure, the target index which is matched with the key value information in the query condition input by the user is determined from the candidate indexes, so that the target index required by the user in the preset database can be rapidly positioned, and scanning query is not required to be performed on each piece of data in the preset database; and then determining the data identifier associated with the target index, wherein the data corresponding to the target index is far smaller than the data of the preset database, which is equivalent to reducing the data range of scanning inquiry, so that the inquiry efficiency can be improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure and do not constitute an undue limitation on the disclosure.
FIG. 1 is a schematic diagram illustrating a data query method, apparatus, electronic device, and storage medium application environment according to an example embodiment.
FIG. 2 is a flow chart illustrating a method of data querying according to an exemplary embodiment.
FIG. 3 is a schematic diagram of a candidate index, according to an example embodiment.
Fig. 4 is a block diagram illustrating a data querying device, according to an example embodiment.
Fig. 5 is a block diagram of a server, according to an example embodiment.
FIG. 6 is a block diagram illustrating an apparatus for data processing according to an example embodiment.
Detailed Description
In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the foregoing figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the disclosure described herein may be capable of operation in sequences other than those illustrated or described herein. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
In order to solve the problem that the query efficiency is reduced when the data stored in the database is too much in the related art.
The disclosure provides a data query method, a data query device, electronic equipment and a storage medium. According to the data query method, the device, the electronic equipment and the storage medium, the target index matched with the key value information in the query condition input by the user can be determined from the candidate indexes, the target index required by the user in the preset database can be rapidly positioned, then the data identifier associated with the target index is determined, and the data corresponding to the target index is far smaller than the data of the preset database, so that the data range of scanning query is reduced, and the query efficiency can be improved.
Fig. 1 is a schematic view of an application environment of a data query method, a device, an electronic apparatus, and a storage medium according to one or more embodiments of the disclosure. As shown in fig. 1, the server 100 is communicatively coupled to one or more clients 200 for data communication or interaction via a network 300. The server 100 may be a web server, database server, or the like. The client 200 may be, but is not limited to, a personal computer (personal computer, PC), a smart phone, a tablet computer, a personal digital assistant (personal digital assistant, PDA), etc. The network 300 may be a wired or wireless network.
The data query method provided by the embodiment of the present disclosure will be described in detail below.
The data query method provided in the embodiments of the present disclosure may be applied to the client 200, and for convenience of description, the embodiments of the present disclosure are described with the client 200 as an execution body unless otherwise specified. It is to be understood that the subject of execution is not to be construed as limiting the present disclosure.
Next, a data query method provided by the present disclosure is described.
FIG. 2 is a flow chart illustrating a method of data querying according to an exemplary embodiment.
As shown in fig. 2, the data query method may include the following steps.
S210, acquiring query conditions input by a user, wherein the query conditions comprise a first query field and key value information corresponding to the first query field.
S220, when the second query field in the pre-stored candidate indexes comprises the first query field, determining a target index matched with the key value information from the candidate indexes.
S230, determining a data identification associated with the target index.
The specific implementation of each of the above steps will be described in detail below.
In the embodiment of the disclosure, the target index which is matched with the key value information in the query condition input by the user is determined from the candidate indexes, so that the target index required by the user in the preset database can be rapidly positioned, and scanning query is not required to be performed on each piece of data in the preset database; and then determining the data identifier associated with the target index, wherein the data corresponding to the target index is far smaller than the data of the preset database, which is equivalent to reducing the data range of scanning inquiry, so that the inquiry efficiency can be improved.
A specific implementation of each of the above steps is described below.
S210 is first described.
And acquiring query conditions input by a user, wherein the query conditions comprise a first query field and key value information corresponding to the first query field.
When the query condition input by the user is "25< user age <45", the first query field included in the query condition is "user age", and the key value information corresponding to the first query field is "25< user age <45". The key value information of "25< user age <45" can also be understood as that the user age is in the interval of (25, 45).
S220 is then introduced.
If the query condition input by the user is not in the second query field in the prestored candidate indexes, full-table scanning is performed, and if the query condition input by the user is in the second query field in the prestored candidate indexes, a target index matched with the key value information can be determined from the candidate indexes. How the candidate index is constructed will be described in detail below.
In some embodiments of the present disclosure, before S220, the following steps may be further included:
obtaining an index granularity and at least one second query field; ordering the data corresponding to the second query field in the preset database according to a preset sequence to obtain a data sequence; dividing the data sequence according to the index granularity to obtain at least one second index group; and determining at least one candidate index according to the second index group and the data identification associated with the second index group in the preset database.
As shown in fig. 3, the index granularity is 3, i.e., every 3 pieces of data, a candidate index is generated. The candidate index includes an index second index group and a data identification. As shown, the second index group consists of search field values, and the data identification may be an id.
The second index set of candidate indexes consists of at least one array, the number of arrays being related to the number of index fields that need to be established. As shown in fig. 3, it is necessary to create an array of two second query fields, namely, a second index group portion of the candidate index, including two arrays, in which the first element in the array represents the distribution of product_name in the batch of data, [ app, app ] represents that the data starts with app values and the app values end; the second element represents the distribution of user_age in the batch, and [18,22] represents that user_age of the batch starts at 18 and ends at 22. Candidate indexes can be established according to the above description.
It should be noted that the index granularity given in the above embodiment is 3; the smaller the index granularity is, the higher the retrieval efficiency is, but the more data the index needs to store is; the larger the index granularity, the lower the retrieval efficiency, but the storage space can be saved. The index granularity value can be selected by the storage size and the requirement in the actual application scene, and the disclosure is not limited.
Here, by establishing the candidate indexes in advance, the speed of determining the target index matching the key value information from among the candidate indexes can be increased.
In some embodiments of the present disclosure, before the step related to obtaining the index granularity and the at least one second query field, the method may further include the steps of:
acquiring a history query field and a query frequency included in a history query condition; and determining a second query field with the query frequency larger than a preset threshold value from the historical query fields.
For the historical query conditions, the historical query conditions can be collected, the frequencies of the historical query fields included in the historical query conditions are ordered, and a certain field with higher query frequency, namely a second query field with the query frequency larger than a preset threshold value, is screened out. Specific screening of several fields may be determined according to actual service requirements, and the disclosure is not limited.
Here, according to the second query field with the query frequency greater than the preset threshold value determined in the historical query fields, the field with the higher query frequency can be screened out and used as the candidate index to be determined later, so that the hit rate of the query condition in the candidate index is improved.
In some embodiments of the present disclosure, in the step of ordering the data corresponding to the second query field in the preset database according to the preset order to obtain the data sequence, the method specifically may include the following steps:
when the second query field is a numerical value field, sequencing the data according to a preset size sequence to obtain a data sequence; and when the second query field is a character field, sequencing the data according to a preset text sequence to obtain a data sequence.
Wherein, the numerical type field includes a numerical field, and the character type field includes: a symbol field, a letter field, and a text field.
Illustratively, the second query field may include: an index group name (product_name) and a user age (user_age), wherein the index group name is a character field, and the data are ordered according to a preset text sequence (such as dictionary sequence); the age of the user is a numeric field, and the data are ordered according to a preset size order.
Here, the second query fields of different types are ordered according to different ordering modes, so that a clear and ordered data sequence can be obtained, and the data sequence can be conveniently divided subsequently.
In some embodiments of the present disclosure, in the step of dividing the data sequence according to the index granularity to obtain at least one second index group, the method specifically may include the following steps:
dividing the data sequence corresponding to the second query field according to the index granularity to obtain at least one index interval; and determining a second index group according to the index intervals, wherein the second index group comprises at least one index interval corresponding to the second query field.
Specifically, when the second query field is a numeric field, the data sequence corresponding to the second query field may be [18,70], and when the index granularity is 3, the data sequence corresponding to the second query field is divided according to the index granularity to obtain at least one index interval, as shown in fig. 3, where the obtained index intervals are [18,22], [17,34], [41,60] and [70,70].
When the second query field is a character type field, the data sequence corresponding to the second query field may be [ app, dpp ], and when the index granularity is 3, the data sequence corresponding to the second query field is divided according to the index granularity to obtain at least one index interval, as shown in fig. 3, where the obtained index intervals are [ app, app ], [ bpp, cpp ], [ cpp, dpp ] and [ dpp, dpp ].
Finally, a second index group ([ 18,22], [ app, app ]) ([ 17,34], [ bpp, cpp ]) ([ 41,60], [ cpp, dpp ]) and ([ 70,70], [ dpp, dpp ]) is determined based on the index sections [18,22], [17,34], [41,60] and [70,70], and [ bpp, cpp, dpp ] determined as described above.
Here, the data sequence corresponding to the second query field is divided according to the index granularity to obtain at least one index interval, and then the second index group is determined according to the index interval, so that the field types included in the second index group can be enriched, and the query is further accelerated.
In some embodiments of the present disclosure, S220 may specifically include the following steps: determining a first index interval according to the first query field and the corresponding key value information; acquiring at least one second index interval corresponding to a second query field included in a second index group; comparing the second index interval with the first index interval, and determining a target index interval containing at least part of the first index interval from the second index interval; and determining a second index group corresponding to the target index interval as a target index.
In some embodiments of the present disclosure, the first query field includes at least a first subfield and a second subfield, and in S320, the method specifically may include the following steps:
traversing the candidate indexes to obtain first candidate indexes matched with the first subfields; traversing the first candidate index to obtain a target index matched with the second sub-field.
Illustratively, when the key value information of the user query is "product_name=cpp AND17< user_age <34", the first query field includes at least a first subfield "product_name=cpp" AND a second subfield "17< user_age <34", AND the candidate index is traversed first to obtain a first candidate index ([ bpp, cpp ], [17,34 ]) AND ([ cpp, dpp ], [41,60 ]) matching the first subfield.
Then, traversing is performed on the basis of the first candidate index, and a target index ([ bpp, cpp ], [17,34 ]) matched with the second subfield "17< user_age < 34".
It will be appreciated that when the first query field includes more than three subfields, after the first candidate index matching the first subfield is obtained and the target index matching the second subfield is obtained, the target index is determined as the first candidate index, and the traversal of the target index matching the third subfield is continued on the basis of the first candidate index.
Here, by sequentially traversing the candidate indexes of the first sub-field and the second sub-field, the target index matching the first query field can be quickly and accurately determined.
Finally S230 is introduced.
In some embodiments of the present disclosure, the key value information is partially matched with the target index, and in the step related to determining the data identifier associated with the target index, the method may specifically include the following steps:
and removing the data identification which does not meet the key value information from the data identifications associated with the target index to obtain a query result.
For example, when the key value information queried by the user is "product_name=dpp", the data identifiers associated with the target index ([ cpp, dpp ], [41,60 ]) and the target index ([ dpp, dpp ], [70,70 ]) each contain data of "product_name=dpp", and the data identifiers corresponding to the two target indexes are fetched, and the data identifiers of which the product_name is not equal to dpp are filtered, so that the query result can be obtained.
For example, when the key value information of the user query is "user_age <45", the data identifiers associated with the target index ([ bpp, cpp ], [17,34 ]) and the target index ([ cpp, dpp ], [41,60 ]) are queried, and each data identifier contains "user_age <45", the data identifiers corresponding to the two target indexes are taken out, and the data identifiers with the user_age not less than 45 are filtered, so that the query result can be obtained.
For example, when the key value information queried by the user is "product_name=dpp anduster_age >65", the data identifier associated with the target index ([ dpp, dpp ], [70,70 ]) is queried to contain the data "product_name=dpp anduster_age >65", and the data identifier corresponding to the target index is fetched, and the data identifier which does not satisfy the key value information is filtered, so that the query result can be obtained.
Here, by removing the data identifier that does not satisfy the key value information from the data identifiers associated with the target index, the accuracy of the query result can be improved.
In summary, embodiments of the present disclosure determine at least one candidate index comprising an associated second index group and data identification by determining at least one and a second query field according to an index granularity; then determining a target index matched with the query condition from at least one candidate index according to the key value information in the query condition input by the user, wherein the target index matched with the query condition input by the user is determined from the candidate indexes, so that the target index required by the user in the preset database can be rapidly positioned, and scanning query is not required to be carried out on each piece of data in the preset database; and finally, determining a query result from the data identification of the target index according to the query condition, wherein the data corresponding to the target index is far smaller than the data of the preset database, which is equivalent to reducing the data range of scanning query, so that the query efficiency can be improved.
Based on the data query method, the disclosure also provides a data query device. This is described in detail with reference to fig. 4.
Fig. 4 is a block diagram illustrating a data querying device, according to an example embodiment. Referring to fig. 4, the data query apparatus 400 may include an acquisition module 410, a matching module 420, and a determination module 430.
The obtaining module 410 is configured to perform obtaining a query condition input by a user, where the query condition includes a first query field and corresponding key value information.
The matching module 420 is configured to determine a target index matching the key value information from the candidate indexes when the second query field in the pre-stored candidate indexes includes the first query field.
The determination module 430 is configured to perform determining a data identification associated with the target index.
In an embodiment of the present disclosure, the data querying device 400 is capable of determining at least one candidate index comprising an associated second index group and a data identification from the index granularity at least one and the second query field; then determining a target index matched with the query condition from at least one candidate index according to the key value information in the query condition input by the user, wherein the target index matched with the query condition input by the user is determined from the candidate indexes, so that the target index required by the user in the preset database can be rapidly positioned, and scanning query is not required to be carried out on each piece of data in the preset database; and finally, determining a query result from the data identification of the target index according to the query condition, wherein the data corresponding to the target index is far smaller than the data of the preset database, which is equivalent to reducing the data range of scanning query, so that the query efficiency can be improved.
In some embodiments of the present disclosure, the obtaining module is further configured to perform obtaining the index granularity and the at least one second query field.
Accordingly, the data query device 400 may further include: the sorting module and the dividing module;
the ordering module is configured to order the data corresponding to the second query field in the preset database according to a preset sequence, so as to obtain a data sequence.
The partitioning module is configured to perform partitioning of the data sequence according to an index granularity, resulting in at least one second index group.
The determining module 420 is further configured to perform determining at least one candidate index from the second index set and the data identification associated with the second index set in the preset database.
In some embodiments of the present disclosure, the acquisition module 410 is further configured to execute the history query field and its query frequency included in the acquisition history query condition.
The determining module 420 is further configured to execute a second query field that determines from the historical query fields that the query frequency is greater than a preset threshold.
In some embodiments of the present disclosure, the partitioning module is further configured to perform partitioning the data sequence corresponding to the second query field according to an index granularity to obtain at least one index interval.
The determining module 420 is further configured to perform determining a second index group according to the index intervals, the second index group including at least one index interval corresponding to the second query field.
In some embodiments of the present disclosure, the sorting module is further configured to perform sorting of the data according to a preset size order to obtain the data sequence when the second query field is a numeric class field.
The sorting module is further configured to sort the data according to a preset text sequence when the second query field is a character field, so as to obtain a data sequence.
In some embodiments of the present disclosure, the first query field includes at least a first sub-field and a second sub-field, and the matching module 420 includes a traversal module;
the traversal module is configured to perform traversing the candidate indexes to obtain first candidate indexes matched with the first subfields.
The traversal module is configured to traverse the first candidate index to obtain a target index that matches the second sub-field.
In some embodiments of the present disclosure, the determination module 430 includes a removal module;
the removing module is configured to remove the data identifier which does not meet the key value information from the data identifiers associated with the target index, and obtain a query result.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
Fig. 5 is a block diagram of a server, according to an example embodiment. Referring to fig. 5, the embodiment of the present disclosure further provides a server including a processor 510, a communication interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 complete communication with each other through the communication bus 540.
The memory 530 is used for storing instructions executable by the processor 510.
The processor 510 is configured to execute the instructions stored in the memory 530, and implement the following steps:
acquiring query conditions input by a user, wherein the query conditions comprise a first query field and key value information corresponding to the first query field; when a second query field in the pre-stored candidate indexes comprises a first query field, determining a target index matched with the key value information from the candidate indexes; a data identification associated with the target index is determined.
As can be seen, applying the disclosed embodiments, determining at least one candidate index comprising an associated second index group and data identification from the index granularity at least one and the second query field; then determining a target index matched with the query condition from at least one candidate index according to the key value information in the query condition input by the user, wherein the target index matched with the query condition input by the user is determined from the candidate indexes, so that the target index required by the user in the preset database can be rapidly positioned, and scanning query is not required to be carried out on each piece of data in the preset database; and finally, determining a query result from the data identification of the target index according to the query condition, wherein the data corresponding to the target index is far smaller than the data of the preset database, which is equivalent to reducing the data range of scanning query, so that the query efficiency can be improved.
FIG. 6 is a block diagram illustrating an apparatus for data processing according to an example embodiment. For example, the device 600 may be provided as a server. Referring to fig. 6, server 600 includes a processing component 622 that further includes one or more processors and memory resources represented by memory 632 for storing instructions, such as applications, executable by processing component 622. The application programs stored in memory 632 may include one or more modules each corresponding to a set of instructions. Further, the processing component 622 is configured to execute instructions to perform the data query method described in any of the embodiments above.
The device 600 may also include a power component 626 configured to perform power management of the device 600, a wired or wireless network interface 650 configured to connect the device 600 to a network, and an input/output (I/O) interface 658. The device 600 may operate based on an operating system stored in memory 632, such as Windows Server, mac OS XTM, unixTM, linuxTM, freeBSDTM, or the like.
In some embodiments of the present disclosure, there is further provided a storage medium, which when executed by a processor of a server, enables the server to perform the data query method described in any one of the above embodiments.
Alternatively, the storage medium may be a non-transitory computer readable storage medium, which may be, for example, ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
In some embodiments of the present disclosure, there is also provided a computer program product, which when executed by a processor of a server, enables the server to perform the data query method according to any of the embodiments described above.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (12)

1. A method of querying data, comprising:
acquiring a query condition input by a user, wherein the query condition comprises a first query field and key value information corresponding to the first query field;
determining a target index matched with the key value information from the candidate indexes when a second query field in the pre-stored candidate indexes comprises the first query field;
determining a data identification associated with the target index;
before the determining, from the candidate indexes, a target index that matches the key value information, the method further includes:
acquiring a history query field and a query frequency included in a history query condition;
determining a second query field with the query frequency larger than a preset threshold value from the historical query fields;
obtaining an index granularity and at least one of the second query fields;
ordering the data corresponding to the second query field in the preset database according to a preset sequence to obtain a data sequence;
dividing the data sequence according to the index granularity to obtain at least one second index group;
and determining the at least one candidate index according to the second index group and the data identifier associated with the second index group in the preset database.
2. The method of claim 1, wherein the dividing the data sequence according to the index granularity to obtain at least one second index group comprises:
dividing the data sequence corresponding to the second query field according to the index granularity to obtain at least one index interval;
and determining the second index group according to the index interval, wherein the second index group comprises at least one index interval corresponding to the second query field.
3. The method of claim 1, wherein the sorting the data corresponding to the second query field in the preset database according to the preset order to obtain the data sequence includes:
when the second query field is a numerical value field, sequencing the data according to a preset size sequence to obtain the data sequence;
and when the second query field is a character field, sequencing the data according to a preset text sequence to obtain the data sequence.
4. The method of claim 1, wherein the first query field comprises at least a first subfield and a second subfield, wherein determining a target index from the candidate indexes that matches the key information comprises:
traversing the candidate indexes to obtain first candidate indexes matched with the first subfields;
traversing the first candidate index to obtain the target index matched with the second sub-field.
5. The method of claim 1, wherein the key information matches the target index portion, and wherein the determining the data identification associated with the target index comprises:
and removing the data identifier which does not meet the key value information from the data identifiers associated with the target index, and obtaining the query result.
6. A data query device, comprising:
the acquisition module is configured to execute acquisition of query conditions input by a user, wherein the query conditions comprise a first query field and corresponding key value information;
a matching module configured to perform determining a target index matching the key value information from among the candidate indexes when a second query field of the pre-stored candidate indexes includes the first query field;
a determining module configured to perform determining a data identification associated with the target index;
the acquisition module is further configured to execute a history query field and a query frequency included in the history query condition;
the determining module is further configured to execute a second query field, wherein the query frequency of the second query field is greater than a preset threshold value, from the historical query fields;
the acquisition module is further configured to perform acquisition of an index granularity and at least one of the second query fields;
correspondingly, the device further comprises: the sorting module and the dividing module;
the ordering module is configured to perform ordering on the data corresponding to the second query field in the preset database according to a preset sequence to obtain a data sequence;
the dividing module is configured to perform dividing on the data sequence according to the index granularity to obtain at least one second index group;
the determining module is further configured to perform determining the at least one candidate index according to the second index group and a data identification associated with the second index group in the preset database.
7. The apparatus of claim 6, wherein the partitioning module is further configured to perform partitioning of the data sequence corresponding to the second query field according to the index granularity to obtain at least one index interval;
the determining module is further configured to determine the second index group according to the index interval, where the second index group includes at least one index interval corresponding to the second query field.
8. The apparatus of claim 6, wherein the ordering module is further configured to perform ordering the data according to a predetermined size order to obtain the data sequence when the second query field is a numeric class field;
and the ordering module is further configured to perform ordering on the data according to a preset text sequence when the second query field is a character field, so as to obtain the data sequence.
9. The apparatus of claim 6, wherein the first query field comprises at least a first subfield and a second subfield, and the matching module comprises a traversal module;
the traversing module is configured to perform traversing the candidate indexes to obtain first candidate indexes matched with the first subfields;
the traversing module is configured to traverse the first candidate index to obtain the target index matched with the second sub-field.
10. The apparatus of claim 6, wherein the determination module comprises a removal module;
and the removing module is configured to remove the data identifier which does not meet the key value information from the data identifiers associated with the target index, so as to obtain the query result.
11. A server, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the data query method of any one of claims 1 to 5.
12. A storage medium, wherein instructions in the storage medium, when executed by a processor of a server, enable the server to perform the data query method of any one of claims 1 to 5.
CN202011159083.0A 2020-10-26 2020-10-26 Data query method, device, server and storage medium Active CN112364014B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011159083.0A CN112364014B (en) 2020-10-26 2020-10-26 Data query method, device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011159083.0A CN112364014B (en) 2020-10-26 2020-10-26 Data query method, device, server and storage medium

Publications (2)

Publication Number Publication Date
CN112364014A CN112364014A (en) 2021-02-12
CN112364014B true CN112364014B (en) 2024-01-02

Family

ID=74510518

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011159083.0A Active CN112364014B (en) 2020-10-26 2020-10-26 Data query method, device, server and storage medium

Country Status (1)

Country Link
CN (1) CN112364014B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112835930A (en) * 2021-03-03 2021-05-25 上海渠杰信息科技有限公司 Database query method and device
CN112765118B (en) * 2021-04-08 2021-08-03 北京优特捷信息技术有限公司 Log query method, device, equipment and storage medium
CN113157703B (en) * 2021-04-29 2023-11-21 北京小米移动软件有限公司 Data query method and device, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106959963A (en) * 2016-01-12 2017-07-18 杭州海康威视数字技术股份有限公司 A kind of data query method, apparatus and system
CN111008200A (en) * 2019-12-18 2020-04-14 北京数衍科技有限公司 Data query method and device and server
CN111797134A (en) * 2020-06-23 2020-10-20 北京小米松果电子有限公司 Data query method and device of distributed database and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106959963A (en) * 2016-01-12 2017-07-18 杭州海康威视数字技术股份有限公司 A kind of data query method, apparatus and system
CN111008200A (en) * 2019-12-18 2020-04-14 北京数衍科技有限公司 Data query method and device and server
CN111797134A (en) * 2020-06-23 2020-10-20 北京小米松果电子有限公司 Data query method and device of distributed database and storage medium

Also Published As

Publication number Publication date
CN112364014A (en) 2021-02-12

Similar Documents

Publication Publication Date Title
CN112364014B (en) Data query method, device, server and storage medium
US11526799B2 (en) Identification and application of hyperparameters for machine learning
CN111143597B (en) Image retrieval method, terminal and storage device
CN112328842B (en) Data processing method and device, electronic equipment and storage medium
CN109829073B (en) Image searching method and device
CN107357794B (en) Method and device for optimizing data storage structure of key value database
CN112800197A (en) Method and device for determining target fault information
CN108182200B (en) Keyword expansion method and device based on semantic similarity
CN111435406A (en) Method and device for correcting database statement spelling errors
CN112148841B (en) Object classification and classification model construction method and device
CN114791927A (en) Data analysis method and device
CN111104422B (en) Training method, device, equipment and storage medium of data recommendation model
CN106844406B (en) Search method and search device
CN115147020B (en) Decoration data processing method, device, equipment and storage medium
CN112765118B (en) Log query method, device, equipment and storage medium
CN110633430B (en) Event discovery method, apparatus, device, and computer-readable storage medium
CN113344023A (en) Code recommendation method, device and system
CN114661753A (en) Call bill retrieval method and device
CN112527622A (en) Performance test result analysis method and device
US9842112B1 (en) System and method for identifying fields in a file using examples in the file received from a user
CN116541801B (en) Multi-device information centralized processing system, device and storage medium
CN114153830B (en) Data verification method and device, computer storage medium and electronic equipment
CN108536362B (en) Method and device for identifying operation and server
CN109885739B (en) Data processing method, system and storage medium
CN116627966A (en) Data management method, device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant