CN113064928A - Report data query method and device, electronic equipment and storage medium - Google Patents

Report data query method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113064928A
CN113064928A CN202110449735.2A CN202110449735A CN113064928A CN 113064928 A CN113064928 A CN 113064928A CN 202110449735 A CN202110449735 A CN 202110449735A CN 113064928 A CN113064928 A CN 113064928A
Authority
CN
China
Prior art keywords
query
report data
statement
combined
initial
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
CN202110449735.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.)
OneConnect Smart Technology Co Ltd
OneConnect Financial Technology Co Ltd Shanghai
Original Assignee
OneConnect Financial Technology Co Ltd Shanghai
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 OneConnect Financial Technology Co Ltd Shanghai filed Critical OneConnect Financial Technology Co Ltd Shanghai
Priority to CN202110449735.2A priority Critical patent/CN113064928A/en
Publication of CN113064928A publication Critical patent/CN113064928A/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/2457Query processing with adaptation to user needs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2246Trees, e.g. B+trees
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/248Presentation of query results
    • 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/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • G06F16/285Clustering or classification
    • G06F16/287Visualization; Browsing

Landscapes

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

Abstract

The invention relates to the field of data processing, and discloses a report data query method, which comprises the following steps: responding to a query request of report data, and generating a query identifier and a query object of the report data; generating corresponding initial query statements according to the query identification and the query object, and combining the initial query statements according to query indexes in the initial query statements to obtain combined query statements; inquiring report data from a preset database in a concurrent thread execution mode according to the combined query statement to obtain a combined query result of the combined query statement; and decomposing the merged query result to obtain a query result corresponding to the initial query statement. The invention also provides a report data query device, electronic equipment and a computer readable storage medium. In addition, the invention also relates to a block chain technology, and the merged query result can be stored in the block chain. The invention can improve the speed of inquiring the report data.

Description

