CN112749189A - Data query method and device - Google Patents

Data query method and device Download PDF

Info

Publication number
CN112749189A
CN112749189A CN201911040316.2A CN201911040316A CN112749189A CN 112749189 A CN112749189 A CN 112749189A CN 201911040316 A CN201911040316 A CN 201911040316A CN 112749189 A CN112749189 A CN 112749189A
Authority
CN
China
Prior art keywords
homologous
query
data
nodes
merged
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.)
Pending
Application number
CN201911040316.2A
Other languages
Chinese (zh)
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 CN201911040316.2A priority Critical patent/CN112749189A/en
Publication of CN112749189A publication Critical patent/CN112749189A/en
Pending legal-status Critical Current

Links

Images

Classifications

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

Abstract

The invention discloses a data query method and a data query device. Wherein, the method comprises the following steps: determining homologous nodes with the same storage path in a query tree for database query; establishing a homologous query list according to homologous nodes, wherein the homologous query list comprises identifiers of homologous data corresponding to a plurality of homologous nodes and storage paths of the homologous data; and according to the homologous query list, carrying out merged query on homologous data corresponding to the homologous nodes in a target database corresponding to the storage path of the homologous data. The invention solves the technical problems of low query speed and low efficiency caused by firstly querying and then merging the homologous data in the related technology.

Description

