CN109063170B - Intelligent query method, device, terminal and computer readable storage medium - Google Patents

Intelligent query method, device, terminal and computer readable storage medium Download PDF

Info

Publication number
CN109063170B
CN109063170B CN201810939821.XA CN201810939821A CN109063170B CN 109063170 B CN109063170 B CN 109063170B CN 201810939821 A CN201810939821 A CN 201810939821A CN 109063170 B CN109063170 B CN 109063170B
Authority
CN
China
Prior art keywords
query
relation
path
target
relation table
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
CN201810939821.XA
Other languages
Chinese (zh)
Other versions
CN109063170A (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 Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201810939821.XA priority Critical patent/CN109063170B/en
Publication of CN109063170A publication Critical patent/CN109063170A/en
Application granted granted Critical
Publication of CN109063170B publication Critical patent/CN109063170B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides an intelligent query method, an intelligent query device, a terminal and a computer readable storage medium, wherein the method comprises the following steps: receiving a query instruction from a client, wherein the query instruction comprises a primary key of a starting relation table and at least one attribute of an ending relation table; determining a target query plan corresponding to the attribute of each termination relation table from pre-generated query plans according to a query instruction, wherein the target query plan comprises at least one query path from a main key of the initiation relation table to the attribute of one termination relation table; selecting a target query path from all query paths included in the target query plan; inquiring attribute corresponding data of the termination relation table according to the target inquiry path; and sending the inquired data to the client. Because the query plan among the relation tables is generated in advance, the target query plan and the target query path can be quickly and accurately found according to the query instruction, and the throughput and the query speed of intelligent query are improved.

Description

Intelligent query method, device, terminal and computer readable storage medium
Technical Field
The present invention relates to the field of intelligent query technologies, and in particular, to an intelligent query method, an intelligent query device, a terminal, and a computer-readable storage medium.
Background
The existing multidimensional relation query modes mainly include two types, one type is to store various attributes in a plurality of relation tables of a relation database and store the relation in a foreign key form, and the method is called a normalized storage scheme. The other is to select a primary relationship for a specific type of query, and to make the attribute in the other relationships that the query needs to access redundant in the primary relationship, which is called a denormalization storage scheme.
Among them, the normalized storage scheme has the following problems: the first problem is that: under the high-throughput scene of the client, if the synchronous blocking type sequential execution multi-round query is carried out, the cost of thread switching is very high, and if the asynchronous callback mode sequentially executes the multi-round query, the logic of screening the previous round result and initiating the next round query is dispersed into four callbacks, so that the development and maintenance cost is high. The second problem is that: the client must know the best query method for querying each relation table. When the optimal access mode is changed due to topology change or the change of the damping coefficient of the adjacent sides on the topology, all the clients need to be upgraded. The third problem is that: when a certain relation table is restricted, the previous rounds of queries of the client can be successful, but the queries of the relation table fail in a certain proportion, which means that the queries of the relation table accessed in the previous rounds are wasted in a certain proportion. Wasted queries only exacerbate the problem when the entire system begins to limit current when it encounters a bottleneck. The problem with the denormalized storage scheme is that a large amount of storage space is wasted for dynamic data sets to store redundant data.
The above information disclosed in the background section is only for enhancement of understanding of the background of the invention and therefore it may contain information that does not form the prior art that is known to a person of ordinary skill in the art.
Disclosure of Invention
Embodiments of the present invention provide an intelligent query method, an intelligent query device, a terminal, and a computer-readable storage medium, so as to solve one or more technical problems in the prior art.
In a first aspect, an embodiment of the present invention provides an intelligent query method, including:
receiving a query instruction from a client, wherein the query instruction comprises a primary key of a starting relation table and at least one attribute of a terminating relation table;
according to the query instruction, determining a target query plan corresponding to the attribute of each termination relation table from the pre-generated query plans, wherein the target query plan comprises at least one query path from the main key of the start relation table to the attribute of one termination relation table;
selecting a target query path from the query paths included in the target query plan;
according to the target query path, querying to obtain data corresponding to the attribute of the termination relation table;
and sending the inquired data to the client.
With reference to the first aspect, in a first implementation manner of the first aspect, an embodiment of the present invention further includes:
presetting the weight between any two relation tables in the topological relation network;
and generating a query plan starting from any relation table and corresponding to one or more relation tables according to the weight among the relation tables.
With reference to the first aspect, in a second implementation manner of the first aspect, the selecting a target query path from query paths included in the target query plan includes:
and selecting the target query path according to the weight and/or query flow limit of each query path included in the target query plan.
With reference to the second implementation manner of the first aspect, in a third implementation manner of the first aspect, the selecting a target query path according to the weight and/or the query flow limit of each query path included in the target query plan includes:
acquiring the weight sum corresponding to each query path included in the target query plan, wherein the weight sum of each query path includes the weight sum of each relation table through which the query path passes;
and selecting the query path with the minimum weight as a target query path.
With reference to the third implementation manner of the first aspect, in a fourth implementation manner of the first aspect, an embodiment of the present invention selects a target query path according to a weight and/or a query flow limit of each query path included in the target query plan, and further includes:
checking whether query current limiting exists in each relation table passed by each query path included in the target query plan;
and selecting a query path composed of the relation tables without query flow limitation as a target query path.
With reference to the fourth implementation manner of the first aspect, in a fifth implementation manner of the first aspect, the selecting, as the target query path, one of the query paths without query throttling in each relationship table includes:
and selecting the query path with the minimum weight as a target query path from a plurality of query paths consisting of the relation tables without query flow limitation.
With reference to the fifth implementation manner of the first aspect, in a sixth implementation manner of the first aspect, the embodiment of the present invention further includes:
and if the target query plan only comprises one query path and the query path has a query current-limiting relation table, executing the query instruction in a lagging mode.
In a second aspect, an embodiment of the present invention provides an apparatus for intelligent query, including:
the system comprises a receiving module, a judging module and a judging module, wherein the receiving module is used for receiving a query instruction from a client, and the query instruction comprises a main key of a starting relation table and attributes of at least one ending relation table;
a determining module, configured to determine, according to the query instruction, a target query plan corresponding to the attribute of each termination relationship table from among pre-generated query plans, where the target query plan includes at least one query path from a primary key of the initiation relationship table to an attribute of one termination relationship table;
the selection module is used for selecting a target query path from all query paths included in the target query plan;
the query module is used for querying and obtaining data corresponding to the attribute of the termination relation table according to the target query path;
and the sending module is used for sending the inquired data to the client.
In one possible design, the method further comprises:
the preset module is used for presetting the weight between any two relation tables in the topological relation network; and generating a query plan starting from any relation table and corresponding to one or more relation tables according to the weight among the relation tables.
In one possible design, the selection module includes:
and the selection sub-module is used for selecting the target query path according to the weight and/or the query flow limit of each query path included in the target query plan.
In a third aspect, an embodiment of the present invention provides an intelligent query terminal, including:
the functions of the terminal can be realized by hardware, and can also be realized by executing corresponding software by hardware. The hardware or software includes one or more modules corresponding to the above-described functions.
In one possible design, the terminal for intelligent query structurally includes a processor and a memory, the memory is used for storing a program for the terminal supporting intelligent query to execute the method for intelligent query in the first aspect, and the processor is configured to execute the program stored in the memory. The terminal for intelligent query may further include a communication interface for the terminal for intelligent query to communicate with other devices or a communication network.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium for storing computer software instructions for a terminal for intelligent query, which includes a program for executing the method for intelligent query in the first aspect, to the terminal for intelligent query.
One of the above technical solutions has the following advantages or beneficial effects: because the query plan among the relation tables is generated in advance, the target query plan and the target query path can be quickly and accurately found according to the query instruction, and the throughput and the query speed of intelligent query are improved.
The foregoing summary is provided for the purpose of description only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments, and features described above, further aspects, embodiments, and features of the present invention will be readily apparent by reference to the drawings and following detailed description.
Drawings
In the drawings, like reference numerals refer to the same or similar parts or elements throughout the several views unless otherwise specified. The figures are not necessarily to scale. It is appreciated that these drawings depict only some embodiments in accordance with the disclosure and are therefore not to be considered limiting of its scope.
Fig. 1 is a flowchart of an intelligent query method according to an embodiment of the present invention.
Fig. 2 is a schematic application diagram of the intelligent query method according to the embodiment of the present invention.
Fig. 3 is a flowchart of an intelligent query method according to another embodiment of the present invention.
Fig. 4 is a schematic diagram of a topological relation network according to an embodiment of the present invention.
Fig. 5 is a schematic diagram of an intelligent query device according to an embodiment of the present invention.
Fig. 6 is a schematic diagram of an intelligent query device according to another embodiment of the invention.
Fig. 7 is a schematic diagram of a selection submodule according to an embodiment of the present invention.
Fig. 8 is a schematic diagram of an intelligent query terminal according to an embodiment of the present invention.
Detailed Description
In the following, only certain exemplary embodiments are briefly described. As those skilled in the art will recognize, the described embodiments may be modified in various different ways, all without departing from the spirit or scope of the present invention. Accordingly, the drawings and description are to be regarded as illustrative in nature, and not as restrictive.
The embodiment of the invention provides an intelligent query method, as shown in fig. 1, comprising the following steps:
s100: and receiving a query instruction from the client, wherein the query instruction comprises a primary key of the starting relation table and at least one attribute of the terminating relation table. The client can simultaneously specify the attributes of a plurality of termination relation tables, namely, a plurality of associated attributes can be searched simultaneously according to one main key, and the query efficiency is effectively improved. It should be noted that the start relation table and the end relation table are relative concepts, and are both arbitrary in nature. The initial relation table can also be used as a termination relation table according to different query instructions. The termination relationship table may also serve as the start relationship table.
S200: and according to the query instruction, determining a target query plan corresponding to the attribute of each termination relation table from the pre-generated query plans, wherein the target query plan comprises at least one query path from the main key of the start relation table to the attribute of one termination relation table. One or more associated relationship tables may be included in the query path, i.e., the starting relationship table is queried to the terminating relationship table after passing through the one or more associated relationship tables.
S300: a target query path is selected from the query paths included in the target query plan.
S400: and querying to obtain data corresponding to the attribute of the termination relation table according to the target query path.
S500: and sending the inquired data to the client.
In one example, as shown in fig. 2, the above steps may be performed by the server 20. Each relationship table 30 may be stored in a relationship database or in the server 20, and each relationship table 30 may be stored in a different storage medium of the server 20. For example, each relationship table 30 is a web content relationship table, a picture text relationship table, a picture content relationship table, and a similar picture group relationship table. The web page content relationship table, the picture text relationship table, and the picture content relationship table are stored in an SATA (Serial Advanced Technology Attachment) hard disk. The similar picture group relation table is stored in SSD (Solid State Drives). The client 10 may be responsible only for sending the query instruction input by the user and receiving the query result, and the specific query process is executed by the query engine 21 of the server 20.
The client does not need to know the foreign key relation of each relation table any more, and development cost of the client is effectively saved. And the multi-round query process among the relation tables which is performed by the client in person in the prior art is simplified into one round of query process (namely the query process of sending the query instruction and receiving the query result), and the throughput of the client is improved.
In one embodiment, as shown in fig. 3, the method further comprises:
s600: the weight (weight) between any two relation tables in the topological relation network is preset. The topological relation network comprises a plurality of relation tables.
S700: and generating a query plan starting from any relation table and corresponding to one or more relation tables according to the weight among the relation tables.
If the two relation tables have the relation, the query plan from one relation table to the other relation table in the two relation tables comprises at least one inter-table query path. When multiple inter-table query paths are included, each inter-table query path may include one or more common relationship tables. The common relation table is used as a node, so that the query path among the tables can complete association and query through the relation tables with different dimensions after the node.
It should be noted that the weight between the two relation tables can also be understood as the damping coefficient between the two relation tables. The value of the weight or the damping coefficient can be obtained by comprehensive calculation according to a plurality of indexes of the access performance of the two relational tables, the capacity of the relational tables, the network delay and the like.
Because the query plans among the relation tables are generated in advance, and the query granularity is increased, the target query plan can be quickly found according to the query instruction, and the throughput of the client and the query speed of the server are improved.
In one embodiment, selecting a target query path from the query paths included in the target query plan specifically includes:
and selecting the target query path according to the weight and/or the query flow limit of each query path included by the target query plan.
In one embodiment, selecting the target query path according to the weight and/or the query flow limit of each query path included in the target query plan includes:
and acquiring the weight sum corresponding to each query path included by the target query plan, wherein the weight sum of each query path includes the weight sum of each relation table passed by the query path.
And selecting the query path with the minimum weight as a target query path.
In a specific embodiment, selecting a target query path according to a weight and/or a query flow limit of each query path included in the target query plan further includes:
and checking whether query current limitation exists in relation tables passed by query paths included in the target query plan.
And selecting a query path composed of the relation tables without query flow limitation as a target query path.
It should be noted that, if any relation table on all query paths has query current limit, a query path with smaller query current limit is selected.
Because the flow control logic queries the flow limit condition on each query path before executing the query, when the flow limit exists, the whole query path containing the flow limit relation table cannot be executed or selected. Therefore, the condition that the query cannot be continuously executed when the relation table of the limited flow is queried can be avoided, and the query process of the relation table before is not wasted, so that invalid sub-queries in the limited flow state are avoided, and the reliability of the whole query is improved.
In a preferred embodiment, selecting the target query path according to the weight and/or query flow limit of each query path included in the target query plan further includes:
and selecting the query path with the minimum weight as a target query path from a plurality of query paths consisting of the relation tables without query flow limitation.
In one application example, as shown in fig. 4, the topological relation network includes a web content relation table (doc), a picture text relation table (img), a picture content relation table (content), and a similar picture group relation table (simid). The weight from the web content relation table to the picture text relation table is 6, and the weight from the picture text relation table to the web content relation table is 12. The weight from the picture text relation table to the similar picture group relation table is 2. The weight from the picture text relation table to the picture content relation table is 1, and the weight from the picture content relation table to the picture text relation table is 8. The weight from the picture content relation table to the similar picture group relation table is 10.
When the query instruction of the client includes the primary key of the web content relationship table and the attribute of the similar picture group relationship table, as shown in fig. 4, two query paths for implementing the query instruction are included. The query path A is to start the query from the webpage content relation table, and query the similar picture group relation table after passing through the picture text relation table and the picture content relation table. And the query path B is to start the query from the webpage content relation table and query a similar picture group relation table through the picture text relation table. Wherein the sum of the weights of query path a is 17 and the sum of the weights of query path B is 8, so the sum of the weights of query path B is selected as the target query path.
It should be noted that the path drawn by the thickest arrow is query path a, and the path drawn by the second thickest arrow is query path B. The query path A and the query path B are overlapped in a query path section from the webpage content relation table to the picture text relation table. In order to more clearly embody the query path, each relationship table is repeatedly drawn to illustrate that the same relationship table can also have different query paths at the same time. For example, when the query instruction includes the main key of the picture content relationship table and the attribute of the web content relationship table, the query is performed through a query path C, i.e., a path drawn by a thinnest arrow.
In one embodiment, if only one query path is included in the target query plan and the query path has a query current-limited relationship table, the query instruction is executed late. The delayed execution of the query command may be understood as the query command being executed after the query current limit is over. It can also be understood that the query command is executed after the current limiting force of the query current limit is weakened.
In one embodiment, because the query plan is generated in advance, the throughput of the client is improved, and the query instruction sent by the client may include one or more primary keys of the start relation table to be queried and one or more attributes of the end relation table.
For example, the topological relation network includes four relation tables of web page content, picture text, picture content and similar picture group. The query instruction of the client may include a primary key of the web content relation table (e.g., a web url), and an attribute in the picture text relation table, an attribute in the picture content relation table, and an attribute in the similar picture group relation table, which are to be queried, respectively. The server can simultaneously search different attributes in the relation tables (the picture text relation table, the picture content relation table and the similar picture group relation table) of the three dimensions through one main key of the webpage content relation table, and the query efficiency is improved. The three corresponding target query paths may include the same query path segment and the common relationship table.
In one embodiment, when query is performed, in each relationship table on the target query path between the start relationship table and the end relationship table, the filtering logic filters the sub-query results in each relationship table, and the filtered results obtain the sub-query results in the next relationship table associated with the sub-query results. Wherein the filtering logic is defined by a user of the client. Because the operation of the screening and filtering logic is executed by the server side instead of the client side, the client side can not process excessive invalid results, only the results processed by the screening and filtering logic and the final attribute data need to be received, and the bandwidth occupation between the server side and the client side is saved. And when the network delay between the server and the client is high, the client can also obtain the optimization of corresponding time. On the other hand, since the filtering logic is executed by the server, the filtering logic is also written according to the query language of the server, and the server can avoid the client abusing the capability of the server by controlling the syntax of the query language.
In one embodiment, the server associates the primary key of the initial relationship table of the target query plan with the query result (the data of the attribute queried from the termination relationship table according to the primary key), and stores the data in the server. When the server receives the query instruction again, the query result can be directly called and sent to the client according to the main key, the attribute and the like in the query instruction. For the client requests of burst and hot spots, as the server caches the results of the whole target query plan granularity, the memory occupation of the server cache is saved, and the time efficiency and the space efficiency of the server cache are higher.
In one embodiment, the primary key of the target query plan and the query results are stored as key-value pairs.
In one embodiment, when the weight between any two relation tables in the preset topological relation network changes, only the query plan corresponding to any two relation tables needs to be updated through the server, and the client does not need to update synchronously. The client can enjoy the optimal corresponding time brought by the optimized query path in real time.
In an application example, first, damping coefficients of adjacent edges between relation tables on a complex topology are configured in advance, and a query plan from any relation to another relation is generated. The client only needs to specify which attributes of which relations need to be queried from the primary key of which relation, and multiple rounds of queries become one query for the client. Secondly, the server side checks whether current limiting needs to be executed or not before executing query, if the query current limiting exists in the relation table, the query path of the whole query plan is limited in current and lags the query, and sub-queries of each relation table in the query process are prevented from being wasted. When there are multiple query paths from any one relationship to another, in the case of throttling, the query may be performed instead for the other paths. In addition, the server-side cache not only comprises the cache of each relation table, but also can cache the main key and the query result of the whole target query plan, and for client-side requests of burst and hot spots, the time efficiency and the space efficiency of the cache are higher.
The method of the embodiment of the invention solves the problem of query synchronization blocking possibly caused on a query path in the query of the prior art and also solves the problem of repeated data storage caused by knowing a normalization scheme.
An embodiment of the present invention provides an apparatus for intelligent query, as shown in fig. 5, including:
the receiving module 51 is configured to receive a query instruction from a client, where the query instruction includes a primary key of a start relation table and an attribute of at least one end relation table.
The determining module 52 is configured to determine, according to the query instruction, a target query plan corresponding to the attribute of each termination relationship table from the pre-generated query plans, where the target query plan includes at least one query path from the primary key of the start relationship table to the attribute of one termination relationship table.
And a selecting module 53, configured to select a target query path from the query paths included in the target query plan.
And the query module 54 is configured to query the data corresponding to the attribute of the termination relation table according to the target query path.
And a sending module 55, configured to send the queried data to the client.
In one embodiment, as shown in fig. 6, the apparatus for intelligently querying further includes:
a presetting module 56, configured to preset a weight between any two relation tables in the topological relation network; and generating a query plan starting from any relation table and corresponding to one or more relation tables according to the weight among the relation tables.
In one embodiment, the selection module 53 includes:
and the selection sub-module 531 is configured to select a target query path according to the weight and/or the query flow limit of each query path included in the target query plan.
In one embodiment, as shown in fig. 7, the selection submodule 531 includes:
the weight sub-module 5311 is configured to obtain a weight sum corresponding to each query path included in the target query plan, where the weight sum of each query path includes a weight sum of relationship tables through which the query path passes. And selecting the query path with the minimum weight as a target query path.
The current limiting sub-module 5312 is configured to check whether there is a query current limit in each relationship table through which each query path included in the target query plan passes. And selecting the query path without query flow limitation in each relation table as a target query path.
And the synthesis sub-module 5313 is configured to select a query path with the smallest weight and no query flow limitation for each relationship table as the target query path.
The functions of each module in each apparatus in the embodiments of the present invention may refer to the corresponding description in the above method, and are not described herein again.
An embodiment of the present invention provides an intelligent query terminal, as shown in fig. 8, including:
a memory 910 and a processor 920, the memory 910 having stored therein computer programs operable on the processor 920. The processor 920 implements the method of intelligent querying in the above-described embodiments when executing the computer program. The number of the memory 910 and the processor 920 may be one or more.
A communication interface 930 for the memory 910 and the processor 920 to communicate with the outside.
Memory 910 may include high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
If the memory 910, the processor 920 and the communication interface 930 are implemented independently, the memory 910, the processor 920 and the communication interface 930 may be connected to each other through a bus and perform communication with each other. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 3, but this does not mean only one bus or one type of bus.
Optionally, in an implementation, if the memory 910, the processor 920 and the communication interface 930 are integrated on a chip, the memory 910, the processor 920 and the communication interface 930 may complete communication with each other through an internal interface.
The embodiment of the invention provides a computer readable storage medium, which stores a computer program, and the program is executed by a processor to realize the intelligent query method according to any one of the embodiments.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "a plurality" means two or more unless specifically defined otherwise.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a separate product, may also be stored in a computer readable storage medium. The storage medium may be a read-only memory, a magnetic or optical disk, or the like.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive various changes or substitutions within the technical scope of the present invention, and these should be covered by the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (8)

1. A method of intelligent querying, comprising:
receiving a query instruction from a client, wherein the query instruction comprises a primary key of a starting relation table and at least one attribute of a terminating relation table;
according to the query instruction, determining a target query plan corresponding to the attribute of each termination relation table from the pre-generated query plans, wherein the target query plan comprises at least one query path from the main key of the start relation table to the attribute of one termination relation table;
selecting a target query path from the query paths included in the target query plan, including: selecting a target query path according to the weight and the query flow limit of each query path included in the target query plan; checking whether query current limitation exists in relation tables passed by query paths included in the target query plan, acquiring a weight sum corresponding to the query paths composed of relation tables without query current limitation, wherein the weight sum comprises a sum of weights among the relation tables passed by the query paths, the weights among the relation tables are obtained by comprehensively calculating access performance, relation table capacity and network delay among the relation tables, and the target query path is selected based on the weight sum;
according to the target query path, querying to obtain data corresponding to the attribute of the termination relation table;
and sending the inquired data to the client.
2. The method of claim 1, further comprising:
and generating a query plan starting from any relation table and corresponding to any one or more relation tables according to the weight among the relation tables.
3. The method of claim 2, wherein said selecting a target query path based on the weighted sum comprises:
and selecting the query path with the minimum weight as a target query path from a plurality of query paths consisting of the relation tables without query flow limitation.
4. The method of claim 2, further comprising:
and if the target query plan only comprises one query path and the query path has a query current-limiting relation table, executing the query instruction in a lagging mode.
5. An apparatus for intelligent querying, comprising:
the system comprises a receiving module, a judging module and a judging module, wherein the receiving module is used for receiving a query instruction from a client, and the query instruction comprises a main key of a starting relation table and attributes of at least one ending relation table;
a determining module, configured to determine, according to the query instruction, a target query plan corresponding to the attribute of each termination relationship table from among pre-generated query plans, where the target query plan includes at least one query path from a primary key of the initiation relationship table to an attribute of one termination relationship table;
the selection module is used for selecting a target query path from all query paths included in the target query plan; the selection module comprises: the selection sub-module is used for selecting a target query path according to the weight and the query flow limit of each query path included in the target query plan; checking whether query current limitation exists in relation tables passed by query paths included in the target query plan, acquiring a weight sum corresponding to the query paths composed of relation tables without query current limitation, wherein the weight sum comprises a sum of weights among the relation tables passed by the query paths, the weights among the relation tables are obtained by comprehensively calculating access performance, relation table capacity and network delay among the relation tables, and the target query path is selected based on the weight sum;
the query module is used for querying and obtaining data corresponding to the attribute of the termination relation table according to the target query path;
and the sending module is used for sending the inquired data to the client.
6. The apparatus of claim 5, wherein the selection module is further to: and generating a query plan starting from any relation table and corresponding to any one or more relation tables according to the weight among the relation tables.
7. A terminal for intelligent query, comprising:
one or more processors;
storage means for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-4.
8. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 4.
CN201810939821.XA 2018-08-17 2018-08-17 Intelligent query method, device, terminal and computer readable storage medium Active CN109063170B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810939821.XA CN109063170B (en) 2018-08-17 2018-08-17 Intelligent query method, device, terminal and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810939821.XA CN109063170B (en) 2018-08-17 2018-08-17 Intelligent query method, device, terminal and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN109063170A CN109063170A (en) 2018-12-21
CN109063170B true CN109063170B (en) 2021-07-30

Family

ID=64687166

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810939821.XA Active CN109063170B (en) 2018-08-17 2018-08-17 Intelligent query method, device, terminal and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN109063170B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113792079B (en) * 2021-11-17 2022-02-08 腾讯科技(深圳)有限公司 Data query method and device, computer equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105224690A (en) * 2015-10-30 2016-01-06 上海达梦数据库有限公司 Generate and select the corresponding method and system containing the executive plan of ginseng statement
CN106897343A (en) * 2016-07-20 2017-06-27 阿里巴巴集团控股有限公司 The lookup method of executive plan, storage method and device
CN107168977A (en) * 2016-03-08 2017-09-15 阿里巴巴集团控股有限公司 A kind of optimization method and device of data query

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10380108B2 (en) * 2015-06-22 2019-08-13 International Business Machines Corporation Partition access method for query optimization

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105224690A (en) * 2015-10-30 2016-01-06 上海达梦数据库有限公司 Generate and select the corresponding method and system containing the executive plan of ginseng statement
CN107168977A (en) * 2016-03-08 2017-09-15 阿里巴巴集团控股有限公司 A kind of optimization method and device of data query
CN106897343A (en) * 2016-07-20 2017-06-27 阿里巴巴集团控股有限公司 The lookup method of executive plan, storage method and device

Also Published As

Publication number Publication date
CN109063170A (en) 2018-12-21

Similar Documents

Publication Publication Date Title
US20190303382A1 (en) Distributed database systems and methods with pluggable storage engines
US8219564B1 (en) Two-dimensional indexes for quick multiple attribute search in a catalog system
US9048862B2 (en) Systems and methods for selecting data compression for storage data in a storage system
US8495013B2 (en) Distributed storage system and method for storing objects based on locations
US20180239800A1 (en) Data query method and apparatus
US20170063717A1 (en) Method and system for network access request control
EP2637111A1 (en) Data management system and method using database middleware
US8812492B2 (en) Automatic and dynamic design of cache groups
WO2020001287A1 (en) Data verification method and apparatus, and storage medium
US10466936B2 (en) Scalable, multi-dimensional search for optimal configuration
US9734176B2 (en) Index merge ordering
CN111159524A (en) Monitoring method and system, and storage medium
CN111782692A (en) Frequency control method and device
CN109063170B (en) Intelligent query method, device, terminal and computer readable storage medium
CN114860764A (en) Optimization method and system for distributed database query and electronic equipment
WO2020094064A1 (en) Performance optimization method, device, apparatus, and computer readable storage medium
CN111125199A (en) Database access method and device and electronic equipment
CN108664493B (en) Method and device for counting validity of URL (Uniform resource locator), electronic equipment and storage medium
CN109117426B (en) Distributed database query method, device, equipment and storage medium
US7974965B2 (en) Federated pagination management
US9781073B1 (en) Redirecting invalid URL to comparable object with sufficient permissions
KR101854284B1 (en) Distributed RDF query processing system for reducing join cost and communication cost
CN115237960A (en) Information pushing method and device, storage medium and electronic equipment
CN110798222B (en) Data compression method and device
KR102571783B1 (en) Search processing system performing high-volume search processing and control method thereof

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