Report data query method and device, electronic equipment and storage medium
Technical Field
The invention relates to the field of data processing, in particular to a report data query method and device, electronic equipment and a computer readable storage medium.
Background
The system comprises a visual report editing system, a code-free development platform, a component configuration and a mouse dragging, wherein a user can drag a report component and perform attribute configuration on the report component through the mouse according to business needs, configure a data source for the report, configure dimensions, an index set and a corresponding filter for the dynamic data component, automatically convert the report component into query statements by the system at the background according to the configuration of the dynamic data component, execute all dynamically converted query statements when the report is previewed and checked, return query results and fill the query results into the dynamic data components such as a histogram, a radar chart and a conversion chart, so that the graphical multi-dimensional display of the report data is completed.
A complex report usually contains a plurality of dynamic data components, and one dynamic data component may also need to query a plurality of query statements, and usually the complex report queries 20 query statements or more at one time, so that multiple query statements are often required to be executed when querying the report data, which causes a very large delay when querying the report data to the source database by using the query statements, and even causes a response timeout of the report data query, thereby seriously affecting user experience.
Disclosure of Invention
The invention provides a report data query method, a report data query device, electronic equipment and a computer readable storage medium, and mainly aims to improve the speed of report data query.
In order to achieve the above object, the present invention provides a report data query method, which comprises:
responding to a query request of report data, and generating a query identifier and a query object of the report data;
generating corresponding initial query statements according to the query identification and the query object, and combining the initial query statements according to query indexes in the initial query statements to obtain combined query statements;
inquiring report data from a preset database in a concurrent thread execution mode according to the combined query statement to obtain a combined query result of the combined query statement;
and decomposing the merged query result to obtain a query result corresponding to the initial query statement.
Optionally, the generating the query identifier and the query object of the report data in response to the query request of the report data includes:
identifying the query type and query time of the report data of the query request, and establishing a query identifier of the report data according to the query type and query time of the report data;
and acquiring report query indexes and query conditions in the query request, and establishing query objects of the report data according to the report query indexes and the query conditions.
Optionally, the generating a corresponding initial query statement according to the query identifier and the query object includes:
generating id of a query statement according to the query identifier, and converting the query object into a query parameter of the query statement;
and generating a corresponding initial query statement according to the id and the query parameter.
Optionally, the merging the initial query statements according to the query indicators in the initial query statements to obtain merged query statements includes:
acquiring a query condition corresponding to the query index;
and carrying out statement merging on the initial query statements with the consistent query conditions and query indexes to obtain merged query statements.
Optionally, before querying report data in a preset database in a concurrent thread execution manner according to the merged query statement, the method further includes:
judging whether the number of the combined query sentences exceeds a preset threshold value;
if the number of the combined query statements does not exceed a preset threshold, inquiring report data from a preset database in a concurrent thread execution mode according to the combined query statements;
and if the number of the combined query statements exceeds a preset threshold value, performing batch processing on the combined query statements, and querying report data from a preset database in a concurrent thread execution mode according to the combined query statements after the batch processing.
Optionally, the querying report data from a preset database in a concurrent thread execution manner according to the merged query statement to obtain a merged query result of the merged query statement includes:
analyzing the combined query statement to generate a query node, and matching a query object of a report data component in the database with the query node;
constructing a query logic tree of report data according to the query nodes and the query objects which are successfully matched, and carrying out logic optimization on the query logic tree to obtain an optimized query logic tree;
and executing the query of the report data by adopting a concurrent thread execution mode according to the optimized query logic tree to obtain a combined query result of the combined query statement.
Optionally, decomposing the merged query result to obtain a query result corresponding to the initial query statement includes:
counting the number of the query indexes in the initial query statement to obtain the number of the query indexes corresponding to the initial query statement;
acquiring an execution query statement corresponding to the combined query result;
and according to the query index number and the execution query statement, executing the decomposition of the combined query result to obtain a query result corresponding to the initial query statement.
In order to solve the above problem, the present invention further provides a report data query apparatus, including:
the generating module is used for responding to a query request of the report data and generating a query identifier and a query object of the report data;
the merging module is used for generating a corresponding initial query statement according to the query identifier and the query object, and merging the initial query statement according to a query index in the initial query statement to obtain a merged query statement;
the query module is used for querying report data to a preset database in a concurrent thread execution mode according to the combined query statement to obtain a combined query result of the combined query statement;
and the decomposition module is used for decomposing the merged query result to obtain a query result corresponding to the initial query statement.
In order to solve the above problem, the present invention also provides an electronic device, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to implement the report data query method.
In order to solve the above problem, the present invention further provides a computer-readable storage medium, in which at least one computer program is stored, and the at least one computer program is executed by a processor in an electronic device to implement the report data query method described above.
The embodiment of the invention firstly generates a corresponding initial query statement based on a query identifier and a query object of report data, and combines the initial query statement according to a query index in the initial query statement to obtain a combined query statement so as to combine the query statements with the same query object, thereby reducing the interaction times of the query statements and a database and improving the query speed of the report data; secondly, the invention queries the report data from the database by adopting a query mode of a concurrent thread, so that the response time of the query of the report data can be reduced, and the query performance of the report data is optimized. Therefore, the report data query method, the report data query device, the electronic equipment and the storage medium can improve the report data query speed.
Drawings
FIG. 1 is a flowchart illustrating a report data query method according to an embodiment of the present invention;
FIG. 2 is a detailed flowchart illustrating a step of the report data query method shown in FIG. 1 according to a first embodiment of the present invention;
FIG. 3 is a block diagram of a report data query apparatus according to an embodiment of the present invention;
fig. 4 is a schematic diagram of an internal structure of an electronic device implementing a report data query method according to an embodiment of the present invention;
the implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the application provides a report data query method. The execution subject of the report data query method includes, but is not limited to, at least one of electronic devices that can be configured to execute the method provided by the embodiments of the present application, such as a server, a terminal, and the like. In other words, the report data query method may be executed by software or hardware installed in the terminal device or the server device, and the software may be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
Fig. 1 is a schematic flow chart illustrating a report data query method according to an embodiment of the present invention. In the embodiment of the invention, the report data query method comprises the following steps:
s1, responding to the query request of the report data, and generating the query identification and the query object of the report data.
In the embodiment of the present invention, the report data refers to data that needs to be displayed in a front-end page, and includes: statistical indicators such as banks statistics on asset balance data such as periodic deposits, current deposits, financing, trust by business type, charts such as statistics on individual asset balances by time or region and showing trends in asset balances over time in a line graph, and data lists such as line graphs showing asset balances in the form of data tables (data lists support sorting by tabular columns). Further, the query request is generated based on different user requirements, for example, the requirements of the user a are: and inquiring report data of the steel prices in the south China in the last year.
In an alternative embodiment of the present invention, referring to fig. 2, the S1 includes:
s20, identifying the query type and query time of the report data of the query request, and establishing a query identifier of the report data according to the query type and query time of the report data;
s21, obtaining report form query indexes and query conditions in the query request, and establishing query objects of the report form data according to the report form query indexes and query conditions.
The query identifier is used to represent the uniqueness of the query request, the query object is used to convert into a memory object of a statement of query report data, the report query index refers to report data (such as asset balance) that needs to be queried specifically, and the query condition refers to a query rule that the query index needs to follow, including: screening conditions, paging conditions, pull-down conditions, sorting conditions, and the like. For example, for a query request for "obtaining report data of steel prices in south China in the last year", the query type of the report data may be "steel price query", the query index may be "steel price", and the query condition may be "steel prices in the last year and in south China".
S2, generating a corresponding initial query statement according to the query identifier and the query object, and combining the initial query statement according to the query index in the initial query statement to obtain a combined query statement.
In one embodiment of the present invention, the generating a corresponding initial query statement according to the query identifier and the query object includes: and generating id of the query statement according to the query identifier, converting the query object into a query parameter of the query statement by using a preset object conversion program, and generating a corresponding initial query statement according to the id and the query parameter. Optionally, the preset object conversion program is compiled through Java language.
It should be understood that the query of the data to the database is implemented based on query language (SQL), and therefore, the embodiment of the present invention guarantees normal query of the subsequent report data through the initial query statement.
Further, as can be seen from the above S1, query indicators, that is, report data to be queried, exist in the generated initial query statement, such as the initial query statement Q1: select sum (a.c1) x1, sum (a.c2) x2 from a; initial query statement Q2: and (2) select sum (a.c2) x2, sum (a.c3) x3 from a, the query indexes of the Q1 are x1 and x2, and the query indexes of the Q2 are x2 and x 3. Therefore, according to the query indexes in the initial query statement, the initial query statement is combined, so that the frequency of subsequent queries to the database is reduced, and the query performance of report data is improved.
In detail, the merging the initial query statements according to the query indicators in the initial query statements to obtain merged query statements includes: and acquiring a query condition corresponding to the query index, and performing statement merging on the initial query statement with the query condition and the query index consistent to obtain a merged query statement. If the query conditions of Q1 and Q2 are both obtained from "a", then Q3 is generated by combining Q1 and Q2: select sum (a.c1) x1, sum (a.c2) x2, sum (a.c3) x3 from a, then the query statement Q1 can be modified to correspond to the query index list in the query object (e.g., [ S1, S2]) and add [ S3], so as to form a new query index list [ S1, S2, S3], and simultaneously mark that the query object corresponding to the query statement Q2 does not need to be executed, and record the new query index list in the memory in the form of map key value pair of { Q1: [ Q2 … ] }, wherein the modified Q1 represents the query statement identifier that is merged to be executed, and the modified Q2 represents the query statement identifier that does not need to be executed after being merged.
And S3, inquiring report data from a preset database in a concurrent thread execution mode according to the combined query statement to obtain a combined query result of the combined query statement.
In the embodiment of the present invention, before querying report data in a preset database in a concurrent thread execution manner according to the merged query statement, the method further includes: judging whether the number of the combined query statements exceeds a preset threshold value or not, and if the number of the combined query statements does not exceed the preset threshold value, inquiring report data from a preset database in a concurrent thread execution mode according to the combined query statements; and if the number of the combined query statements exceeds a preset threshold value, performing batch processing on the combined query statements, and querying report data from a preset database in a concurrent thread execution mode according to the combined query statements after the batch processing.
The batch processing is to adopt a mode of returning the query results of the merged query statements in batches to ensure that the number of the merged query statements meets a preset threshold value, so that the database can respond to the query of the current merged query statements in time, and if the preset threshold value is 10, the number of the query statements queried from the database by the merged query statements at each time is set to be at most 9 query statements to be executed and returned. It should be noted that, in the process of executing the query result of batch return of the merged query statement, an identifier is added to the data result message returned to the front-end page to indicate that the remaining report data result needs to be obtained by the front-end page.
And executing the query of the report data in a corresponding query mode based on the judgment of whether the number of the combined query sentences exceeds the preset threshold value, so that the query performance of the report data can be further ensured.
Further, in the embodiment of the present invention, the concurrent thread execution is based on the number of the merged query statements, and a corresponding number of threads is created, that is, each thread runs one merged query statement, so as to reduce the response time of the database, and the preset database includes databases such as MySQL, HBASE, DB, and the like.
In detail, the querying report data from a preset database in a concurrent thread execution manner according to the merged query statement to obtain a merged query result of the merged query statement includes: analyzing the combined query statement by using a calcite frame to generate a query node, matching a query object of a report data assembly in the database with the query node, constructing a query logic tree of report data according to the query node and the query object which are successfully matched, performing logic optimization on the query logic tree by using an optimizer in the calcite frame to obtain an optimized query logic tree, and executing the query of the report data by adopting a concurrent thread execution mode according to the optimized query logic tree to obtain a combined query result of the combined query statement.
The calcite framework is used for optimizing the query performance of each query statement, improving the query speed and supporting sql query of various databases, the query node is used for representing the query condition of corresponding report data, the report data component is a component which is configured with a corresponding query object in a database memory in advance, and the query node comprises: and the query logic tree is used for representing the query node sequence of the corresponding report data.
Further, in order to ensure privacy and security of the merged query result, the merged query result may also be stored in a blockchain node.
And S4, decomposing the merged query result to obtain a query result corresponding to the initial query statement.
It should be appreciated that the merged query result corresponds to the merged query statement, and is not the query result in the initial query statement, so that the embodiment of the present invention decomposes the merged query result to generate the query result corresponding to the initial query statement.
In the embodiment of the present invention, decomposing the merged query result to obtain the query result corresponding to the initial query statement includes: counting the number of the query indexes in the initial query statement to obtain the number of the query indexes corresponding to the initial query statement, obtaining the execution query statement corresponding to the combined query result, and executing the decomposition of the combined query result according to the number of the query indexes and the execution query statement to obtain the query result corresponding to the initial query statement.
Illustratively, the initial query statements are Q1 and Q2, the merged query statement is Q3, the query result of Q3 is [ S1, S2, S3], where the execution query statement of Q3 is Q1, Q2 is a query statement that does not need to be executed, and the quantity of query indicators performed on the initial query statement is statistically: the number of S1 was 1, the number of S2 was 2, and the number of S3 was 1. Since Q2 is a query sentence that does not need to be executed, the query result of Q2 is extracted directly from Q3, and the query result of Q2 is obtained [ S2, S3], and further, since Q1 is an execution query sentence, the query indexes extracted by Q2 are sequentially decremented by the number of query indexes, and if the decremented query index is 0, the query index in the query result corresponding to Q3 is deleted, and if the decremented query index is not 0, the query index in the query result corresponding to Q3 is retained as the query result of Q1, that is, [ S1:1-0 ═ 1, S2:2-1 ═ 1, S3:1-1 ═ 0], and the query result of Q1 is generated as [ S1, S2 ].
The embodiment of the invention firstly generates a corresponding initial query statement based on a query identifier and a query object of report data, and combines the initial query statement according to a query index in the initial query statement to obtain a combined query statement so as to combine the query statements with the same query object, thereby reducing the interaction times of the query statements and a database and improving the query speed of the report data; secondly, the invention queries the report data from the database by adopting a query mode of a concurrent thread, so that the response time of the query of the report data can be reduced, and the query performance of the report data is optimized. Therefore, the report data query method provided by the invention can improve the report data query speed.
FIG. 3 is a functional block diagram of the report data query apparatus according to the present invention.
The report data query apparatus 100 according to the present invention can be installed in an electronic device. According to the realized function, the report data query device can comprise a generation module 101, a merging module 102, a query module 103 and a decomposition module 104. A module according to the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the generating module 101 is configured to generate a query identifier and a query object of the report data in response to a query request of the report data.
In the embodiment of the present invention, the report data refers to data that needs to be displayed in a front-end page, and includes: statistical indicators such as banks statistics on asset balance data such as periodic deposits, current deposits, financing, trust by business type, charts such as statistics on individual asset balances by time or region and showing trends in asset balances over time in a line graph, and data lists such as line graphs showing asset balances in the form of data tables (data lists support sorting by tabular columns). Further, the query request is generated based on different user requirements, for example, the requirements of the user a are: and inquiring report data of the steel prices in the south China in the last year.
In one optional embodiment of the present invention, in response to the query request of the report data, the generation module 101 generates the query identifier and the query object of the report data, and is implemented in the following manner:
step I, identifying the query type and query time of the report data of the query request, and establishing a query identifier of the report data according to the query type and query time of the report data;
and step II, acquiring report query indexes and query conditions in the query request, and establishing query objects of the report data according to the report query indexes and the query conditions.
The query identifier is used to represent the uniqueness of the query request, the query object is used to convert into a memory object of a statement of query report data, the report query index refers to report data (such as asset balance) that needs to be queried specifically, and the query condition refers to a query rule that the query index needs to follow, including: screening conditions, paging conditions, pull-down conditions, sorting conditions, and the like. For example, for a query request for "obtaining report data of steel prices in south China in the last year", the query type of the report data may be "steel price query", the query index may be "steel price", and the query condition may be "steel prices in the last year and in south China".
The merging module 102 is configured to generate a corresponding initial query statement according to the query identifier and the query object, and merge the initial query statement according to a query index in the initial query statement to obtain a merged query statement.
In one embodiment of the present invention, the merging module 102 generates a corresponding initial query statement according to the query identifier and the query object, and executes the following steps: and generating id of the query statement according to the query identifier, converting the query object into a query parameter of the query statement by using a preset object conversion program, and generating a corresponding initial query statement according to the id and the query parameter. Optionally, the preset object conversion program is compiled through Java language.
It should be understood that the query of the data to the database is implemented based on query language (SQL), and therefore, the embodiment of the present invention guarantees normal query of the subsequent report data through the initial query statement.
Further, as can be seen from the above S1, query indicators, that is, report data to be queried, exist in the generated initial query statement, such as the initial query statement Q1: select sum (a.c1) x1, sum (a.c2) x2 from a; initial query statement Q2: and (2) select sum (a.c2) x2, sum (a.c3) x3 from a, the query indexes of the Q1 are x1 and x2, and the query indexes of the Q2 are x2 and x 3. Therefore, according to the query indexes in the initial query statement, the initial query statement is combined, so that the frequency of subsequent queries to the database is reduced, and the query performance of report data is improved.
In detail, the merging module 102 merges the initial query statements according to the query indicators in the initial query statements to obtain merged query statements, and executes the following steps: and acquiring a query condition corresponding to the query index, and performing statement merging on the initial query statement with the query condition and the query index consistent to obtain a merged query statement. If the query conditions of Q1 and Q2 are both obtained from "a", then Q3 is generated by combining Q1 and Q2: select sum (a.c1) x1, sum (a.c2) x2, sum (a.c3) x3 from a, then the query statement Q1 can be modified to correspond to the query index list in the query object (e.g., [ S1, S2]) and add [ S3], so as to form a new query index list [ S1, S2, S3], and simultaneously mark that the query object corresponding to the query statement Q2 does not need to be executed, and record the new query index list in the memory in the form of map key value pair of { Q1: [ Q2 … ] }, wherein the modified Q1 represents the query statement identifier that is merged to be executed, and the modified Q2 represents the query statement identifier that does not need to be executed after being merged.
The query module 103 is configured to query, according to the merged query statement, report data from a preset database in a concurrent thread execution manner, so as to obtain a merged query result of the merged query statement.
In an embodiment of the present invention, before querying report data in a preset database by using a concurrent thread execution mode according to the merged query statement, the querying module 103 further includes: judging whether the number of the combined query statements exceeds a preset threshold value or not, and if the number of the combined query statements does not exceed the preset threshold value, inquiring report data from a preset database in a concurrent thread execution mode according to the combined query statements; and if the number of the combined query statements exceeds a preset threshold value, performing batch processing on the combined query statements, and querying report data from a preset database in a concurrent thread execution mode according to the combined query statements after the batch processing.
The batch processing is to adopt a mode of returning the query results of the merged query statements in batches to ensure that the number of the merged query statements meets a preset threshold value, so that the database can respond to the query of the current merged query statements in time, and if the preset threshold value is 10, the number of the query statements queried from the database by the merged query statements at each time is set to be at most 9 query statements to be executed and returned. It should be noted that, in the process of executing the query result of batch return of the merged query statement, an identifier is added to the data result message returned to the front-end page to indicate that the remaining report data result needs to be obtained by the front-end page.
And executing the query of the report data in a corresponding query mode based on the judgment of whether the number of the combined query sentences exceeds the preset threshold value, so that the query performance of the report data can be further ensured.
Further, in the embodiment of the present invention, the concurrent thread execution is based on the number of the merged query statements, and a corresponding number of threads is created, that is, each thread runs one merged query statement, so as to reduce the response time of the database, and the preset database includes databases such as MySQL, HBASE, DB, and the like.
In detail, according to the merged query statement, report data is queried from a preset database in a concurrent thread execution manner to obtain a merged query result of the merged query statement, and the query module 103 is executed in the following manner: analyzing the combined query statement by using a calcite frame to generate a query node, matching a query object of a report data assembly in the database with the query node, constructing a query logic tree of report data according to the query node and the query object which are successfully matched, performing logic optimization on the query logic tree by using an optimizer in the calcite frame to obtain an optimized query logic tree, and executing the query of the report data by adopting a concurrent thread execution mode according to the optimized query logic tree to obtain a combined query result of the combined query statement.
The calcite framework is used for optimizing the query performance of each query statement, improving the query speed and supporting sql query of various databases, the query node is used for representing the query condition of corresponding report data, the report data component is a component which is configured with a corresponding query object in a database memory in advance, and the query node comprises: and the query logic tree is used for representing the query node sequence of the corresponding report data.
Further, in order to ensure privacy and security of the merged query result, the merged query result may also be stored in a blockchain node.
The decomposition module 104 is configured to decompose the merged query result to obtain a query result corresponding to the initial query statement.
It should be appreciated that the merged query result corresponds to the merged query statement, and is not the query result in the initial query statement, so that the embodiment of the present invention decomposes the merged query result to generate the query result corresponding to the initial query statement.
In the embodiment of the present invention, the merged query result is decomposed to obtain a query result corresponding to the initial query statement, and the decomposition module 104 is implemented in the following manner: counting the number of the query indexes in the initial query statement to obtain the number of the query indexes corresponding to the initial query statement, obtaining the execution query statement corresponding to the combined query result, and executing the decomposition of the combined query result according to the number of the query indexes and the execution query statement to obtain the query result corresponding to the initial query statement.
Illustratively, the initial query statements are Q1 and Q2, the merged query statement is Q3, the query result of Q3 is [ S1, S2, S3], where the execution query statement of Q3 is Q1, Q2 is a query statement that does not need to be executed, and the quantity of query indicators performed on the initial query statement is statistically: the number of S1 was 1, the number of S2 was 2, and the number of S3 was 1. Since Q2 is a query sentence that does not need to be executed, the query result of Q2 is extracted directly from Q3, and the query result of Q2 is obtained [ S2, S3], and further, since Q1 is an execution query sentence, the query indexes extracted by Q2 are sequentially decremented by the number of query indexes, and if the decremented query index is 0, the query index in the query result corresponding to Q3 is deleted, and if the decremented query index is not 0, the query index in the query result corresponding to Q3 is retained as the query result of Q1, that is, [ S1:1-0 ═ 1, S2:2-1 ═ 1, S3:1-1 ═ 0], and the query result of Q1 is generated as [ S1, S2 ].
The embodiment of the invention firstly generates a corresponding initial query statement based on a query identifier and a query object of report data, and combines the initial query statement according to a query index in the initial query statement to obtain a combined query statement so as to combine the query statements with the same query object, thereby reducing the interaction times of the query statements and a database and improving the query speed of the report data; secondly, the invention queries the report data from the database by adopting a query mode of a concurrent thread, so that the response time of the query of the report data can be reduced, and the query performance of the report data is optimized. Therefore, the report data query device provided by the invention can improve the speed of report data query.
Fig. 4 is a schematic structural diagram of an electronic device implementing the report data query method according to the present invention.
The electronic device 1 may include a processor 10, a memory 11 and a bus, and may further include a computer program, such as a report data query program 12, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, which includes flash memory, removable hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a removable hard disk of the electronic device 1. The memory 11 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 may be used not only to store application software installed in the electronic device 1 and various types of data, such as codes for querying report data, but also to temporarily store data that has been output or will be output.
The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the whole electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device 1 by running or executing programs or modules (for example, executing the report data query program 12, etc.) stored in the memory 11 and calling data stored in the memory 11.
The bus may be 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. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like.
Fig. 4 only shows an electronic device with components, and it will be understood by those skilled in the art that the structure shown in fig. 4 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than those shown, or some components may be combined, or a different arrangement of components.
For example, although not shown, the electronic device 1 may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so as to implement functions of charge management, discharge management, power consumption management, and the like through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device 1 may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
Further, the electronic device 1 may further include a network interface, and optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a bluetooth interface, etc.), which are generally used for establishing a communication connection between the electronic device 1 and other electronic devices.
Optionally, the electronic device 1 may further comprise a user interface, which may be a Display (Display), an input unit (such as a Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable for displaying information processed in the electronic device 1 and for displaying a visualized user interface, among other things.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The report data query program 12 stored in the memory 11 of the electronic device 1 is a combination of a plurality of computer programs, and when running in the processor 10, can implement:
responding to a query request of report data, and generating a query identifier and a query object of the report data;
generating corresponding initial query statements according to the query identification and the query object, and combining the initial query statements according to query indexes in the initial query statements to obtain combined query statements;
inquiring report data from a preset database in a concurrent thread execution mode according to the combined query statement to obtain a combined query result of the combined query statement;
and decomposing the merged query result to obtain a query result corresponding to the initial query statement.
Specifically, the processor 10 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1 for a specific implementation method of the computer program, which is not described herein again.
Further, the integrated modules/units of the electronic device 1, if implemented in the form of software functional units and sold or used as separate products, may be stored in a non-volatile computer-readable storage medium. The computer readable storage medium may be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
The present invention also provides a computer-readable storage medium, storing a computer program which, when executed by a processor of an electronic device, may implement:
responding to a query request of report data, and generating a query identifier and a query object of the report data;
generating corresponding initial query statements according to the query identification and the query object, and combining the initial query statements according to query indexes in the initial query statements to obtain combined query statements;
inquiring report data from a preset database in a concurrent thread execution mode according to the combined query statement to obtain a combined query result of the combined query statement;
and decomposing the merged query result to obtain a query result corresponding to the initial query statement.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A report data query method is characterized by comprising the following steps:
responding to a query request of report data, and generating a query identifier and a query object of the report data;
generating corresponding initial query statements according to the query identification and the query object, and combining the initial query statements according to query indexes in the initial query statements to obtain combined query statements;
inquiring report data from a preset database in a concurrent thread execution mode according to the combined query statement to obtain a combined query result of the combined query statement;
and decomposing the merged query result to obtain a query result corresponding to the initial query statement.
2. The report data query method of claim 1, wherein the generating the query identifier and the query object of the report data in response to the query request of the report data comprises:
identifying the query type and query time of the report data of the query request, and establishing a query identifier of the report data according to the query type and query time of the report data;
and acquiring report query indexes and query conditions in the query request, and establishing query objects of the report data according to the report query indexes and the query conditions.
3. The report data query method of claim 1, wherein the generating of the corresponding initial query statement according to the query identifier and the query object comprises:
generating id of a query statement according to the query identifier, and converting the query object into a query parameter of the query statement;
and generating a corresponding initial query statement according to the id and the query parameter.
4. The report data query method of claim 1, wherein the merging the initial query statements according to the query indicators in the initial query statements to obtain merged query statements, comprises:
acquiring a query condition corresponding to the query index;
and carrying out statement merging on the initial query statements with the consistent query conditions and query indexes to obtain merged query statements.
5. The report data query method according to claim 1, wherein before querying the report data in the preset database in a concurrent thread execution manner according to the merged query statement, the method further comprises:
judging whether the number of the combined query sentences exceeds a preset threshold value;
if the number of the combined query statements does not exceed a preset threshold, inquiring report data from a preset database in a concurrent thread execution mode according to the combined query statements;
and if the number of the combined query statements exceeds a preset threshold value, performing batch processing on the combined query statements, and querying report data from a preset database in a concurrent thread execution mode according to the combined query statements after the batch processing.
6. The report data query method according to claim 1, wherein the querying report data from a preset database by using a concurrent thread execution mode according to the merged query statement to obtain the merged query result of the merged query statement comprises:
analyzing the combined query statement to generate a query node, and matching a query object of a report data component in the database with the query node;
constructing a query logic tree of report data according to the query nodes and the query objects which are successfully matched, and carrying out logic optimization on the query logic tree to obtain an optimized query logic tree;
and executing the query of the report data by adopting a concurrent thread execution mode according to the optimized query logic tree to obtain a combined query result of the combined query statement.
7. The report data query method according to any one of claims 1 to 6, wherein the decomposing the merged query result to obtain the query result corresponding to the initial query statement comprises:
counting the number of the query indexes in the initial query statement to obtain the number of the query indexes corresponding to the initial query statement;
acquiring an execution query statement corresponding to the combined query result;
and according to the query index number and the execution query statement, executing the decomposition of the combined query result to obtain a query result corresponding to the initial query statement.
8. A report data query apparatus, the apparatus comprising:
the generating module is used for responding to a query request of the report data and generating a query identifier and a query object of the report data;
the merging module is used for generating a corresponding initial query statement according to the query identifier and the query object, and merging the initial query statement according to a query index in the initial query statement to obtain a merged query statement;
the query module is used for querying report data to a preset database in a concurrent thread execution mode according to the combined query statement to obtain a combined query result of the combined query statement;
and the decomposition module is used for decomposing the merged query result to obtain a query result corresponding to the initial query statement.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the report data query method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the report data query method according to any one of claims 1 to 7.
CN202110449735.2A 2021-04-25 2021-04-25 Report data query method and device, electronic equipment and storage medium Pending CN113064928A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110449735.2A CN113064928A (en) 2021-04-25 2021-04-25 Report data query method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110449735.2A CN113064928A (en) 2021-04-25 2021-04-25 Report data query method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113064928A true CN113064928A (en) 2021-07-02

Family

ID=76568237

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110449735.2A Pending CN113064928A (en) 2021-04-25 2021-04-25 Report data query method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113064928A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105740344A (en) * 2016-01-25 2016-07-06 中国科学院计算技术研究所 Sql statement combination method and system independent of database
CN107220376A (en) * 2017-06-21 2017-09-29 北京奇艺世纪科技有限公司 A kind of data query method and apparatus
CN109299133A (en) * 2017-07-24 2019-02-01 迅讯科技(北京)有限公司 Data query method, computer system and non-transitory computer-readable medium
CN109977137A (en) * 2019-02-22 2019-07-05 视联动力信息技术股份有限公司 A kind of data query method and apparatus
CN111221860A (en) * 2018-11-27 2020-06-02 北京奇虎科技有限公司 Mixed query optimization method and device based on big data

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105740344A (en) * 2016-01-25 2016-07-06 中国科学院计算技术研究所 Sql statement combination method and system independent of database
CN107220376A (en) * 2017-06-21 2017-09-29 北京奇艺世纪科技有限公司 A kind of data query method and apparatus
CN109299133A (en) * 2017-07-24 2019-02-01 迅讯科技(北京)有限公司 Data query method, computer system and non-transitory computer-readable medium
CN111221860A (en) * 2018-11-27 2020-06-02 北京奇虎科技有限公司 Mixed query optimization method and device based on big data
CN109977137A (en) * 2019-02-22 2019-07-05 视联动力信息技术股份有限公司 A kind of data query method and apparatus

Similar Documents

Publication Publication Date Title
CN112052242A (en) Data query method and device, electronic equipment and storage medium
CN111428458A (en) Universal report generation method and device and computer readable storage medium
CN111813963A (en) Knowledge graph construction method and device, electronic equipment and storage medium
CN112115152B (en) Data increment updating and inquiring method and device, electronic equipment and storage medium
CN112115143A (en) Automatic data updating and synchronizing method and device, electronic equipment and storage medium
CN112115145A (en) Data acquisition method and device, electronic equipment and storage medium
CN111897831A (en) Service message generation method and device, electronic equipment and storage medium
CN112418798A (en) Information auditing method and device, electronic equipment and storage medium
CN112883042A (en) Data updating and displaying method and device, electronic equipment and storage medium
CN111651439A (en) Data auditing method and device and computer readable storage medium
CN111897856A (en) Supervision message generation method and device, electronic equipment and readable storage medium
CN111428451A (en) Text online editing method and device, electronic equipment and storage medium
CN114185895A (en) Data import and export method and device, electronic equipment and storage medium
CN111651453A (en) User historical behavior query method and device, electronic equipment and storage medium
CN112579621A (en) Data display method and device, electronic equipment and computer storage medium
CN113722533B (en) Information pushing method and device, electronic equipment and readable storage medium
WO2022048362A1 (en) Data storage method and apparatus, electronic device, and storage medium
CN112948380A (en) Data storage method and device based on big data, electronic equipment and storage medium
CN113468175A (en) Data compression method and device, electronic equipment and storage medium
CN112580079A (en) Authority configuration method and device, electronic equipment and readable storage medium
CN112464619A (en) Big data processing method, device and equipment and computer readable storage medium
CN115794804A (en) Engineering internal control data visualization processing system and method based on big data technology
CN111553133B (en) Report generation method and device, electronic equipment and storage medium
CN113064928A (en) Report data query method and device, electronic equipment and storage medium
CN114490137A (en) Service data real-time statistical method and device, electronic equipment and readable 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
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40051228

Country of ref document: HK

RJ01 Rejection of invention patent application after publication

Application publication date: 20210702

RJ01 Rejection of invention patent application after publication