Data query method and device
Technical Field
The invention relates to the field of data query, in particular to a data query method and device.
Background
When data query is carried out on a database, a query tree is established according to the requirement of the data query, the query tree comprises a plurality of nodes and shows the logical relationship and the query sequence among the nodes, the nodes comprise query data corresponding to the nodes and the storage positions of the query data, when the data query is carried out through the query tree, all the nodes in a query book are traversed one by one according to the query sequence shown by the query tree, and each node needs to execute access to the corresponding database to query the corresponding data. Generally, a plurality of nodes of the query tree correspond to a plurality of different databases, and each node needs to access the database stored in the data of the node to perform query during query so as to query the corresponding data. When querying, the existing scheme queries and then merges single data sources respectively, and even the same data source can be queried separately due to different nodes, which results in slow data querying speed and low efficiency.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a data query method and a data query device, which are used for at least solving the technical problems of low query speed and low efficiency caused by the fact that query is firstly carried out and then homologous data are combined in the related technology.
According to an aspect of an embodiment of the present invention, there is provided a data query method, including: determining homologous nodes with the same storage path in a query tree for database query; establishing a homologous query list according to the homologous nodes, wherein the homologous query list comprises identifiers of homologous data corresponding to the homologous nodes and storage paths of the homologous data; and according to the homologous query list, performing merged query on homologous data corresponding to the homologous nodes in a target database corresponding to the storage path of the homologous data.
Optionally, according to the homologous query list, performing merged query on homologous data corresponding to a plurality of homologous nodes in a target database corresponding to the storage path of the homologous data, including: determining the target database according to the storage path of the homologous node, wherein the target database is used for storing homologous data corresponding to the homologous node; and performing merged query on homologous data corresponding to the homologous nodes from the target database according to the homologous query list.
Optionally, performing merged query on the homologous data corresponding to the homologous node from the target database according to the homologous query list, including: receiving a query instruction, wherein the query instruction comprises query data needing to be queried; determining merged query SQL (structured query language) used for querying the homologous data in the query data according to the query data, wherein the query data comprise a plurality of homologous data stored in different target databases, and different merged query SQL corresponding to different kinds of homologous data; and according to the merged query SQL, performing merged query on the homologous data from the corresponding target database.
Optionally, after performing a merged query on the homologous data from the corresponding target database according to the merged query SQL, the method further includes: outputting a merged query result of the target database for merging and querying the homologous data, wherein the merged query result includes the homologous data corresponding to the homologous nodes respectively.
Optionally, determining the homologous nodes with the same storage path in the query tree for performing the database query includes: traversing all nodes on the query tree through a recursive algorithm; determining a unique code of each node on the query tree, wherein the unique code is used for identifying a database in which data of the node is stored; and taking the nodes with the same unique codes as the homologous nodes.
Optionally, establishing a homologous query list according to the homologous node includes: acquiring all the homologous nodes on the query tree; and writing the identification and the storage path of the homologous node into the corresponding homologous query list.
According to another aspect of the embodiments of the present invention, there is also provided a data query apparatus, including: the determining module is used for determining homologous nodes with the same storage path in a query tree for database query; the construction module is used for establishing a homologous query list according to the homologous nodes, wherein the homologous query list comprises identifiers of homologous data corresponding to the homologous nodes and storage paths of the homologous data; and the query module is used for performing merged query on the homologous data corresponding to the homologous nodes in a target database corresponding to the storage path of the homologous data according to the homologous query list.
Optionally, the query module includes: the determining unit is used for determining the target database according to the storage path of the homologous node, wherein the target database is used for storing homologous data corresponding to the homologous node; and the query unit is used for carrying out combined query on the homologous data corresponding to the homologous node from the target database according to the homologous query list.
According to another aspect of the embodiments of the present invention, there is also provided a storage medium, where the storage medium includes a stored program, and when the program runs, a device in which the storage medium is located is controlled to execute any one of the above methods.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including at least one processor, and at least one memory and a bus connected to the processor; the processor and the memory complete mutual communication through the bus; the processor is configured to call program instructions in the memory to perform a data query method as described in any one of the above.
In the embodiment of the invention, homologous nodes with the same storage path in a query tree for database query are determined; establishing a homologous query list according to homologous nodes, wherein the homologous query list comprises identifiers of homologous data corresponding to a plurality of homologous nodes and storage paths of the homologous data; according to the homologous query list, in a target database corresponding to the storage path of the homologous data, the homologous nodes on the query tree are searched and identified in a manner of merging and querying the homologous data corresponding to the homologous nodes, and the homologous nodes are merged and queried, so that the aim of querying more data nodes with less access times is fulfilled, the technical effects of improving query speed and query efficiency are achieved, and the technical problems of low query speed and low efficiency caused by the fact that query is performed first in the related technology and then the homologous data are merged are solved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this application, illustrate embodiments of the application and, together with the description, serve to explain the application and are not intended to limit the application. In the drawings:
FIG. 1 is a flow chart of a data query method according to an embodiment of the invention;
fig. 2 is a schematic diagram of a data query device according to an embodiment of the present invention.
Detailed Description
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be used. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of description, some terms or expressions referred to in the embodiments of the present application are explained below:
and (3) querying the tree: a tree structure is constructed according to query relations.
In accordance with an embodiment of the present invention, there is provided a method embodiment of a data query method, it should be noted that the steps illustrated in the flowchart of the accompanying drawings may be performed in a computer system such as a set of computer executable instructions, and that while a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than that herein.
Fig. 1 is a flowchart of a data query method according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
step S102, determining homologous nodes with the same storage path in a query tree for database query;
step S104, establishing a homologous query list according to homologous nodes, wherein the homologous query list comprises identifiers of homologous data corresponding to a plurality of homologous nodes and storage paths of the homologous data;
and step S106, according to the homologous query list, carrying out merged query on homologous data corresponding to the homologous nodes in a target database corresponding to the storage path of the homologous data.
Through the steps, homologous nodes with the same storage path in a query tree for database query are determined; establishing a homologous query list according to homologous nodes, wherein the homologous query list comprises identifiers of homologous data corresponding to a plurality of homologous nodes and storage paths of the homologous data; according to the homologous query list, in a target database corresponding to the storage path of the homologous data, the homologous nodes on the query tree are searched and identified in a manner of merging and querying the homologous data corresponding to the homologous nodes, and the homologous nodes are merged and queried, so that the aim of querying more data nodes with less access times is fulfilled, the technical effects of improving query speed and query efficiency are achieved, and the technical problems of low query speed and low efficiency caused by the fact that query is performed first in the related technology and then the homologous data are merged are solved.
The nodes in the query tree usually correspond to a part of data, the data may be a data segment, a data list, a data matrix, or the like, the nodes store the identifiers of the data and the addresses of the database stored in the data, and the addresses of the database may be embodied by storage paths, may be embodied by the identifiers of the database, or the like. The identification of the data may be identification information such as an identification field, a name, ID information, etc. in the database, so as to search the data in the database. In general, when a database is queried through the query tree, nodes on the query tree need to be traversed, a database in which data corresponding to each node is stored is a single data source, that is, when data in the nodes is queried, only one database needs to be accessed, and then the data corresponding to the nodes can be found. Then, after the nodes in the query tree are traversed, the data queried by each node is merged, for example, written into a result list, and the merged data is output, which is inefficient.
The embodiment provides a data query method, before data query is performed, a unique code for identifying a data source of data corresponding to a node is generated for each node in a query tree, whether the data in the node is stored in the same database can be determined by comparing whether the unique codes of the nodes in the query tree are the same, that is, whether the two nodes are homologous, and when the unique codes of the two nodes are the same, the two nodes are determined to be homologous nodes. All nodes with the same unique code in the query tree can be determined as homologous nodes, data corresponding to the homologous nodes are homologous data, and databases stored by the homologous data are the same database. Different data nodes on the query tree can carry the unique code to represent the data source of the data node, so that the data of the same data source are merged in the query tree by traversing the query tree through the unique code, and then the query is carried out, thereby effectively improving the efficiency and speed of data query through the query tree.
And establishing a homologous query node list according to homologous nodes in the query tree, wherein the homologous query list comprises identifiers of homologous data corresponding to the homologous nodes, the identifiers are used for identifying the homologous data so as to query the homologous data according to the identifiers, and the homologous query node list also comprises storage paths of the homologous data, such as a database in which the homologous data are stored. So as to search the homologous data from the database according to the storage path. The above-mentioned homologous query list may also include information such as the size of homologous data corresponding to the homologous node, and the data type.
The database comprises two modes of single query and combined query. The single query is to query the data in the database according to the identification of the single data through the word query SQL. The merged query is to perform merged query on a plurality of data in a database according to the identifiers of the plurality of data by the merged query SQL, and can query the plurality of data at one time. In this embodiment, the homologous data information of the multiple homologous nodes is written into the homologous query node list, a merged query SQL is established according to the homologous query node list, and the merged query operation is performed on the database to obtain the multiple homologous data in the homologous query node list, so that the efficiency of data query is improved.
The structured query language SQL is used for calling the query tree to execute data query operation, and under the condition that the nodes of the query tree are merged with the nodes of the source data, the query mode is simplified compared with the mode of paying attention to traversing the nodes of the query tree, so that data query can be performed quickly.
Optionally, according to the homologous query list, performing merged query on homologous data corresponding to the multiple homologous nodes in a target database corresponding to the storage path of the homologous data, including: determining a target database according to the storage path of the homologous node, wherein the target database is used for storing homologous data corresponding to the homologous node; and performing merged query on homologous data corresponding to the homologous nodes from the target database according to the homologous query list.
The storage path may identify a storage hierarchy of the data, for example, a first storage cluster, a second storage group, and a first storage, and a root of the storage path may determine a target server where the data is stored, so that a target database of the data may be determined through the storage path. A plurality of data are stored in the database, the data stored in the database are all called homologous data, and the plurality of homologous data in the database can comprise a plurality of data corresponding to nodes in the query tree. In the target database, a merged query can be performed according to the homologous query list, so as to perform a simultaneous query on a plurality of homologous data in the homologous query list.
Optionally, performing merged query on homologous data corresponding to the homologous node from the target database according to the homologous query list, where the merged query includes: receiving a query instruction, wherein the query instruction comprises query data needing to be queried; determining merged query SQL (structured query language) for querying homologous data in query data according to the query data, wherein the query data comprise a plurality of kinds of homologous data stored in different target databases, and different merged query SQL corresponding to different kinds of homologous data; and according to the merged query SQL, performing merged query on the homologous data from the corresponding target database.
The query instruction can be sent by a user through an interactive device, and the query instruction is sent to perform data query on the database under the condition that the user needs to perform query. The query instruction may also be a query condition in the system triggered to automatically issue a query instruction to automatically perform data query. The query instruction includes data to be queried, which may exist in a list form, and may query a plurality of data simultaneously. And determining the merged query SQL according to the query data in the query instruction. Specifically, a query tree is established according to the plurality of query data, homologous data in the query tree are merged and written into a homologous query list, a target database corresponding to the homologous data is determined according to the homologous query list, and a merged query SQL is generated to perform merged query on the target database. It should be noted that a plurality of data in the query data may be stored in a plurality of different target databases. The process of carrying out the combined query on a plurality of different target databases can be parallel and does not influence each other. Thereby further improving the efficiency of data query.
Optionally, after performing a merged query on the homologous data from the corresponding target database according to the merged query SQL, the method further includes: and outputting a merged query result of the target database merged query homologous data, wherein the merged query result comprises homologous data respectively corresponding to a plurality of homologous nodes.
After the query is merged, writing the multiple pieces of homologous data obtained by the query merging into a merged query result, wherein the merged query result can be in a list form, and outputting the merged query result.
Optionally, determining the homologous nodes with the same storage path in the query tree for performing the database query includes: traversing all nodes on the query tree through a recursive algorithm; determining a unique code of each node on the query tree, wherein the unique code is used for identifying a database in which data of the node is stored; and taking the nodes with the same unique codes as the homologous nodes.
Traversing nodes on the query tree through a recursive algorithm; determining a unique code of a node on a query tree; and taking the nodes with the same unique codes as the homologous nodes. The nodes on the query tree are traversed through the recursive algorithm, so that the nodes on the query tree can be completely and accurately traversed, and each node in the query tree can be ensured to be traversed. The unique code may be a hash value, which is determined by performing hash operation on the identity of the data source, or may be a field, a value, or an identifier that can identify the data source, which is obtained by using another function.
Optionally, establishing a homologous query list according to the homologous node includes: acquiring all homologous nodes on a query tree; and writing the identification and the storage path of the homologous node into a corresponding homologous query list.
The structured query language generates a new structured query language according to different query conditions, for example, different query trees, and in particular, obtains a query node list of a homologous node in the query tree through an updated query tree when the structure of the query tree changes; constructing a structured query language from a list of query nodes
Optionally, the number of structured query languages is multiple, and the structured query languages respectively correspond to the same source nodes for querying different data sources.
Different data can be queried, and data query can be carried out through different structured query languages.
It should be noted that this embodiment also provides an alternative implementation, which is described in detail below.
When a plurality of data sources are queried, the existing scheme respectively queries and then merges single data sources, generates a unique code SourceCode similar to a Hash value for each data source before querying, judges the data sources with the same unique code SourceCode as the same data source, and queries after merging in a query tree. Without any prior determination, even the same data source would be queried separately.
The technical scheme of the embodiment has the advantages that: and merging the homologies and the queries which can be merged in the query tree, so that the times of accessing the database are reduced.
Firstly, the nodes on the query tree are judged one by utilizing a recursive algorithm, each query interface can recursively judge whether the sub-nodes under the query interface are homologous, and nodes which can be merged by homology are marked.
Where the mergeable nodes also depend on whether the computation function in the query supports translation.
Then, a list of homologous query nodes which can be merged is obtained, and SQL is constructed to form a single query.
Finally, because the queries are all homologous, any data connection is required, and the SQL query generated in the last step is used.
The method and the device can reduce the times of accessing the database and increase the query speed.
Fig. 2 is a schematic diagram of a data query apparatus according to an embodiment of the present invention, and as shown in fig. 2, according to another aspect of the embodiment of the present invention, there is also provided a data query apparatus including: a determination module 22, a construction module 24 and a query module 26, which are described in detail below.
A determining module 22, configured to determine homologous nodes with the same storage path in a query tree for performing database query; a building module 24, connected to the determining module 22, configured to build a homologous query list according to the homologous nodes, where the homologous query list includes identifiers of homologous data corresponding to multiple homologous nodes and storage paths of the homologous data; and the query module 26 is connected to the building module 24, and is configured to perform merged query on the homologous data corresponding to the multiple homologous nodes in the target database corresponding to the storage path of the homologous data according to the homologous query list.
By the device, a determining module 22 is adopted to determine homologous nodes with the same storage path in a query tree for database query; the building module 24 builds a homologous query list according to the homologous nodes, wherein the homologous query list includes identifiers of homologous data corresponding to the multiple homologous nodes and storage paths of the homologous data; the query module 26 searches and identifies the homologous nodes in the query tree according to the homologous query list in a manner of performing merged query on the homologous data corresponding to the homologous nodes in the target database corresponding to the storage path of the homologous data, and merges and queries the homologous nodes, so as to achieve the purpose of querying more data nodes with less access times, thereby achieving the technical effects of improving query speed and query efficiency, and further solving the technical problems of slow query speed and low efficiency caused by the fact that query is performed first in the related art and then the homologous data are merged.
The data processing device comprises a processor and a memory, wherein the determining module 22, the constructing module 24 and the inquiring module 26 are stored in the memory as program module units, and the processor executes the program module units stored in the memory to realize 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, and the Wien diagram and the keywords are displayed simultaneously by adjusting the kernel parameters, so that the use effect 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.
Optionally, the query module includes: the determining unit is used for determining a target database according to the storage path of the homologous node, wherein the target database is used for storing homologous data corresponding to the homologous node; and the query unit is used for carrying out combined query on the homologous data corresponding to the homologous node from the target database according to the homologous query list.
According to another aspect of the embodiments of the present invention, there is also provided a storage medium including a stored program, wherein when the program runs, a device in which the storage medium is located is controlled to execute the method of any one of the above.
According to another aspect of the embodiments of the present invention, there is also provided a processor, configured to execute a program, where the program executes to perform the method of any one of the above.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including at least one processor, and at least one memory and a bus connected to the processor; the processor and the memory complete mutual communication through the bus; the processor is configured to call program instructions in the memory to perform a data query method as described in any one of the above.
The embodiment of the invention provides equipment, which comprises a processor, a memory and a program which is stored on the memory and can run on the processor, wherein the processor executes the program and realizes the following steps: determining homologous nodes with the same storage path in a query tree for database query; establishing a homologous query list according to homologous nodes, wherein the homologous query list comprises identifiers of homologous data corresponding to a plurality of homologous nodes and storage paths of the homologous data; and according to the homologous query list, carrying out merged query on homologous data corresponding to the homologous nodes in a target database corresponding to the storage path of the homologous data.
Optionally, according to the homologous query list, performing merged query on homologous data corresponding to the multiple homologous nodes in a target database corresponding to the storage path of the homologous data, including: determining a target database according to the storage path of the homologous node, wherein the target database is used for storing homologous data corresponding to the homologous node; and performing merged query on homologous data corresponding to the homologous nodes from the target database according to the homologous query list.
Optionally, performing merged query on homologous data corresponding to the homologous node from the target database according to the homologous query list, where the merged query includes: receiving a query instruction, wherein the query instruction comprises query data needing to be queried; determining merged query SQL (structured query language) for querying homologous data in query data according to the query data, wherein the query data comprise a plurality of kinds of homologous data stored in different target databases, and different merged query SQL corresponding to different kinds of homologous data; and according to the merged query SQL, performing merged query on the homologous data from the corresponding target database.
Optionally, after performing a merged query on the homologous data from the corresponding target database according to the merged query SQL, the method further includes: and outputting a merged query result of the target database merged query homologous data, wherein the merged query result comprises homologous data respectively corresponding to a plurality of homologous nodes.
Optionally, determining the homologous nodes with the same storage path in the query tree for performing the database query includes: traversing all nodes on the query tree through a recursive algorithm; determining a unique code of each node on the query tree, wherein the unique code is used for identifying a database in which data of the node is stored; and taking the nodes with the same unique codes as the homologous nodes.
Optionally, establishing a homologous query list according to the homologous node includes: acquiring all homologous nodes on a query tree; and writing the identification and the storage path of the homologous node into a corresponding homologous query list.
The device in the application can be a server, a PC, a PAD, a mobile phone and the like.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device: determining homologous nodes with the same storage path in a query tree for database query; establishing a homologous query list according to homologous nodes, wherein the homologous query list comprises identifiers of homologous data corresponding to a plurality of homologous nodes and storage paths of the homologous data; and according to the homologous query list, carrying out merged query on homologous data corresponding to the homologous nodes in a target database corresponding to the storage path of the homologous data.
Optionally, according to the homologous query list, performing merged query on homologous data corresponding to the multiple homologous nodes in a target database corresponding to the storage path of the homologous data, including: determining a target database according to the storage path of the homologous node, wherein the target database is used for storing homologous data corresponding to the homologous node; and performing merged query on homologous data corresponding to the homologous nodes from the target database according to the homologous query list.
Optionally, performing merged query on homologous data corresponding to the homologous node from the target database according to the homologous query list, where the merged query includes: receiving a query instruction, wherein the query instruction comprises query data needing to be queried; determining merged query SQL (structured query language) for querying homologous data in query data according to the query data, wherein the query data comprise a plurality of kinds of homologous data stored in different target databases, and different merged query SQL corresponding to different kinds of homologous data; and according to the merged query SQL, performing merged query on the homologous data from the corresponding target database.
Optionally, after performing a merged query on the homologous data from the corresponding target database according to the merged query SQL, the method further includes: and outputting a merged query result of the target database merged query homologous data, wherein the merged query result comprises homologous data respectively corresponding to a plurality of homologous nodes.
Optionally, determining the homologous nodes with the same storage path in the query tree for performing the database query includes: traversing all nodes on the query tree through a recursive algorithm; determining a unique code of each node on the query tree, wherein the unique code is used for identifying a database in which data of the node is stored; and taking the nodes with the same unique codes as the homologous nodes.
Optionally, establishing a homologous query list according to the homologous node includes: acquiring all homologous nodes on a query tree; and writing the identification and the storage path of the homologous node into a corresponding homologous query list.
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.
In a typical configuration, a device includes one or more processors (CPUs), memory, and a bus. The device may also include input/output interfaces, network interfaces, and the like.
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 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 in this embodiment, the computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
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 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:
determining homologous nodes with the same storage path in a query tree for database query;
establishing a homologous query list according to the homologous nodes, wherein the homologous query list comprises identifiers of homologous data corresponding to the homologous nodes and storage paths of the homologous data;
and according to the homologous query list, performing merged query on homologous data corresponding to the homologous nodes in a target database corresponding to the storage path of the homologous data.
2. The method according to claim 1, wherein performing merged query on homologous data corresponding to a plurality of homologous nodes in a target database corresponding to a storage path of the homologous data according to the homologous query list includes:
determining the target database according to the storage path of the homologous node, wherein the target database is used for storing homologous data corresponding to the homologous node;
and performing merged query on homologous data corresponding to the homologous nodes from the target database according to the homologous query list.
3. The method of claim 2, wherein performing a merged query on the homologous data corresponding to the homologous node from the target database according to the homologous query list comprises:
receiving a query instruction, wherein the query instruction comprises query data needing to be queried;
determining merged query SQL (structured query language) used for querying the homologous data in the query data according to the query data, wherein the query data comprise a plurality of homologous data stored in different target databases, and different merged query SQL corresponding to different kinds of homologous data;
and according to the merged query SQL, performing merged query on the homologous data from the corresponding target database.
4. The method according to claim 3, after performing a merged query on the homologous data from the corresponding target database according to the merged query SQL, further comprising:
outputting a merged query result of the target database for merging and querying the homologous data, wherein the merged query result includes the homologous data corresponding to the homologous nodes respectively.
5. The method of claim 1, wherein determining homologous nodes having the same storage path in a query tree for performing a database query comprises:
traversing all nodes on the query tree through a recursive algorithm;
determining a unique code of each node on the query tree, wherein the unique code is used for identifying a database in which data of the node is stored;
and taking the nodes with the same unique codes as the homologous nodes.
6. The method of claim 5, wherein building a list of homologous queries based on the homologous nodes comprises:
acquiring all the homologous nodes on the query tree;
and writing the identification and the storage path of the homologous node into the corresponding homologous query list.
7. A data query apparatus, comprising:
the determining module is used for determining homologous nodes with the same storage path in a query tree for database query;
the construction module is used for establishing a homologous query list according to the homologous nodes, wherein the homologous query list comprises identifiers of homologous data corresponding to the homologous nodes and storage paths of the homologous data;
and the query module is used for performing merged query on the homologous data corresponding to the homologous nodes in a target database corresponding to the storage path of the homologous data according to the homologous query list.
8. The apparatus of claim 7, wherein the query module comprises:
the determining unit is used for determining the target database according to the storage path of the homologous node, wherein the target database is used for storing homologous data corresponding to the homologous node;
and the query unit is used for carrying out combined query on the homologous data corresponding to the homologous node from the target database according to the homologous query list.
9. A storage medium, comprising a stored program, wherein the program, when executed, controls an apparatus in which the storage medium is located to perform the method of any one of claims 1 to 6.
10. An electronic device comprising at least one processor, and at least one memory, bus connected to the processor; the processor and the memory complete mutual communication through the bus; the processor is configured to call program instructions in the memory to perform the data query method of any one of claims 1 to 6.
CN201911040316.2A 2019-10-29 2019-10-29 Data query method and device Pending CN112749189A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911040316.2A CN112749189A (en) 2019-10-29 2019-10-29 Data query method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911040316.2A CN112749189A (en) 2019-10-29 2019-10-29 Data query method and device

