CN108170860A - Data query method, apparatus, electronic equipment and computer readable storage medium - Google Patents
Data query method, apparatus, electronic equipment and computer readable storage medium Download PDFInfo
- Publication number
- CN108170860A CN108170860A CN201810060918.3A CN201810060918A CN108170860A CN 108170860 A CN108170860 A CN 108170860A CN 201810060918 A CN201810060918 A CN 201810060918A CN 108170860 A CN108170860 A CN 108170860A
- Authority
- CN
- China
- Prior art keywords
- query
- data
- inquiry request
- data inquiry
- requesting party
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2458—Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
- G06F16/2471—Distributed queries
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2453—Query optimisation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- General Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Computational Linguistics (AREA)
- Fuzzy Systems (AREA)
- Mathematical Physics (AREA)
- Probability & Statistics with Applications (AREA)
- Software Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the present disclosure discloses a kind of data query method, apparatus, electronic equipment and computer readable storage medium.The method includes:Receive data inquiry request;Determine the complexity of the corresponding inquiry operation of the data inquiry request;When the complexity of the inquiry operation is no more than predetermined threshold value, the data inquiry request is submitted into query engine.Disclosure embodiment, it can be reviewed before data inquiry request reaches query engine, when the concurrency that query engine blocking will likely be caused or query engine performance is caused to decline to a great extent operates, the data inquiry request is prevented to be submitted to query engine, greatly improves the stability and concurrency of query engine.
Description
Technical field
This disclosure relates to field of computer technology, and in particular to a kind of data query method, apparatus, electronic equipment and calculating
Machine readable storage medium storing program for executing.
Background technology
In the inquiry scene of big data, back-end services are more MPP (massively parallel
Processing) Distributed Services, and big data is it is emphasised that the scene On Line Analysis Process of weight analysis, and business scenario
It is more Transaction Processing (On line Transaction Processing, OLTP).
And it is higher for the general complexity of the inquiry of analysis, it is being needed for (engine) (user SQL or other inquiries API)
When resource is asymmetric, it finds that engine may be blocked by the inquiry scene of part or cause it is concurrent serious under
Drop.
Invention content
The embodiment of the present disclosure provides a kind of data query method, apparatus, electronic equipment and computer readable storage medium.
In a first aspect, a kind of data query method is provided in the embodiment of the present disclosure.
Specifically, the data query method, including:
Receive data inquiry request;
Determine the complexity of the corresponding inquiry operation of the data inquiry request;
When the complexity of the inquiry operation is no more than predetermined threshold value, the data inquiry request is submitted into inquiry and is drawn
It holds up.
With reference to first aspect, the disclosure determines the data inquiry request in the first realization method of first aspect
Before the complexity of corresponding inquiry operation, further include:
Verify the permission of the requesting party of the data inquiry request.
The first realization method with reference to first aspect verifies the permission of the requesting party of the data inquiry request, including
At least one of:
The legitimacy of the requesting party is verified according to the authentication information carried in the data inquiry request;
The query resource of the requesting party is submitted in authentication information verification according to being carried in the data inquiry request
Surplus;
The authentication information verification carried according to the data inquiry request submits the requesting party for the inquiry
The operating right of engine.
With reference to first aspect, the disclosure determines the data inquiry request in second of realization method of first aspect
The complexity of corresponding inquiry operation, including:
The query steps of the inquiry operation are determined according to the data inquiry request;
The operation score of the query steps is determined according to preset rules;
The complexity is determined according to the operation score.
With reference to first aspect, the first realization method of first aspect or second of realization method of first aspect, this public affairs
It is opened in the third realization method of first aspect, further includes:
When the complexity of the inquiry operation is more than the predetermined threshold value, to the request for submitting the data inquiry request
Side returns to query failure message.
With reference to first aspect, the first realization method of first aspect or second of realization method of first aspect, this public affairs
It is opened in the 4th kind of realization method of first aspect, after the data inquiry request is submitted to query engine, further includes:
Receive the query result that the query engine returns;
Determine whether the query result meets the resource quota for the requesting party for submitting the data inquiry request;
When the query result is unsatisfactory for the resource quota, query failure message is returned to the requesting party.
With reference to first aspect, the first realization method of first aspect or second of realization method of first aspect, this public affairs
It is opened in the 5th kind of realization method of first aspect, further includes:
In query process, practice condition of the query engine for the inquiry operation is obtained;
Determine whether the practice condition meets preset condition.
The 5th kind of realization method with reference to first aspect, the disclosure are also wrapped in the 6th kind of realization method of first aspect
It includes:
When the practice condition is unsatisfactory for preset condition, is sent to the query engine and terminate asking for the inquiry operation
It asks.
Second aspect, the embodiment of the present disclosure provide a kind of data query arrangement, including:
First receiving module is configured as receiving data inquiry request;
First determining module is configured to determine that the complexity of the corresponding inquiry operation of the data inquiry request;
Module is submitted, is configured as, when the complexity of the inquiry operation is no more than predetermined threshold value, the data being looked into
It askes request and submits to query engine.
With reference to second aspect, the disclosure is in the first realization method of second aspect, before first determining module,
It further includes:
Authentication module is configured to verify that the permission of the requesting party of the data inquiry request.
With reference to the first realization method of second aspect, the authentication module, including at least one of:
First verification submodule, is configured as verifying institute according to the authentication information carried in the data inquiry request
State the legitimacy of requesting party;
Second verification submodule is configured as being carried according to the authentication information verification carried in the data inquiry request
Hand over the query resource surplus of the requesting party;
Third verifies submodule, is configured as being verified according to the authentication information that the data inquiry request carries and submit
The requesting party is for the operating right of the query engine.
With reference to second aspect, the disclosure is in second of realization method of second aspect, first determining module, packet
It includes:
First determination sub-module is configured as determining that the inquiry of the inquiry operation walks according to the data inquiry request
Suddenly;
Second determination sub-module is configured as determining the operation score of the query steps according to preset rules;
Third determination sub-module is configured as determining the complexity according to the operation score.
With reference to the first realization method of second aspect, second aspect or second of realization method of second aspect, this public affairs
It is opened in the third realization method of second aspect, further includes:
First returns to module, is configured as when the complexity of the inquiry operation is more than the predetermined threshold value, to submission
The requesting party of the data inquiry request returns to query failure message.
With reference to the first realization method of second aspect, second aspect or second of realization method of second aspect, this public affairs
It is opened in the 4th kind of realization method of second aspect, after the submission module, further includes:
Second receiving module is configured as receiving the query result that the query engine returns;
Second determining module is configured to determine that whether the query result meets and submits asking for the data inquiry request
The resource quota for the side of asking;
Second returns to module, is configured as when the query result is unsatisfactory for the resource quota, to the requesting party
Return to query failure message.
With reference to the first realization method of second aspect, second aspect or second of realization method of second aspect, this public affairs
It is opened in the 5th kind of realization method of second aspect, further includes:
Acquisition module is configured as in query process, obtains execution of the query engine for the inquiry operation
Situation;
Third determining module, is configured to determine that whether the practice condition meets preset condition.
With reference to the 5th kind of realization method of second aspect, the disclosure is also wrapped in the 6th kind of realization method of second aspect
It includes:
Sending module is configured as when the practice condition is unsatisfactory for preset condition, is sent eventually to the query engine
The only request of the inquiry operation.
The function by hardware can also be performed corresponding software and be realized by hardware realization.The hardware or
Software includes the one or more and corresponding module of above-mentioned function.
In a possible design, the structure of data query arrangement includes memory and processor, the memory
Data query arrangement is supported to perform the computer instruction of data query method in above-mentioned first aspect for storing one or more,
The processor is configurable for performing the computer instruction stored in the memory.The data query arrangement can be with
Including communication interface, for data query arrangement and other equipment or communication.
The third aspect, the embodiment of the present disclosure provide a kind of electronic equipment, including memory and processor;Wherein, it is described
Memory is used to store one or more computer instruction, wherein, one or more computer instruction is by the processor
It performs to realize the method and step described in first aspect.
Fourth aspect, the embodiment of the present disclosure provide a kind of computer readable storage medium, for storing data query dress
Computer instruction used is put, it includes refer to for performing the computer in above-mentioned first aspect involved by data query method
It enables.
The technical solution that the embodiment of the present disclosure provides can include the following benefits:
The embodiment of the present disclosure between data inquiry request side and query engine side by setting a set of data query access
Device calculates, and determined according to complexity for inquiry operation complexity corresponding to the data inquiry request received
Whether the data inquiry request is supplied to query engine.By disclosure embodiment, can be reached in data inquiry request
It is reviewed before query engine, it would be possible to the concurrency that query engine is caused to block or query engine performance is caused to decline to a great extent
During operation, the data inquiry request is prevented to be submitted to query engine, greatly improve the stability and concurrency of query engine.
It should be understood that above general description and following detailed description are only exemplary and explanatory, not
The disclosure can be limited.
Description of the drawings
With reference to attached drawing, by the detailed description of following non-limiting embodiment, the other feature of the disclosure, purpose and excellent
Point will be apparent.In the accompanying drawings:
Fig. 1 shows the flow chart of the data query method according to one embodiment of the disclosure;
Fig. 2 shows the flow charts of the step S102 of embodiment according to Fig. 1;
Fig. 3 is shown according to the flow being detected in one embodiment of the disclosure to the query result that query engine returns
Figure;
Fig. 4 is shown according to being monitored in query process to query engine practice condition in one embodiment of the disclosure
Flow chart;
Fig. 5 shows the structure diagram according to data query in one embodiment of the disclosure;
Fig. 6 shows the structure diagram of the first determining module 502 according to Fig. 5 illustrated embodiments;
Fig. 7 shows to be detected the structure of part according to the query result that one embodiment of the disclosure returns to query engine
Block diagram;
Fig. 8 shows to be monitored part to query engine practice condition in query process according to one embodiment of the disclosure
Structure diagram;
The structure that Fig. 9 is adapted for the electronic equipment for realizing the data query method according to one embodiment of the disclosure is shown
It is intended to.
Specific embodiment
Hereinafter, the illustrative embodiments that the disclosure will be described in detail with reference to the attached drawings, so that those skilled in the art can
Easily realize them.In addition, for the sake of clarity, the portion unrelated with description illustrative embodiments is omitted in the accompanying drawings
Point.
In the disclosure, it should be appreciated that the term of " comprising " or " having " etc. is intended to refer to disclosed in this specification
Feature, number, step, behavior, the presence of component, part or combination, and be not intended to exclude other one or more features,
Number, step, behavior, component, part or combination there is a possibility that or be added.
It also should be noted that in the absence of conflict, the feature in embodiment and embodiment in the disclosure
It can be combined with each other.The disclosure is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 shows the flow chart of the data query method according to one embodiment of the disclosure.As shown in Figure 1, the data
Querying method includes the following steps S101-S103:
In step S101, data inquiry request is received;
In step s 102, the complexity of the corresponding inquiry operation of the data inquiry request is determined;
It in step s 103, please by the data query when the complexity of the inquiry operation is no more than predetermined threshold value
It asks and submits to query engine.
In prior art, user, which either services, initiates data inquiry request later by assembling SQL or API Calls
Mode is submitted directly to query engine;Query engine is after data inquiry request is received, by being tied after a series of inquiries
Fruit feeds back to user or service.However the mode of this direct-connected query engine, it is not easy to Authority Verification;And unconfined general
Data inquiry request submits to query engine, and the stability and service concurrency that can lead to query engine are had a greatly reduced quality.
A set of inquiry access device is provided in the present embodiment, between the requesting party of data inquiry request and query engine,
So that data inquiry request is subjected to an examination before query engine is submitted, to avoid that query engine will be caused to be blocked or concurrency
Impacted data inquiry request submits to query engine, improves the safety of query engine, ensure that query engine is higher
Stability and concurrency.
The complexity of data inquiry request can be analyzed, and then be directed to by the query steps to data inquiry request
The difficulty of operation involved by each query steps and occupied engine resource etc. are given a mark, and finally obtain data query
The complexity of request.For example, for the SQL query statement of database, can analyze wherein whether comprising polymerization, scanning,
The operations such as Union, Join, and pass through the complexity that the score that analysis result determines corresponding to different operation determines SQL query statement
Degree;The corresponding score of different operation can be according to the run time of experience before or query engine to the operation, shared money
Source etc. carries out comprehensive marking, and pre-set.
In the present embodiment, when the complexity of inquiry operation is no more than predetermined threshold value, which is supplied to
Query engine performs corresponding inquiry operation by query engine.Predetermined threshold value can be determining according to performance of query engine etc., example
Such as, the complexity for the inquiry operation for occupying 85% performance resource of query engine can be set as predetermined threshold value, to avoid excessively
Complicated inquiry operation causes the performance degradation of query engine.
In one optional realization method of the present embodiment, the step S102 determines that the data inquiry request corresponds to
Inquiry operation complexity the step of before, it is further comprising the steps of:
Verify the permission of the requesting party of the data inquiry request.
In the optional realization method, access device also verifies the permission of the requesting party of data inquiry request.
Modes can be called etc. by remote interface by the inquiry request of access device to interact rather than traditional JDBC, ODBC
Interactive mode, therefore interaction when, that is, submit data inquiry request when, authentication information can be carried.Access device can
With according to the permission of authentication information checking request side carried in data inquiry request, different requesting parties can have difference
Permission.For example, a requesting party authorized can call the interface of access device to submit data query please to query engine
It asks, and the requesting party of unauthorized is unavailable to query engine submission data inquiry request.Data inquiry request can carry token,
User, password or other identity identification informations;The address of service of access device can also be carried;The waiting mode of query result
(either synchronously or asynchronously), other additional informations etc..
In one optional realization method of the present embodiment, the step of the permission of the requesting party of the data inquiry request is verified
At least one of suddenly, include the following steps:
The legitimacy of the requesting party is verified according to the authentication information carried in the data inquiry request;
The query resource of the requesting party is submitted in authentication information verification according to being carried in the data inquiry request
Surplus;
The authentication information verification carried according to the data inquiry request submits the requesting party for the inquiry
The operating right of engine.
In the optional realization method, the authentication information of data inquiry request can include requesting party user name,
Password etc., access device can determine whether the requesting party is validated user according to information such as the usemame/passwords.Access fills
The query resource surplus of the requesting party can also be determined according to the user name of requesting party by putting.Query resource surplus is used to identify
Whether the query resource that requesting party can obtain also has surplus, such as the day inquiry times etc. of user.Access device can be with root
The identity informations such as the user name according to requesting party determine that the requesting party is capable of the operating right of action queries engine, such as passes through analysis
The specific library table to be accessed being related in SQL statement or the data inquiry request of submission and corresponding field, and with this
The authorization message of requesting party, which checks whether to have permission, checks these corresponding database tables and corresponding field etc..It is appreciated that
It is that when verification, can only verify one kind in above-mentioned three kinds of modes, a variety of can also simultaneously verify.Requesting party is legal
Property and query resource surplus verification mode, can be in the complexity for calculating inquiry operation due to the intervention without query engine
It is carried out before degree, if verification does not pass through, directly can return to failure information to requesting party;Calculate inquiry again if the verification passes
The complexity of operation;And verify that the mode of user's operation permission is determined due to needing by query engine, it can calculate
It is determined again after the complexity of inquiry operation, the interaction with query engine can be reduced in this way, time and resource can be saved.
In one optional realization method of the present embodiment, as shown in Fig. 2, the step S102, that is, determine that the data are looked into
The step of asking the complexity for asking corresponding inquiry operation, further comprises the steps S201-S203:
In step s 201, the query steps of the inquiry operation are determined according to the data inquiry request;
In step S202, the operation score of the query steps is determined according to preset rules;
In step S203, the complexity is determined according to the operation score.
In the optional realization method, in the optional realization method, for the inquiry operation of a data inquiry request
It may need to complete by multiple queries step, and the operation that each step is related to is required for the money for spending query engine certain
Source, the number to be scanned in the data partition number scanned including query time, committed memory, needs and each data partition
It according to number etc., can give a mark to different operation previously according to the resource needed for different operation, actually calculate again later
It is miscellaneous to be given a mark by these pre-set operation scores to query steps when spending, it is true eventually by the score of query steps
Determine the complexity of data inquiry request.
Illustrate by taking the data inquiry request of SQL statement as an example below.It, all can shape in query engine for data inquiry request
Into inquiry plan, this inquiry plan is exactly the analysis to the multiple queries step of query process, for example polymerize, scan,
The operations such as Union, Join.An exemplary SQL data inquiry requests sentence is shown in table 1:
Table 1
The inquiry plan of formation can be analyzed as shown in table 2:
Table 2
As can be seen from the above table, the SQL statement in above-mentioned data inquiry request is related to multiple behaviour as shown above in total
Make item, can be finally obtained according to pre-defined action-item score, the data scanning number of partitions, data partition scanning number etc.
The complexity of data inquiry request.
In an optional realization method of the present embodiment, data query method is further comprising the steps of:
When the complexity of the inquiry operation is more than the predetermined threshold value, to the request for submitting the data inquiry request
Side returns to query failure message.
In the optional realization method, if by analyzing data inquiry request, determine that the data inquiry request is corresponding
The complexity of inquiry operation has been more than pre-set threshold value, may cause shadow to the stability and concurrency of query engine
It rings, at this moment can directly refuse the data inquiry request of requesting party, and export the information of inquiry failure.
In one optional realization method of the present embodiment, as shown in figure 3, the step S103, i.e., by the data query
After the step of query engine is submitted in request, further comprise the steps S301-S303:
In step S301, the query result that the query engine returns is received;
In step s 302, determine whether the query result meets the money for the requesting party for submitting the data inquiry request
Source quota;
In step S303, when the query result is unsatisfactory for the resource quota, returns and inquire to the requesting party
Failure information.
In the optional realization method, the data inquiry request for meeting access device admittable regulation is submitted into query engine
Afterwards, query engine returns to query result after inquiry operation is completed to access device.Access device is receiving query result
Afterwards, it can also determine whether query result meets the resource quota of requesting party according to the identity information of requesting party, such as check and work as
Whether preceding query result meets the admittance restrictions such as single dominant record number, day maximum Record to return, ties inquiry if met
Fruit returns to requesting party, otherwise returns to query failure message.
Access device can pass through the packaged type of structuring or flow data shape when returning to query result to requesting party
Query result is returned to requesting party by formula, can be returned the result by way of synchronous return or asynchronism callback.It is specific to use
Asynchronous return or synchronous return, requesting party can carry required return in the request when proposing data inquiry request
Mode, if asynchronous return, it is also necessary to asynchronism callback address is carried in data inquiry request, access device will inquire knot
When fruit returns to requesting party, by the way that asynchronism callback address is called to return.Synchronous mode can then block requesting query to instead always
Present result.
In one optional realization method of the present embodiment, as shown in figure 4, the further comprising the steps of 401- of the method
S402:
In step S401, in query process, practice condition of the query engine for the inquiry operation is obtained;
In step S402, determine whether the practice condition meets preset condition.
In the optional realization method, access device can also after data inquiry request is submitted to query engine,
In query engine operational process, practice condition of the query engine for the data inquiry request is obtained, practice condition is included but not
It is limited to the maximum duration of inquiry, inquires scanned data volume, the occupied memory of inquiry etc..Access device can be periodic
It checks practice condition of the query engine for data inquiry request, and is determining query engine during inquiry operation is performed
The resource used is more than to be expected.In this way, can in query process the stability of monitoring and inquiry engine and concurrent
Property.
In one optional realization method of the present embodiment, the method is further comprising the steps of:
When the practice condition is unsatisfactory for preset condition, is sent to the query engine and terminate asking for the inquiry operation
It asks.
In the optional realization method, in query process, access device is periodically detected the practice condition of query engine,
If it is determined that not meeting expection, then current queries operation can be terminated, and the information of inquiry failure is returned to requesting party.Pass through this
Kind mode can have found that it is likely that the factor that query engine stability and concurrency can be caused to decline, and terminate current queries in time
Operation, in order to avoid cause serious consequence.
Following is embodiment of the present disclosure, can be used for performing embodiments of the present disclosure.
Fig. 5 shows the structure diagram of the data query arrangement according to one embodiment of the disclosure, which can be by soft
Part, hardware or both are implemented in combination with as some or all of of electronic equipment.As shown in figure 5, the data query dress
It puts including the first receiving module 501, the first determining module 502 and submits module 503:
First receiving module 501 is configured as receiving data inquiry request;
First determining module 502 is configured to determine that the complexity of the corresponding inquiry operation of the data inquiry request;
Module 503 is submitted, is configured as when the complexity of the inquiry operation is no more than predetermined threshold value, by the data
Inquiry request submits to query engine.
In prior art, user, which either services, initiates data inquiry request later by assembling SQL or API Calls
Mode is submitted directly to query engine;Query engine is after data inquiry request is received, by being tied after a series of inquiries
Fruit feeds back to user or service.However the mode of this direct-connected query engine, it is not easy to Authority Verification;And unconfined general
Data inquiry request submits to query engine, and the stability and service concurrency that can lead to query engine are had a greatly reduced quality.
A set of inquiry access device is provided in the present embodiment, between the requesting party of data inquiry request and query engine,
So that data inquiry request is subjected to an examination before query engine is submitted, to avoid that query engine will be caused to be blocked or concurrency
Impacted data inquiry request submits to query engine, improves the safety of query engine, ensure that query engine is higher
Stability and concurrency.Data query arrangement can be the access device or a part for the access device.
The complexity of data inquiry request can be analyzed, and then be directed to by the query steps to data inquiry request
The difficulty of operation involved by each query steps and occupied engine resource etc. are given a mark, and finally obtain data query
The complexity of request.For example, for the SQL query statement of database, can analyze wherein whether comprising polymerization, scanning,
The operations such as Union, Join, and pass through the complexity that the score that analysis result determines corresponding to different operation determines SQL query statement
Degree;The corresponding score of different operation can be according to the run time of experience before or query engine to the operation, shared money
Source etc. carries out comprehensive marking, and pre-set.
In the present embodiment, when the complexity of inquiry operation is no more than predetermined threshold value, which is supplied to
Query engine performs corresponding inquiry operation by query engine.Predetermined threshold value can be determining according to performance of query engine etc., example
Such as, the complexity for the inquiry operation for occupying 85% performance resource of query engine can be set as predetermined threshold value, to avoid excessively
Complicated inquiry operation causes the performance degradation of query engine.
In one optional realization method of the present embodiment, before first determining module 502, further include:
Authentication module is configured to verify that the permission of the requesting party of the data inquiry request.
In the optional realization method, access device also verifies the permission of the requesting party of data inquiry request.
Modes can be called etc. by remote interface by the inquiry request of access device to interact rather than traditional JDBC, ODBC
Interactive mode, therefore interaction when, that is, submit data inquiry request when, authentication information can be carried.Access device can
With according to the permission of authentication information checking request side carried in data inquiry request, different requesting parties can have difference
Permission.For example, a requesting party authorized can call the interface of access device to submit data query please to query engine
It asks, and the requesting party of unauthorized is unavailable to query engine submission data inquiry request.Data inquiry request can carry token,
User, password or other identity identification informations;The address of service of access device can also be carried;The waiting mode of query result
(either synchronously or asynchronously), other additional informations etc..
In one optional realization method of the present embodiment, the authentication module, including at least one of:
First verification submodule, is configured as verifying institute according to the authentication information carried in the data inquiry request
State the legitimacy of requesting party;
Second verification submodule is configured as being carried according to the authentication information verification carried in the data inquiry request
Hand over the query resource surplus of the requesting party;
Third verifies submodule, is configured as being verified according to the authentication information that the data inquiry request carries and submit
The requesting party is for the operating right of the query engine.
In the optional realization method, the authentication information of data inquiry request can include requesting party user name,
Password etc., access device can determine whether the requesting party is validated user according to information such as the usemame/passwords.Access fills
The query resource surplus of the requesting party can also be determined according to the user name of requesting party by putting.Query resource surplus is used to identify
Whether the query resource that requesting party can obtain also has surplus, such as the day inquiry times etc. of user.Access device can be with root
The identity informations such as the user name according to requesting party determine that the requesting party is capable of the operating right of action queries engine, such as passes through analysis
The specific library table to be accessed being related in SQL statement or the data inquiry request of submission and corresponding field, and with this
The authorization message of requesting party, which checks whether to have permission, checks these corresponding database tables and corresponding field etc..It is appreciated that
It is that when verification, can only verify one kind in above-mentioned three kinds of modes, a variety of can also simultaneously verify.Requesting party is legal
Property and query resource surplus verification mode, can be in the complexity for calculating inquiry operation due to the intervention without query engine
It is carried out before degree, if verification does not pass through, directly can return to failure information to requesting party;Calculate inquiry again if the verification passes
The complexity of operation;And verify that the mode of user's operation permission is determined due to needing by query engine, it can calculate
It is determined again after the complexity of inquiry operation, the interaction with query engine can be reduced in this way, time and resource can be saved.
In one optional realization method of the present embodiment, as shown in fig. 6, first determining module 502, including:
First determination sub-module 601 is configured as determining the inquiry of the inquiry operation according to the data inquiry request
Step;
Second determination sub-module 602 is configured as determining the operation score of the query steps according to preset rules;
Third determination sub-module 603 is configured as determining the complexity according to the operation score.
In the optional realization method, in the optional realization method, for the inquiry operation of a data inquiry request
It may need to complete by multiple queries step, and the operation that each step is related to is required for the money for spending query engine certain
Source, the number to be scanned in the data partition number scanned including query time, committed memory, needs and each data partition
It according to number etc., can give a mark to different operation previously according to the resource needed for different operation, actually calculate again later
It is miscellaneous to be given a mark by these pre-set operation scores to query steps when spending, it is true eventually by the score of query steps
Determine the complexity of data inquiry request.
Illustrate by taking the data inquiry request of SQL statement as an example below.It, all can shape in query engine for data inquiry request
Into inquiry plan, this inquiry plan is exactly the analysis to the multiple queries step of query process, for example polymerize, scan,
The operations such as Union, Join.An exemplary SQL data inquiry requests sentence is shown in table 1:
Table 1
The inquiry plan of formation can be analyzed as shown in table 2:
Table 2
As can be seen from the above table, the SQL statement in above-mentioned data inquiry request is related to multiple behaviour as shown above in total
Make item, can be finally obtained according to pre-defined action-item score, the data scanning number of partitions, data partition scanning number etc.
The complexity of data inquiry request.
In an optional realization method of the present embodiment, data query arrangement further includes:
First returns to module, is configured as when the complexity of the inquiry operation is more than the predetermined threshold value, to submission
The requesting party of the data inquiry request returns to query failure message.
In the optional realization method, if by analyzing data inquiry request, determine that the data inquiry request is corresponding
The complexity of inquiry operation has been more than pre-set threshold value, may cause shadow to the stability and concurrency of query engine
It rings, at this moment can directly refuse the data inquiry request of requesting party, and export the information of inquiry failure.
In one optional realization method of the present embodiment, as shown in fig. 7, after the submission module 503, further include:
Second receiving module 701 is configured as receiving the query result that the query engine returns;
Second determining module 702 is configured to determine that whether the query result meets and submits the data inquiry request
Requesting party resource quota;
Second returns to module 703, is configured as when the query result is unsatisfactory for the resource quota, to the request
Side returns to query failure message.
In the optional realization method, the data inquiry request for meeting access device admittable regulation is submitted into query engine
Afterwards, query engine returns to query result after inquiry operation is completed to access device.Access device is receiving query result
Afterwards, it can also determine whether query result meets the resource quota of requesting party according to the identity information of requesting party, such as check and work as
Whether preceding query result meets the admittance restrictions such as single dominant record number, day maximum Record to return, ties inquiry if met
Fruit returns to requesting party, otherwise returns to query failure message.
Access device can pass through the packaged type of structuring or flow data shape when returning to query result to requesting party
Query result is returned to requesting party by formula, can be returned the result by way of synchronous return or asynchronism callback.It is specific to use
Asynchronous return or synchronous return, requesting party can carry required return in the request when proposing data inquiry request
Mode, if asynchronous return, it is also necessary to asynchronism callback address is carried in data inquiry request, access device will inquire knot
When fruit returns to requesting party, by the way that asynchronism callback address is called to return.Synchronous mode can then block requesting query to instead always
Present result.
In one optional realization method of the present embodiment, as shown in figure 8, data query arrangement further includes:
Acquisition module 801, is configured as in query process, obtains the query engine holding for the inquiry operation
Row situation;
Third determining module 802, is configured to determine that whether the practice condition meets preset condition.
In the optional realization method, access device can also after data inquiry request is submitted to query engine,
In query engine operational process, practice condition of the query engine for the data inquiry request is obtained, practice condition is included but not
It is limited to the maximum duration of inquiry, inquires scanned data volume, the occupied memory of inquiry etc..Access device can be periodic
It checks practice condition of the query engine for data inquiry request, and is determining query engine during inquiry operation is performed
The resource used is more than to be expected.In this way, can in query process the stability of monitoring and inquiry engine and concurrent
Property.
In one optional realization method of the present embodiment, data query arrangement further includes:
Sending module is configured as when the practice condition is unsatisfactory for preset condition, is sent eventually to the query engine
The only request of the inquiry operation.
In the optional realization method, in query process, access device is periodically detected the practice condition of query engine,
If it is determined that not meeting expection, then current queries operation can be terminated, and the information of inquiry failure is returned to requesting party.Pass through this
Kind mode can have found that it is likely that the factor that query engine stability and concurrency can be caused to decline, and terminate current queries in time
Operation, in order to avoid cause serious consequence.
Fig. 9 is adapted for the structural representation of the electronic equipment for realizing the data query method according to disclosure embodiment
Figure.
As shown in figure 9, electronic equipment 900 includes central processing unit (CPU) 901, it can be according to being stored in read-only deposit
Program in reservoir (ROM) 902 is held from the program that storage section 908 is loaded into random access storage device (RAM) 903
Various processing in the above-mentioned embodiment shown in FIG. 1 of row.In RAM903, be also stored with electronic equipment 900 operate it is required
Various programs and data.CPU901, ROM902 and RAM903 are connected with each other by bus 904.Input/output (I/O) interface
905 are also connected to bus 904.
I/O interfaces 905 are connected to lower component:Importation 906 including keyboard, mouse etc.;It is penetrated including such as cathode
The output par, c 907 of spool (CRT), liquid crystal display (LCD) etc. and loud speaker etc.;Storage section 908 including hard disk etc.;
And the communications portion 909 of the network interface card including LAN card, modem etc..Communications portion 909 via such as because
The network of spy's net performs communication process.Driver 910 is also according to needing to be connected to I/O interfaces 905.Detachable media 911, such as
Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on driver 910, as needed in order to be read from thereon
Computer program be mounted into storage section 908 as needed.
Particularly, according to embodiment of the present disclosure, it is soft to may be implemented as computer above with reference to Fig. 1 methods described
Part program.For example, embodiment of the present disclosure includes a kind of computer program product, including being tangibly embodied in and its readable
Computer program on medium, the computer program include for perform Fig. 1 method program code.In such implementation
In mode, which can be downloaded and installed from network by communications portion 909 and/or from detachable media
911 are mounted.
Flow chart and block diagram in attached drawing, it is illustrated that according to the system, method and computer of the various embodiments of the disclosure
Architectural framework in the cards, function and the operation of program product.In this regard, each box in course diagram or block diagram can be with
A part for a module, program segment or code is represented, a part for the module, program segment or code includes one or more
The executable instruction of logic function as defined in being used to implement.It should also be noted that in some implementations as replacements, institute in box
The function of mark can also be occurred with being different from the sequence marked in attached drawing.For example, two boxes succeedingly represented are practical
On can perform substantially in parallel, they can also be performed in the opposite order sometimes, this is depended on the functions involved.Also
It is noted that the combination of each box in block diagram and/or flow chart and the box in block diagram and/or flow chart, Ke Yiyong
The dedicated hardware based systems of functions or operations as defined in execution is realized or can be referred to specialized hardware and computer
The combination of order is realized.
Being described in unit or module involved in disclosure embodiment can be realized by way of software, also may be used
It is realized in a manner of by hardware.Described unit or module can also be set in the processor, these units or module
Title do not form restriction to the unit or module in itself under certain conditions.
As on the other hand, the disclosure additionally provides a kind of computer readable storage medium, the computer-readable storage medium
Matter can be computer readable storage medium included in device described in the above embodiment;Can also be individualism,
Without the computer readable storage medium in supplying equipment.There are one computer-readable recording medium storages or more than one journey
Sequence, described program is used for performing by one or more than one processor is described in disclosed method.
The preferred embodiment and the explanation to institute's application technology principle that above description is only the disclosure.People in the art
Member should be appreciated that invention scope involved in the disclosure, however it is not limited to the technology that the specific combination of above-mentioned technical characteristic forms
Scheme, while should also cover in the case where not departing from the inventive concept, it is carried out by above-mentioned technical characteristic or its equivalent feature
The other technical solutions for arbitrarily combining and being formed.Such as features described above has similar work(with the (but not limited to) disclosed in the disclosure
The technical solution that the technical characteristic of energy is replaced mutually and formed.
Claims (10)
- A kind of 1. data query method, which is characterized in that including:Receive data inquiry request;Determine the complexity of the corresponding inquiry operation of the data inquiry request;When the complexity of the inquiry operation is no more than predetermined threshold value, the data inquiry request is submitted into query engine.
- 2. data query method according to claim 1, which is characterized in that determine that the data inquiry request is corresponding and look into Before the complexity for asking operation, further include:Verify the permission of the requesting party of the data inquiry request.
- 3. data query method according to claim 2, which is characterized in that verify the requesting party of the data inquiry request Permission, including at least one of:The legitimacy of the requesting party is verified according to the authentication information carried in the data inquiry request;Authentication information verification according to being carried in the data inquiry request submits the query resource of the requesting party remaining Amount;The authentication information verification carried according to the data inquiry request submits the requesting party for the query engine Operating right.
- 4. data query method according to claim 1, which is characterized in that determine that the data inquiry request is corresponding and look into The complexity of operation is ask, including:The query steps of the inquiry operation are determined according to the data inquiry request;The operation score of the query steps is determined according to preset rules;The complexity is determined according to the operation score.
- 5. data query method according to claim 1, which is characterized in that further include:When the complexity of the inquiry operation is more than the predetermined threshold value, returned to the requesting party of the data inquiry request is submitted Return query failure message.
- 6. data query method according to claim 1, which is characterized in that the data inquiry request is submitted into inquiry After engine, further include:Receive the query result that the query engine returns;Determine whether the query result meets the resource quota for the requesting party for submitting the data inquiry request;When the query result is unsatisfactory for the resource quota, query failure message is returned to the requesting party.
- 7. data query method according to claim 1, which is characterized in that further include:In query process, practice condition of the query engine for the inquiry operation is obtained;Determine whether the practice condition meets preset condition.
- 8. a kind of data query arrangement, which is characterized in that including:First receiving module is configured as receiving data inquiry request;First determining module is configured to determine that the complexity of the corresponding inquiry operation of the data inquiry request;Module is submitted, is configured as when the complexity of the inquiry operation is no more than predetermined threshold value, it please by the data query It asks and submits to query engine.
- 9. a kind of electronic equipment, which is characterized in that including memory and processor;Wherein,The memory is used to store one or more computer instruction, wherein, one or more computer instruction is by institute Processor is stated to perform to realize claim 1-7 any one of them method and steps.
- 10. a kind of computer readable storage medium, is stored thereon with computer instruction, which is characterized in that the computer instruction quilt Claim 1-7 any one of them method and steps are realized when processor performs.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810060918.3A CN108170860A (en) | 2018-01-22 | 2018-01-22 | Data query method, apparatus, electronic equipment and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810060918.3A CN108170860A (en) | 2018-01-22 | 2018-01-22 | Data query method, apparatus, electronic equipment and computer readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108170860A true CN108170860A (en) | 2018-06-15 |
Family
ID=62515267
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810060918.3A Pending CN108170860A (en) | 2018-01-22 | 2018-01-22 | Data query method, apparatus, electronic equipment and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108170860A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109145015A (en) * | 2018-08-02 | 2019-01-04 | 北京百度网讯科技有限公司 | Data query methods, devices and systems based on structured query language |
CN109960709A (en) * | 2019-04-18 | 2019-07-02 | 上海达梦数据库有限公司 | A kind of processing method of database-driven, device, equipment and storage medium |
CN110321388A (en) * | 2019-02-26 | 2019-10-11 | 南威软件股份有限公司 | A kind of quicksort querying method and system based on Greenplum |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103530568A (en) * | 2012-07-02 | 2014-01-22 | 阿里巴巴集团控股有限公司 | Authority control method, device and system |
CN104050297A (en) * | 2014-07-03 | 2014-09-17 | 中国工商银行股份有限公司 | Inquiry transaction distribution method and device |
CN105786992A (en) * | 2016-02-17 | 2016-07-20 | 中国建设银行股份有限公司 | Data query method and device used for online transaction |
CN106649503A (en) * | 2016-10-11 | 2017-05-10 | 北京集奥聚合科技有限公司 | Query method and system based on sql |
US20170323118A1 (en) * | 2016-05-05 | 2017-11-09 | The Johns Hopkins University | Apparatus and Method for Private Information Retrieval |
-
2018
- 2018-01-22 CN CN201810060918.3A patent/CN108170860A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103530568A (en) * | 2012-07-02 | 2014-01-22 | 阿里巴巴集团控股有限公司 | Authority control method, device and system |
CN104050297A (en) * | 2014-07-03 | 2014-09-17 | 中国工商银行股份有限公司 | Inquiry transaction distribution method and device |
CN105786992A (en) * | 2016-02-17 | 2016-07-20 | 中国建设银行股份有限公司 | Data query method and device used for online transaction |
US20170323118A1 (en) * | 2016-05-05 | 2017-11-09 | The Johns Hopkins University | Apparatus and Method for Private Information Retrieval |
CN106649503A (en) * | 2016-10-11 | 2017-05-10 | 北京集奥聚合科技有限公司 | Query method and system based on sql |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109145015A (en) * | 2018-08-02 | 2019-01-04 | 北京百度网讯科技有限公司 | Data query methods, devices and systems based on structured query language |
CN109145015B (en) * | 2018-08-02 | 2022-12-23 | 北京百度网讯科技有限公司 | Data query method, device and system based on structured query language |
CN110321388A (en) * | 2019-02-26 | 2019-10-11 | 南威软件股份有限公司 | A kind of quicksort querying method and system based on Greenplum |
CN109960709A (en) * | 2019-04-18 | 2019-07-02 | 上海达梦数据库有限公司 | A kind of processing method of database-driven, device, equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7562215B2 (en) | System and method for electronic document security | |
CN113297625B (en) | Data sharing system and method based on block chain and electronic equipment | |
CN108920494A (en) | Isolation access method, server-side and the storage medium of multi-tenant database | |
US20210243008A1 (en) | Blockchain Management Platform for Performing Asset Adjustment, Cross Sectional Editing, and Bonding | |
CN105095970B (en) | The execution method and system of third-party application | |
CN108108973A (en) | Business risk control method and device | |
CN110399383A (en) | Applied to the data processing method of server, device, calculate equipment, medium | |
US10621651B2 (en) | Automatic recharge system and method, and server | |
US11777713B2 (en) | Blockchain management platform for performing asset adjustment, cross sectional editing, and bonding | |
CN110493308B (en) | Distributed consistency system session method and device, storage medium and server | |
CN110365711B (en) | Multi-platform user identity association method and device, computer equipment and computer readable storage medium | |
US20140173693A1 (en) | Cookie Optimization | |
CN108170860A (en) | Data query method, apparatus, electronic equipment and computer readable storage medium | |
CN113256408A (en) | Risk control method and system based on consumption finance and computer equipment | |
CN110086813A (en) | Access right control method and device | |
CN108876368B (en) | Private key management method, device and computer-readable storage medium | |
CN109447384A (en) | Verification method, device, equipment and the storage medium of air control system | |
CN113269639A (en) | Business processing method, device, equipment and medium based on block chain intelligent contract | |
CN108961034A (en) | System and method, storage medium based on user behavior certification | |
WO2019177788A1 (en) | Detecting alterations of journal data structures | |
CN105827873B (en) | A kind of solution strange land client traffic handles limited method and device | |
WO2019191579A1 (en) | System and methods for recording codes in a distributed environment | |
CN108564333A (en) | A kind of occupational survey method and system | |
CN114240436A (en) | Electronic certificate verification and cancellation method and device, computer equipment and storage medium | |
CN113469801A (en) | Method and device for determining audit result |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180615 |