CN108121733B - Data query method and device - Google Patents

Data query method and device Download PDF

Info

Publication number
CN108121733B
CN108121733B CN201611079374.2A CN201611079374A CN108121733B CN 108121733 B CN108121733 B CN 108121733B CN 201611079374 A CN201611079374 A CN 201611079374A CN 108121733 B CN108121733 B CN 108121733B
Authority
CN
China
Prior art keywords
data query
data
rule
uniqueness
specified
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
CN201611079374.2A
Other languages
Chinese (zh)
Other versions
CN108121733A (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 Gridsum Technology Co Ltd
Original Assignee
Beijing Gridsum 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 Gridsum Technology Co Ltd filed Critical Beijing Gridsum Technology Co Ltd
Priority to CN201611079374.2A priority Critical patent/CN108121733B/en
Publication of CN108121733A publication Critical patent/CN108121733A/en
Application granted granted Critical
Publication of CN108121733B publication Critical patent/CN108121733B/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/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/951Indexing; Web crawling techniques

Abstract

The invention discloses a data query method and a data query device, relates to the technical field of data processing, and mainly aims to improve the stability of data display at the front end. The method comprises the following steps: receiving a data query request, wherein the data query request carries a specified data query rule, the specified data query rule is used for indicating how to perform data query, judging whether a data query result obtained by performing data query by using the specified data query rule has uniqueness or not, if not, performing data query by using a preset data query rule, obtaining the data query result obtained by performing data query according to the preset data query rule and sending the data query result obtained by performing data query by using the preset data query rule. The invention is mainly used for data query.

Description

Data query method and device
Technical Field
The invention relates to the field of data processing, in particular to a data query method and device.
Background
In the process of website research and development, a large amount of data is needed, and a data acquisition request can be sent to a back end through a front end to obtain corresponding data, so that the data can be displayed at the front end. When the front end of the website requests data from the back end, the quantity of the data is very large, which can reach thousands or even tens of thousands, and the front end cannot bear the display of all the data, so that the displayed data is incomplete.
In the prior art, the problem is solved by adopting the following method in the application process, when a large amount of data needs to be queried, the data query is often realized by sending data query requests in batches, namely, a front end requests a rear end for a part of data each time, and a final query result is obtained by querying the data for many times. However, when the front end requests data from the back end for multiple times, the back end needs to rely on multiple data tables when processing the data requested by the front end, and when the query condition cannot guarantee the uniqueness of the data query, the data returned to the front end by the back end each time will be inconsistent. For example, when the front end requests 1 to 10 pieces of data from the back end for the first time, the back end correspondingly returns 1 to 10 pieces of data to the front end, and when the front end requests 1 to 10 pieces of data from the back end for the second time, the data returned to the front end by the back end is inconsistent with the data returned for the first time, or the sequence is disordered, that is, there is a problem of poor data query stability, which causes errors in data query results, and further affects the display of the data at the front end.
Disclosure of Invention
In view of the above problems, the present invention is proposed to provide a method and an apparatus for querying data, which overcome the above problems or at least partially solve the above problems, and can improve the stability of data presentation in a front end.
In one aspect, the present invention provides a method for querying data, including:
receiving a data query request, wherein the data query request carries a specified data query rule, and the specified data query rule is used for indicating how to perform data query;
judging whether a data query result obtained by querying data by adopting the specified data query rule has uniqueness;
if not, a preset data query rule is adopted for data query, and a data query result obtained by performing data query according to the preset data query rule has uniqueness;
and sending a data query result obtained by querying data by adopting the preset data query rule.
Further, if it is determined that the data query result obtained by querying the data using the specified data query rule is unique, the method further includes:
adopting the specified data query rule to perform data query to obtain a data query result;
and sending a data query result obtained by querying data by adopting the specified data query rule.
Further, the determining whether the data query result obtained by performing the data query by using the specified data query rule has uniqueness includes:
obtaining historical data query results obtained by historically adopting the specified data query rule to perform data query;
judging whether the historical data query results of any two times are the same;
if so, judging that the data query result obtained by querying the data by adopting the specified data query rule has uniqueness;
otherwise, judging that the data query result obtained by the data query according to the specified data query rule has no uniqueness.
Further, after it is determined that the data query result obtained by performing the data query by using the specified data query rule does not have uniqueness, the method further includes:
judging whether a part of data query results obtained by querying data by adopting the specified data query rule have uniqueness or not;
if so, the specified data query rule is adopted to query the part data with uniqueness in the part data query result to obtain a first part data query result;
the data query by adopting the preset data query rule comprises the following steps:
and querying data except the uniqueness of the partial data query result by adopting a preset data query rule to obtain a second partial data query result.
Further, before sending a data query result obtained by querying data using the preset data query rule, the method further includes:
and combining the first part of data query results and the second part of data query results, and taking the combined data query results as data query results obtained by querying data by adopting the preset data query rule.
In another aspect, the present invention provides an apparatus for querying data, including:
the device comprises a receiving unit, a sending unit and a receiving unit, wherein the receiving unit is used for receiving a data query request, the data query request carries a specified data query rule, and the specified data query rule is used for indicating how to perform data query;
the first judgment unit is used for judging whether a data query result obtained by querying data by adopting the specified data query rule has uniqueness;
the first query unit is used for querying data by adopting a preset data query rule if a data query result obtained by querying the data by adopting the specified data query rule does not have uniqueness, and the data query result obtained by querying the data according to the preset data query rule has uniqueness;
and the first sending unit is used for sending a data query result obtained by querying data by adopting the preset data query rule.
Further, the apparatus further comprises:
the second query unit is used for performing data query by adopting the specified data query rule to obtain a data query result after judging that the data query result obtained by performing data query by adopting the specified data query rule has uniqueness;
and the second sending unit is used for sending a data query result obtained by querying data by adopting the specified data query rule.
Further, the first judgment unit includes:
the acquisition module is used for acquiring historical data query results obtained by historically adopting the specified data query rule to perform data query;
the first judgment module is used for judging whether the historical data query results of any two times are the same;
the second judgment module is used for judging that the data query result obtained by adopting the specified data query rule to perform data query has uniqueness if the historical data query results of any two times are the same;
the second judging module is further configured to judge that a data query result obtained by performing data query according to the specified data query rule is not unique if any two historical data query results are different.
Further, the apparatus further comprises:
the second judging unit is used for judging whether a part of data query results obtained by data query according to the specified data query rule have uniqueness or not after judging that the data query results obtained by data query according to the specified data query rule do not have uniqueness;
a third query unit, configured to query, if there is uniqueness in a partial data query result obtained by performing data query using the specified data query rule, partial data having uniqueness in the partial data query result using the specified data query rule, so as to obtain a first partial data query result;
and the fourth query unit is used for querying the data of the part of the data query result except the uniqueness by adopting a preset data query rule to obtain a second part of the data query result.
Further, the apparatus further comprises:
and the merging unit is used for merging the first part of data query results and the second part of data query results, and taking the merged data query results as data query results obtained by querying data by adopting the preset data query rule.
By means of the technical scheme, the data query method and the data query device provided by the invention determine the stability of the data requested by the front end to the back end by judging whether the data query result obtained by using the specified data query rule for data query has uniqueness, if the data query result does not have uniqueness, the current data stability is poor, further, the data query is performed by using the preset data query rule, and the data query result obtained by performing data query according to the preset data query rule has uniqueness, so that the stability of the data query result received by the front end is ensured. Compared with the data query method in the prior art, the data query method and the device have the advantages that the data query is carried out by adopting the preset data query rule, so that the returned data sequence is consistent each time when the front end receives the data query result returned by the back end, the display effect of the data at the front end is ensured, and the stability of the data query is improved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a schematic flow chart illustrating a data query method according to an embodiment of the present invention;
FIG. 2 is a flow chart of another data query method provided by the embodiment of the invention;
FIG. 3 is a block diagram illustrating an apparatus for querying data according to an embodiment of the present invention;
fig. 4 is a block diagram illustrating another data querying apparatus according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The embodiment of the invention provides a flow diagram of a data query method, as shown in fig. 1, the method includes:
101. a data query request is received.
The data query request carries a specified data query rule, and the specified data query rule is used for indicating how to perform data query, for example, the specified data query rule may be a rule that the data is specified to be queried according to date sorting, and the data is specified to be queried according to access frequency sorting.
For the embodiment of the invention, the execution main body for receiving the data query request is a back end, the execution main body relates to a management background of a database and a dynamic language design, the corresponding execution main body for sending the back-end data query request is a front end, the execution main body relates to a foreground of page data display, the back end relates to the management of the database, the data quantity which can be provided by the back end is very huge, thousands or even tens of thousands, the front end has limited data bearing capacity, and the required data query request can be carried by the front end to the back end every time the front end requests data, so that the back end can send the data query result to the front end within the tolerance limit of the front end.
102. And judging whether the data query result obtained by querying the data by adopting the specified data query rule has uniqueness.
The method for judging whether the data query result obtained by performing data query by using the specified data query rule has uniqueness may be, but is not limited to, the method of first obtaining historical data query results obtained by performing data query by using the specified data query rule historically, judging whether the historical data query results obtained by performing data query by using the specified data query rule are the same for any two times, if so, judging that the data query result obtained by performing data query by using the specified data query rule has uniqueness, and if not, judging that the data query result obtained by performing data query by using the specified data query rule does not have uniqueness.
Illustratively, 5 pieces of data returned by the back end to the front end are data query results queried by a specified data query rule, the data query rule is indicated to be a sorting rule according to dates, and each piece of data corresponds to a different date, the data query results queried by the data query rule by the specified data query rule are 5 pieces of data arranged according to the date sequence, the sequence of each piece of data is fixed, and the data query results queried by the data query rule by the specified data query rule are judged to be unique.
Similarly, the 5 pieces of data { a1a2a3a4a5} returned by the back end to the front end are data query results that are queried according to a data query rule, indicate that the data query rule is a sort rule by date, the dates corresponding to the first 2 data { a1a2} are the same, namely 5/1/2014, the dates corresponding to the last 3 data { a3a4a5} are the same, namely 5/2014, the data query result of the data query rule by adopting the specified data query rule is 5 pieces of data arranged according to the date sequence, and the first 2 pieces of data are sorted before the last 3 pieces of data, and the order of the first 2 pieces of data and the order of the last 3 pieces of data are not fixed, for example, the results of two historical data queries may be { a1a2a3a4a5} and { a2a1a4a3a5}, or may be { a1a2a3a4a5} and { a2a1a4a5a3}, judging that the data query result obtained by querying the data by adopting the specified data query rule has no uniqueness.
103. And if the data query result obtained by using the specified data query rule to perform data query does not have uniqueness, performing data query by using a preset data query rule.
The data query result obtained by performing data query according to the preset data query rule has uniqueness, it should be noted that the preset data query rule is at least one data query condition, and if one data query condition cannot guarantee that the data query result has uniqueness, a plurality of data query conditions are preset, where the data query condition may include a requirement for the returned data query result, for example, how many pieces of data are included in the data query result, a sorting condition of the data, a type requirement of the data, and the like.
For the embodiment of the invention, if the data query result obtained by using the specified data query rule for data query does not have uniqueness, the data query result is poor in data stability and is not suitable for being sent to the front end for display, and the data query is further performed on the data by using the preset data query rule so that the obtained data query result has uniqueness, thereby ensuring the stability of the data displayed at the front end.
104. And sending a data query result obtained by querying data by adopting the preset data query rule.
The data query result obtained by querying the data by adopting the preset data query rule has uniqueness, and the stability of the data displayed at the front end can be ensured, so that the applicability of data in the actual development process of research personnel is strong, and the data operation experience is improved.
In the data query method provided by the embodiment of the present invention, the stability of the data requested by the front end to the back end is determined by judging whether the data query result obtained by querying the data by using the specified data query rule has uniqueness, if the data query result does not have uniqueness, the current data stability is poor, the data query is further performed by using the preset data query rule, and the data query result obtained by querying the data according to the preset data query rule has uniqueness, so that the stability of the data query result received by the front end is ensured. Compared with the data query method in the prior art, the data query method and the device have the advantages that the data query is carried out by adopting the preset data query rule, so that the returned data sequence is consistent each time when the front end receives the data query result returned by the back end, the display effect of the data at the front end is ensured, and the stability of the data query is improved.
An embodiment of the present invention provides another data query method, as shown in fig. 2, the method includes:
201. a data query request is received.
The data query request is used for the front end to request the back end to acquire data for display, and the data query request carries a specified data query rule for indicating how to perform data query, for example, the specified data query rule may be data with the search volume of the acquired data arranged in the front 10, or data with the exposure volume of the acquired data arranged in the back 10, and the like.
For the embodiment of the present invention, the manner in which the back end receives the front-end data query request may be through a preset interactive interface, and the interactive interface can implement data interaction between the back end and the front end, so that the data at the back end can be displayed at the front end, and the data at the front end can implement a processing process at the back end.
202. And judging whether the data query result obtained by querying the data by adopting the specified data query rule has uniqueness.
For the embodiment of the present invention, before determining whether the data query result obtained by performing the data query by using the specified data query rule has uniqueness, it may also be determined whether a partial data query result exists in the data query result obtained by performing the data query by using the specified data query rule has uniqueness, if so, it indicates that the partial data in the data has uniqueness, but still does not have uniqueness, then the specified data query rule is used to perform the query on the partial data of which the partial data query result has uniqueness, so as to obtain the first partial data query result, if not, it indicates that the data does not have uniqueness at all, and step 203a is directly performed.
In the first case, that is, for a data query result obtained by performing a data query using a specified data query rule, if a partial data query result has uniqueness, the specified data query rule is, for example, sorted by date, and for 5 pieces of data sorted by date, if the dates of the first 2 pieces of data are the same and the dates of the last 3 pieces of data are the same, it indicates that the order of the first 2 pieces of data and the order of the last 3 pieces of data are not fixed, the partial data query result has uniqueness in the data query result obtained by performing the data query using the date sorting for the 5 pieces of data, and further, the data query result after the date sorting is obtained to obtain a first partial data query result, that is, 5 pieces of data sorted by date.
In the second case, for a data query result obtained by performing a data query using a specified data query rule, if there is a case that a partial data query result does not have uniqueness, the specified data query rule is, for example, sorted by date, and for 5 pieces of data sorted by date, if the dates of the 5 pieces of data are the same, it indicates that the order of the 5 pieces of data is not fixed, and the 5 pieces of data have uniqueness, that is, there is no partial data query result in the data query result obtained by performing a data query using date sorting.
In both cases, the data query result obtained by performing data query by using the specified data query rule has no uniqueness, and the data is further processed, so that the stability of the data query result is ensured.
203a, if the data query result obtained by using the specified data query rule to perform data query does not have uniqueness, using a preset data query rule to perform data query.
For the first case in step 202, that is, the data query result obtained by performing the data query using the specified data query rule has uniqueness of partial data query result, the specified data query rule is first used to perform the query of partial data with uniqueness of the partial data query result to obtain the first partial data query result, then the preset data query rule is used to query data of a part other than the uniqueness of the partial data query result to obtain the second partial data query result, and finally the first partial data query result and the second partial data query result are merged, and the merged data query result is used as the data query result obtained by performing the data query using the preset data query rule.
Illustratively, the data query rule is specified as being sorted according to date, and for 5 pieces of data sorted according to the date sequence, if the dates of the first 2 pieces of data are the same, the last 3 pieces of data are obtained, the data query result sorted according to date is firstly obtained to obtain a first part of data query result, namely 5 pieces of data sorted according to date, the data query rule is preset to be according to the name sequence of data media, then the first 2 pieces of data and the last 3 pieces of data are sorted according to the name sequence of data media to obtain a second part of data query result, and finally the first part of data query result and the second part of data query result are combined to obtain a final data query result of the 5 pieces of data.
For the second case in step 202, that is, the data query result obtained by performing data query using the specified data query rule does not have uniqueness of partial data query result, the data query is performed directly using the preset data query rule.
Illustratively, the data query rule is specified as being sorted according to date, and for 5 pieces of data sorted according to the date sequence, if the dates of the 5 pieces of data are the same, it is indicated that the sequence of the 5 pieces of data is not fixed, and the preset data query rule is directly adopted for data query.
It should be noted that, if the preset data query rule for the data is 1 data query condition, it cannot be guaranteed that the data query result has uniqueness, several data query conditions may be set, and it is further guaranteed that the data query result returned to the front end has uniqueness.
The method for determining how to determine the uniqueness of the data query result has been described in detail in step 102 in the previous embodiment, and details are not repeated in this step.
Correspondingly, in step 203b corresponding to step 203a, if the data query result obtained by performing data query by using the specified data query rule has uniqueness, performing data query by using the specified data query rule to obtain a data query result.
For the embodiment of the invention, if the data query result obtained by using the specified data query rule to perform data query has uniqueness, the data stability of the data query result is relatively strong, and the stability of data display at the front end can be ensured without processing the data again.
204a, sending a data query result obtained by performing data query by adopting the preset data query rule.
The data query result obtained by querying the data by adopting the preset data query rule has uniqueness, and the stability of the data displayed at the front end can be ensured, so that the applicability of data in the actual development process of research personnel is strong, and the data operation experience is improved.
Correspondingly, step 204b, corresponding to step 204a, sends the data query result obtained by performing data query by using the specified data query rule.
The data query result obtained by using the specified data query rule to perform data query has uniqueness, and the stability of data display at the front end can be ensured, so that the applicability of data in the actual development process of research personnel is strong, and the data operation experience is improved.
For the embodiment of the present invention, specific application scenarios may be as follows, but are not limited to the following scenarios, including: the current scenario is a data query request for page data display by requesting 10 data from the front end to the back end, the access volumes of the first 5 data are all 80, the access volumes of the last five data are all 100, and the data query request carries rules indicating at least more orders according to the access volumes of the data, because the data query results obtained by sorting the access volumes of the data do not have uniqueness, a first data query result is obtained by sorting the access volumes of the data according to at least more rules, a preset data query rule is set to be sorted according to the orders of the exposure amount, the data source name and the data date of the data, then the data query is performed according to at least more rules according to the exposure amount of the data, a second data query result is obtained, it needs to be noted that if the second part of data query results still do not have uniqueness, the data query is performed according to the rules of the data source name, and obtaining a third data query result, and in the same way, until the data query result obtained by performing data query by adopting the preset data query rule has uniqueness, and finally sending the data query result obtained by performing data query by adopting the preset data query rule to the front end for display.
In another data query method provided in the embodiments of the present invention, if it is determined that a data query result obtained by querying data using an appointed data query rule has uniqueness, the data has high stability, and the data query result can be directly sent to a front end for display, if it is determined that the data query result obtained by querying data using the appointed data query rule does not have uniqueness, the data stability is poor, it is necessary to query partial data having uniqueness in the data query result using the appointed data query rule first to obtain a first partial data query result having good stability, and then query data of a portion other than the uniqueness in the data query result using a preset data query rule to obtain a second partial data query result, and then, the data without uniqueness is guaranteed to have uniqueness after passing through a preset data query rule, the first part of data query results and the second part of data query results are combined, the combined data query results are used as data query results obtained by data query according to the preset data query rule, and then the data are divided, so that the stability of the data sent to the front end is guaranteed more efficiently.
Further, as a specific implementation of the method shown in fig. 1, an embodiment of the present invention provides a data query apparatus, where the apparatus embodiment corresponds to the foregoing method embodiment, and for convenience of reading, details in the foregoing method embodiment are not described in detail by the apparatus, but it should be clear that the apparatus in this embodiment can correspondingly implement all the contents in the foregoing method embodiment, as shown in fig. 3, the apparatus includes:
the receiving unit 31 may be configured to receive a data query request, where the data query request carries a specified data query rule, and the specified data query rule is used to indicate how to perform data query, where the receiving unit 31 is a main function module in the apparatus that receives the data query request, and may specifically implement a receiving function through an interaction interface between a back end and a front end;
the first judging unit 32 may be configured to judge whether a data query result obtained by performing data query using the specified data query rule has uniqueness, where the first judging unit 32 is a main functional module in the apparatus that judges whether a data query result obtained by performing data query according to the specified data query rule received by the receiving unit 31 has uniqueness, and specifically may judge whether a data query result has uniqueness by judging whether any two historical data query results are consistent;
the first query unit 33 may be configured to perform data query by using a preset data query rule if a data query result obtained by performing data query by using the specified data query rule does not have uniqueness, and the data query result obtained by performing data query according to the preset data query rule has uniqueness;
the first sending unit 34 may be configured to send a data query result obtained by querying data according to the preset data query rule, where the first sending unit 34 is a main function module in the apparatus for sending the data query result, and may specifically implement a sending function through an interactive interface between the back end and the front end.
The data query device provided by the embodiment of the invention determines the stability of data requested by a front end to a back end by judging whether a data query result obtained by querying data by adopting an appointed data query rule has uniqueness, if the data query result does not have uniqueness, the current data stability is poor, further queries data by adopting a preset data query rule, and ensures the stability of the data query result received by the front end as the data query result obtained by querying data according to the preset data query rule has uniqueness. Compared with the data query method in the prior art, the data query method and the device have the advantages that the data query is carried out by adopting the preset data query rule, so that the returned data sequence is consistent each time when the front end receives the data query result returned by the back end, the display effect of the data at the front end is ensured, and the stability of the data query is improved.
Further, as shown in fig. 4, an embodiment of the present invention provides another data querying apparatus, where the apparatus includes:
a receiving unit 41, configured to receive a data query request, where the data query request carries a specified data query rule, and the specified data query rule is used to indicate how to perform data query;
a first judging unit 42, configured to judge whether a data query result obtained by performing data query using the specified data query rule has uniqueness;
a second determining unit 43, configured to determine whether a data query result obtained by performing data query according to the specified data query rule has uniqueness in part of the data query results;
a third query unit 44, configured to query, using the specified data query rule, partial data of which the partial data query result is unique, if there is uniqueness of the partial data query result in the data query result obtained by using the specified data query rule, so as to obtain a first partial data query result;
the fourth querying unit 45 may be configured to query, by using a preset data querying rule, data of a part of the data querying result, which is not unique, to obtain a second part of the data querying result;
a merging unit 46, configured to merge the first partial data query result and the second partial data query result, and use the merged data query result as a data query result obtained by performing data query according to the preset data query rule;
the first sending unit 47 may be configured to send a data query result obtained by querying data according to the preset data query rule
The second query unit 48 may be configured to, after determining that a data query result obtained by performing data query using the specified data query rule has uniqueness, perform data query using the specified data query rule to obtain a data query result;
the second sending unit 49 may be configured to send a data query result obtained by performing data query according to the specified data query rule.
Further, the first judgment unit 42 includes:
the obtaining module 421 may be configured to obtain a historical data query result obtained by performing data query using the specified data query rule historically;
the first judging module 422 may be configured to judge whether any two historical data query results are the same;
the second determining module 423 may be configured to determine that a data query result obtained by performing data query according to the specified data query rule is unique if any two historical data query results are the same;
the second determining module 423 may be further configured to determine that the data query result obtained by performing data query according to the specified data query rule is not unique if any two historical data query results are different.
In another data query device provided in the embodiment of the present invention, if it is determined that the data query result obtained by performing data query using the specified data query rule has uniqueness, the data has high stability, and the data query result can be directly sent to the front end for display, and if it is determined that the data query result obtained by performing data query using the specified data query rule does not have uniqueness, the data stability is poor, it is necessary to first perform query on the part of data having uniqueness in the part of data query result using the specified data query rule to obtain a first part of data query result having good stability, and then query the data of the part of data query result other than the uniqueness using the preset data query rule to obtain a second part of data query result, and then, the data without uniqueness is guaranteed to have uniqueness after passing through a preset data query rule, the first part of data query results and the second part of data query results are combined, the combined data query results are used as data query results obtained by data query according to the preset data query rule, and then the data are divided, so that the stability of the data sent to the front end is guaranteed more efficiently.
The server includes a processor and a memory, the receiving unit 31, the first judging unit 32, the first querying unit 33, the first sending unit 34, and the like are all stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, labor is saved by adjusting kernel parameters, and the stability of data display at the front end is improved.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
The present application further provides a computer program product adapted to perform program code for initializing the following method steps when executed on a data processing device: receiving a data query request, wherein the data query request carries a specified data query rule, the specified data query rule is used for indicating how to perform data query, judging whether a data query result obtained by performing data query by using the specified data query rule has uniqueness or not, if not, performing data query by using a preset data query rule, obtaining the data query result obtained by performing data query according to the preset data query rule and sending the data query result obtained by performing data query by using the preset data query rule.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A method for querying data, comprising:
receiving a data query request, wherein the data query request carries a specified data query rule, and the specified data query rule is used for indicating how to perform data query;
judging whether the data query result obtained by querying the data by adopting the specified data query rule has uniqueness or not, wherein the judging step comprises the following steps: obtaining historical data query results obtained by historically adopting the specified data query rule to perform data query; judging whether the historical data query results of any two times are the same; if so, judging that the data query result obtained by querying the data by adopting the specified data query rule has uniqueness; otherwise, judging that the data query result obtained by querying the data by adopting the specified data query rule does not have uniqueness;
if not, a preset data query rule is adopted for data query, and a data query result obtained by performing data query according to the preset data query rule has uniqueness;
and sending a data query result obtained by querying data by adopting the preset data query rule.
2. The method of claim 1, wherein if the data query result obtained by querying the data using the specified data query rule is determined to be unique, the method further comprises:
adopting the specified data query rule to perform data query to obtain a data query result;
and sending a data query result obtained by querying data by adopting the specified data query rule.
3. The method according to claim 1 or 2, wherein after determining that the data query result obtained by performing the data query using the specified data query rule has no uniqueness, the method further comprises:
judging whether a part of data query results obtained by querying data by adopting the specified data query rule have uniqueness or not;
if so, the specified data query rule is adopted to query the part data with uniqueness in the part data query result to obtain a first part data query result;
the data query by adopting the preset data query rule comprises the following steps:
and querying data except the uniqueness of the partial data query result by adopting a preset data query rule to obtain a second partial data query result.
4. The method of claim 3, wherein before sending the data query result obtained by querying data according to the preset data query rule, the method further comprises:
and combining the first part of data query results and the second part of data query results, and taking the combined data query results as data query results obtained by querying data by adopting the preset data query rule.
5. An apparatus for querying data, comprising:
the device comprises a receiving unit, a sending unit and a receiving unit, wherein the receiving unit is used for receiving a data query request, the data query request carries a specified data query rule, and the specified data query rule is used for indicating how to perform data query;
the first judgment unit is used for judging whether a data query result obtained by querying data by adopting the specified data query rule has uniqueness;
the first judgment unit includes:
the acquisition module is used for acquiring historical data query results obtained by historically adopting the specified data query rule to perform data query;
the first judgment module is used for judging whether the historical data query results of any two times are the same;
the second judgment module is used for judging that the data query result obtained by adopting the specified data query rule to perform data query has uniqueness if the historical data query results of any two times are the same;
the second judging module is further configured to judge that a data query result obtained by performing data query by using the specified data query rule does not have uniqueness if any two historical data query results are different;
the first query unit is used for querying data by adopting a preset data query rule if a data query result obtained by querying the data by adopting the specified data query rule does not have uniqueness, and the data query result obtained by querying the data according to the preset data query rule has uniqueness;
and the first sending unit is used for sending a data query result obtained by querying data by adopting the preset data query rule.
6. The apparatus of claim 5, further comprising:
the second query unit is used for performing data query by adopting the specified data query rule to obtain a data query result after judging that the data query result obtained by performing data query by adopting the specified data query rule has uniqueness;
and the second sending unit is used for sending a data query result obtained by querying data by adopting the specified data query rule.
7. The apparatus of claim 5 or 6, further comprising:
the second judging unit is used for judging whether a part of data query results obtained by data query according to the specified data query rule have uniqueness or not after judging that the data query results obtained by data query according to the specified data query rule do not have uniqueness;
a third query unit, configured to query, if there is uniqueness in a partial data query result obtained by performing data query using the specified data query rule, partial data having uniqueness in the partial data query result using the specified data query rule, so as to obtain a first partial data query result;
and the fourth query unit is used for querying the data of the part of the data query result except the uniqueness by adopting a preset data query rule to obtain a second part of the data query result.
8. The apparatus of claim 7, further comprising:
and the merging unit is used for merging the first part of data query results and the second part of data query results, and taking the merged data query results as data query results obtained by querying data by adopting the preset data query rule.
9. A storage medium, characterized in that the storage medium comprises a stored program, wherein when the program runs, a device where the storage medium is located is controlled to execute the data query method of any one of claims 1 to 4.
10. A processor, configured to execute a program, wherein the program executes a method for querying data according to any one of claims 1 to 4.
CN201611079374.2A 2016-11-29 2016-11-29 Data query method and device Active CN108121733B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611079374.2A CN108121733B (en) 2016-11-29 2016-11-29 Data query method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611079374.2A CN108121733B (en) 2016-11-29 2016-11-29 Data query method and device

Publications (2)

Publication Number Publication Date
CN108121733A CN108121733A (en) 2018-06-05
CN108121733B true CN108121733B (en) 2021-10-15

Family

ID=62227058

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611079374.2A Active CN108121733B (en) 2016-11-29 2016-11-29 Data query method and device

Country Status (1)

Country Link
CN (1) CN108121733B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109684361B (en) * 2018-12-14 2020-10-16 武汉达梦数据库有限公司 Rule analysis method and corresponding rule analysis device
CN110390036B (en) * 2019-06-03 2020-04-10 惠安源和机械有限公司 Double-index data query platform

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101984439A (en) * 2010-12-09 2011-03-09 上海市共进通信技术有限公司 Method for realizing optimization of data source extensive makeup language (XML) query system based on sub-queries
CN105335402A (en) * 2014-07-23 2016-02-17 阿里巴巴集团控股有限公司 Search method, index data generation method and device on the basis of static Cache
EP2591438B1 (en) * 2010-07-06 2016-11-23 Ipsiti, Inc. Systems and methods for establishing trust between entities in support of transactions

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8200775B2 (en) * 2005-02-01 2012-06-12 Newsilike Media Group, Inc Enhanced syndication
CN104657387B (en) * 2013-11-22 2019-02-05 华为技术有限公司 A kind of data query method and device
CN104239508B (en) * 2014-09-12 2017-05-10 中国工商银行股份有限公司 Data query method and data query device
CN104268272A (en) * 2014-10-14 2015-01-07 青岛海尔软件有限公司 Method and device for checking uniqueness of data
US10229156B2 (en) * 2014-11-03 2019-03-12 International Business Machines Corporation Using priority scores for iterative precision reduction in structured lookups for questions

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2591438B1 (en) * 2010-07-06 2016-11-23 Ipsiti, Inc. Systems and methods for establishing trust between entities in support of transactions
CN101984439A (en) * 2010-12-09 2011-03-09 上海市共进通信技术有限公司 Method for realizing optimization of data source extensive makeup language (XML) query system based on sub-queries
CN105335402A (en) * 2014-07-23 2016-02-17 阿里巴巴集团控股有限公司 Search method, index data generation method and device on the basis of static Cache

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"XML关键字查询处理研究";周军锋;《计算机学报》;20121231;第35卷(第12期);第2459-2478页 *

Also Published As

Publication number Publication date
CN108121733A (en) 2018-06-05

Similar Documents

Publication Publication Date Title
CN106528787B (en) query method and device based on multidimensional analysis of mass data
CN106649828B (en) Data query method and system
CN111241122A (en) Task monitoring method and device, electronic equipment and readable storage medium
CN106326309A (en) Data query method and device
CN106682167B (en) Statistical device and method for user behavior data
CN108228443B (en) Web application testing method and device
CN106648839B (en) Data processing method and device
CN113112208A (en) Electric power material storage management method based on three-dimensional visualization model
CN108121733B (en) Data query method and device
CN114297204A (en) Data storage and retrieval method and device for heterogeneous data source
CN110825764B (en) SQL script generation method, system, storage medium and processor
CN108241620B (en) Query script generation method and device
CN109388644B (en) Data updating method and device
CN109977317B (en) Data query method and device
CN110019357B (en) Database query script generation method and device
CN106649374B (en) Navigation tag sequencing method and device
CN106156185B (en) Method, device and system for inquiring service request execution state
CN113849524B (en) Data processing method and device
CN108241622B (en) Query script generation method and device
CN111125157A (en) Query data processing method and device, storage medium and processor
CN107451142B (en) Method and apparatus for writing and querying data in database, management system and computer-readable storage medium thereof
CN111125087A (en) Data storage method and device
CN108062329B (en) Data import method and device
CN114064657A (en) Multi-table integration method, device, equipment and storage medium
CN109299125B (en) Database updating method and device

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 100083 No. 401, 4th Floor, Haitai Building, 229 North Fourth Ring Road, Haidian District, Beijing

Applicant after: Beijing Guoshuang Technology Co.,Ltd.

Address before: 100086 Cuigong Hotel, 76 Zhichun Road, Shuangyushu District, Haidian District, Beijing

Applicant before: Beijing Guoshuang Technology Co.,Ltd.

GR01 Patent grant
GR01 Patent grant