Publications (1)

Publication Number Publication Date
CN112749189A true CN112749189A (en) 2021-05-04

Family

ID=75640194

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911040316.2A Pending CN112749189A (en) 2019-10-29 2019-10-29 Data query method and device

Country Status (1)

Country Link
CN (1) CN112749189A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023279962A1 (en) * 2021-07-09 2023-01-12 华为技术有限公司 Data processing method and apparatus, and computing system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110093486A1 (en) * 2009-10-15 2011-04-21 Institute For Information Industry Data query method, data query system and computer readable and writable recording medium
CN105608086A (en) * 2014-11-17 2016-05-25 中兴通讯股份有限公司 Transaction processing method and device of distributed database system
CN106547796A (en) * 2015-09-23 2017-03-29 南京中兴新软件有限责任公司 The execution method and device of data base
CN107066534A (en) * 2017-03-02 2017-08-18 人谷科技(北京)有限责任公司 Multi-source data polymerization and system
CN108197187A (en) * 2017-12-26 2018-06-22 金蝶软件(中国)有限公司 Optimization method, device, storage medium and the computer equipment of query statement

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110093486A1 (en) * 2009-10-15 2011-04-21 Institute For Information Industry Data query method, data query system and computer readable and writable recording medium
CN105608086A (en) * 2014-11-17 2016-05-25 中兴通讯股份有限公司 Transaction processing method and device of distributed database system
CN106547796A (en) * 2015-09-23 2017-03-29 南京中兴新软件有限责任公司 The execution method and device of data base
CN107066534A (en) * 2017-03-02 2017-08-18 人谷科技(北京)有限责任公司 Multi-source data polymerization and system
CN108197187A (en) * 2017-12-26 2018-06-22 金蝶软件(中国)有限公司 Optimization method, device, storage medium and the computer equipment of query statement

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023279962A1 (en) * 2021-07-09 2023-01-12 华为技术有限公司 Data processing method and apparatus, and computing system

Similar Documents

Publication Publication Date Title
CN107622091B (en) Database query method and device
CN107038207B (en) Data query method, data processing method and device
CN106970936B (en) Data processing method and device and data query method and device
CN109669709B (en) Data migration method and data migration system for block chain upgrading
CN107038161B (en) Equipment and method for filtering data
CN108268609B (en) File path establishing and accessing method and device
CN111813805A (en) Data processing method and device
US9229961B2 (en) Database management delete efficiency
CN111124480A (en) Application package generation method and device, electronic equipment and storage medium
CN107609011B (en) Database record maintenance method and device
CN114297204A (en) Data storage and retrieval method and device for heterogeneous data source
CN114372102A (en) Data analysis method and device, storage medium and electronic equipment
CN113568924A (en) Data processing method and device, electronic equipment and storage medium
CN112749189A (en) Data query method and device
CN107220265B (en) Database statement compiling and executing method and device
CN112541001A (en) Data query method, device, storage medium and equipment
CN111125216A (en) Method and device for importing data into Phoenix
CN116010345A (en) Method, device and equipment for realizing table service scheme of flow batch integrated data lake
CN112491943A (en) Data request method, device, storage medium and electronic equipment
US11847121B2 (en) Compound predicate query statement transformation
CN111143006B (en) Method and device for acquiring command help information
CN109902067B (en) File processing method and device, storage medium and computer equipment
CN112527792A (en) Data storage method, device, equipment and storage medium
CN111368146A (en) Path information query method and device, storage medium and processor
CN113268483A (en) Request processing method and device, electronic equipment and storage medium

Legal Events

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