CN104462420A - Method and device for executing query tasks on database - Google Patents

Method and device for executing query tasks on database Download PDF

Info

Publication number
CN104462420A
CN104462420A CN201410771376.2A CN201410771376A CN104462420A CN 104462420 A CN104462420 A CN 104462420A CN 201410771376 A CN201410771376 A CN 201410771376A CN 104462420 A CN104462420 A CN 104462420A
Authority
CN
China
Prior art keywords
query task
queue
database
query
preserved
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.)
Granted
Application number
CN201410771376.2A
Other languages
Chinese (zh)
Other versions
CN104462420B (en
Inventor
陈国兴
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Gridsum Technology Co Ltd
Original Assignee
Beijing Gridsum Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Gridsum Technology Co Ltd filed Critical Beijing Gridsum Technology Co Ltd
Priority to CN201410771376.2A priority Critical patent/CN104462420B/en
Publication of CN104462420A publication Critical patent/CN104462420A/en
Application granted granted Critical
Publication of CN104462420B publication Critical patent/CN104462420B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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
    • G06F16/24578Query processing with adaptation to user needs using ranking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24534Query rewriting; Transformation
    • G06F16/24549Run-time optimisation

Landscapes

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

Abstract

The invention discloses a method and a device for executing query tasks on a database. The method for executing the query tasks includes acquiring to-be-executed first query tasks; storing the first query tasks into queues pointed by identification; acquiring task serial numbers of various query tasks stored in the queues; executing the various query tasks stored in the queues according to the task serial numbers. The first query tasks carry the identification of the database occupied by the first query tasks. The various query tasks stored in the queues include the first query tasks. The method and the device have the advantages that the problem of database resource preemption of a plurality of time-consuming queries when the time-consuming queries are simultaneously executed on the same database in the prior art can be solved by the aid of the method and the device, and an effect of executing various query operations in a serialized manner when the multiple time-consuming query operations are simultaneously executed on the single database can be realized.

Description

The manner of execution of the query task of database and device
Technical field
The present invention relates to data processing field, in particular to a kind of manner of execution and device of query task of database.
Background technology
When multiple application program carries out query manipulation to a database simultaneously, if the resource that query manipulation takies (as: CPU calculating, IO read-write etc.) is larger, then seizing resource can be there is, finally cause multiple queries action need just can complete for a long time (time that all query manipulation serials perform needs can be exceeded), even cannot complete.
Wherein, IO is Input/Output, i.e. I/O.
In the prior art, for this situation, the settling mode of general employing is for optimizing SQL query statement, to play the performance of database to greatest extent, this settling mode can only meet the requirement for the less query manipulation of data volume, for the situation needing the very large data volume of statistical query (magnitudes in units of hundred million), existing settling mode then can not well be dealt with problems.
Wherein, SQL is Structured Query Language, i.e. Structured Query Language (SQL), and SQL is a kind of data base querying and programming language, for access data and inquiry, renewal and administrative relationships Database Systems.
Prior art is just optimized SQL query statement, do not solve multiple query manipulation consuming time and resource is seized to the query time overlength caused, even failed problem (because database amount is very large, also needing after the optimization of SQL query statement to perform the long period).
For when performing multiple query manipulation consuming time to a database in prior art simultaneously, the problem that multiple query manipulation consuming time is seized database resource, not yet proposes effective solution at present.
Summary of the invention
Fundamental purpose of the present invention is manner of execution and the device of the query task providing a kind of database, when multiple query manipulation consuming time being performed to a database to solve in prior art simultaneously, and the problem that multiple query manipulation consuming time is seized database resource.
To achieve these goals, according to an aspect of the present invention, a kind of manner of execution of query task of database is provided.
Manner of execution according to the present invention comprises: obtain the first pending query task, wherein, carries the mark of the database shared by execution first query task in the first query task; First query task is preserved the queue pointed by inlet identity; Obtain the mission number of each query task preserved in queue, wherein, each query task of preservation comprises the first query task; Each query task of the preservation in queue is performed according to mission number.
Further, the queue that the first query task is preserved pointed by inlet identity is comprised: detect the queue corresponding to mark whether existing and created; If there is the queue corresponding to mark created, then the first query task is added into the tail of the queue of queue; The queue corresponding to mark created if do not exist, then create queue, and the first query task is saved to queue.
Further, the tail of the queue that the first query task is added into queue is comprised: whether the quantity detecting the second query task preserved in queue reaches predetermined threshold value, and wherein, each query task of preservation comprises the second query task; If the quantity of the second query task preserved in queue does not reach predetermined threshold value, then the first query task is added into the tail of the queue of queue.
Further, comprise according to each query task of the preservation in mission number execution queue: whether detect queue is empty; If queue is not empty, then read the 4th query task that the mission number of current the 3rd complete query task is corresponding, wherein, each query task of preservation comprises the 3rd query task and the 4th query task; Perform the 4th query task, and the 4th query task is removed from queue.
Further, after each query task performing the preservation in queue according to mission number, manner of execution also comprises: obtain the execution result data performing each query task preserved; Execution result data are preserved into result data set.
To achieve these goals, according to a further aspect in the invention, a kind of actuating unit of query task of database is provided.
Actuating unit according to the present invention comprises: the first acquisition module, for obtaining the first pending query task, wherein, carries the mark of the database shared by execution first query task in the first query task; First preserves module, for the first query task being preserved the queue pointed by inlet identity; Second acquisition module, for obtaining the mission number of each query task preserved in queue, wherein, each query task of preservation comprises the first query task; Execution module, for performing each query task of the preservation in queue according to mission number.
Further, first preserves module comprises: first detection module, for detecting the queue corresponding to the mark that whether exists and created; Adding module, for when there is the queue corresponding to the mark that created, the first query task being added into the tail of the queue of queue; Preserve submodule, for when there is not the queue corresponding to the mark that created, creating queue, and the first query task is saved to queue.
Further, add module to comprise: whether the second detection module, reach predetermined threshold value for the quantity detecting the second query task preserved in queue, and wherein, each query task of preservation comprises the second query task; Add submodule, the quantity for the second query task preserved in queue does not reach predetermined threshold value, the first query task is added into the tail of the queue of queue.
Whether further, execution module comprises: the 3rd detection module, be empty for detecting queue; Read module, for not being empty in queue, read the 4th query task that the mission number of current the 3rd complete query task is corresponding, wherein, each query task of preservation comprises the 3rd query task and the 4th query task; Implementation sub-module, for performing the 4th query task, and removes the 4th query task from queue.
Further, actuating unit also comprises: the 3rd acquisition module, for after each query task performing the preservation in queue according to mission number, obtains the execution result data performing each query task preserved; Second preserves module, for preserving execution result data into result data set.
Adopt the embodiment of the present invention, after getting the first pending query task, according to the mark of the database shared by this task of the execution of carrying in the first query task, first query task is preserved the queue pointed by this mark, the order entering queue according to each query task obtains the mission number of each query task preserved in queue successively, and performs each query task according to the mission number serial got successively.In the above-described embodiments, for each database arranges a queue, by query task being preserved in the queue of corresponding database, and the order of queue is entered according to the mission number of each query task preserved in queue and query task, query task is performed to this database, can realize ranking to the query task of each database and each query task preserved in automated serial execution queue, avoid when multiple query task consuming time being performed simultaneously to a database in prior art, the problem that the resource of each consuming task to database is seized.Pass through the embodiment of the present invention, to solve in prior art when multiple inquiry consuming time being performed to a database simultaneously, the problem that multiple inquiry consuming time is seized database resource, achieves the effect simultaneously serialization during a database execution multiple query manipulation consuming time being performed to each query manipulation.
Accompanying drawing explanation
The accompanying drawing forming a application's part is used to provide a further understanding of the present invention, and schematic description and description of the present invention, for explaining the present invention, does not form inappropriate limitation of the present invention.In the accompanying drawings:
Fig. 1 is the process flow diagram of the manner of execution of the query task of database according to the embodiment of the present invention;
Fig. 2 is the process flow diagram of the manner of execution of the query task of a kind of optional database according to the embodiment of the present invention;
Fig. 3 is the process flow diagram of the execution sub-process of a kind of optional query task according to the embodiment of the present invention; And
Fig. 4 is the schematic diagram of the actuating unit of the query task of database according to the embodiment of the present invention.
Embodiment
The present invention program is understood better in order to make those skilled in the art person, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the embodiment of a part of the present invention, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, should belong to the scope of protection of the invention.
It should be noted that, term " first ", " second " etc. in instructions of the present invention and claims and above-mentioned accompanying drawing are for distinguishing similar object, and need not be used for describing specific order or precedence.Should be appreciated that the data used like this can be exchanged in the appropriate case, so as embodiments of the invention described herein can with except here diagram or describe those except order implement.In addition, term " comprises " and " having " and their any distortion, intention is to cover not exclusive comprising, such as, contain those steps or unit that the process of series of steps or unit, method, system, product or equipment is not necessarily limited to clearly list, but can comprise clearly do not list or for intrinsic other step of these processes, method, product or equipment or unit.
It should be noted that, when not conflicting, the embodiment in the application and the feature in embodiment can combine mutually.Below with reference to the accompanying drawings and describe the present invention in detail in conjunction with the embodiments.
Fig. 1 is the process flow diagram of the manner of execution of the query task of database according to the embodiment of the present invention, and as shown in Figure 1, this manner of execution comprises following step S102 to step S108:
Step S102, obtains the first pending query task.
Wherein, the mark of the database shared by execution first query task is carried in the first query task.
Step S104, preserves the queue pointed by inlet identity by the first query task.
Step S106, obtains the mission number of each query task preserved in queue.
Wherein, each query task of preservation comprises the first query task.
Step S108, performs each query task of the preservation in queue according to mission number.
Adopt the embodiment of the present invention, after getting the first pending query task, according to the mark of the database shared by this task of the execution of carrying in the first query task, first query task is preserved the queue pointed by this mark, the order entering queue according to each query task obtains the mission number of each query task preserved in queue successively, and performs each query task according to the mission number serial got successively.In the above-described embodiments, for each database arranges a queue, by query task being preserved in the queue of corresponding database, and the order of queue is entered according to the mission number of each query task preserved in queue and query task, query task is performed to this database, can realize ranking to the query task of each database and each query task preserved in automated serial execution queue, avoid when multiple query task consuming time being performed simultaneously to a database in prior art, the problem that the resource of each consuming task to database is seized.Pass through the embodiment of the present invention, to solve in prior art when multiple inquiry consuming time being performed to a database simultaneously, the problem that multiple inquiry consuming time is seized database resource, achieves the effect simultaneously serialization during a database execution multiple query manipulation consuming time being performed to each query manipulation.
In the above-described embodiment, when obtaining the mission number of each query task preserved in queue, the order entering queue according to query task sequentially obtains mission number; When performing each query task of the preservation in queue according to mission number, perform each query task in queue successively according to the mission number got, instead of with the size of mission number for execution sequence performs each query task.
In an optional embodiment, can by realizing the above embodiment of the present invention for each database arranges unified database access interface, particularly, each query task of each database of access is received by unified database access interface, and packet queue is carried out to each query task, namely use unified database access interface to be saved in same queue by the query task of the same database of access, parallel seriesization performs each query task in queue.
Can automatically create as required for the queue of preserving query task in the present embodiment, without the need to manual creation, the database will be able to accessed according to query task divides into groups to query task, the resource of each database server can be utilized fully, avoid performing the problem that multiple queries task is seized database resource simultaneously.
Queue in above-described embodiment is the linear list of first in first out (First-In-First-Out, i.e. FIFO), and usual chained list or array realize in a particular application, and queue only allows to carry out update in rear end, carries out deletion action in front end.
According to the above embodiment of the present invention, the queue that the first query task is preserved pointed by inlet identity can be comprised: detect the queue corresponding to mark whether existing and created; If there is the queue corresponding to mark created, then the first query task is added into the tail of the queue of queue; The queue corresponding to mark created if do not exist, then create queue, and the first query task is saved to queue.
Particularly, detect the queue corresponding to mark that whether there is the database carried in the first query task created, when the queue corresponding to this mark that existence has created, the first query task is added into the tail of the queue of this queue; When there is not the queue corresponding to this mark of having created (namely this database does not have corresponding queue), creating the queue corresponding to this mark, and the first query task is saved in queue.
In the above-described embodiments, a corresponding queue of database, when receiving query task, the mark of the database shared by this query task of the execution of carrying in query task, determine the database that query task will be accessed, and whether the queue detecting this database exists, and deposits in case in the queue of this database, the query task received is saved to the tail of the queue of queue; In the non-existent situation of the queue of this database, create queue and the query task received is saved in queue.
Pass through the above embodiment of the present invention, when a database receives multiple queries task, the query task received is preserved by the queue of database, parallel series performs the query task preserved in queue, avoid when performing multiple queries operation to database in prior art, multiple queries operation performs simultaneously and causes the problem seizing database resource.
In the above embodiment of the present invention, the tail of the queue the first query task being added into queue can comprise: whether the quantity detecting the second query task preserved in queue reaches predetermined threshold value, and wherein, each query task of preservation comprises the second query task; If the quantity of the second query task preserved in queue does not reach predetermined threshold value, then the first query task is added into the tail of the queue of queue.
Particularly, whether the quantity of the second query task preserved in the queue of Test database reaches predetermined threshold value, if the quantity of the second query task preserved in the queue of database does not reach predetermined threshold value, then the first query task is added into the tail of the queue of queue; If the quantity of the second query task preserved in the queue of database reaches predetermined threshold value, then will generate information, this first query task cannot be processed in time to point out customer data base.
In the above-described embodiments, predetermined threshold value is the higher limit of the query task that the database preset can process in Preset Time, if the quantity of the query task preserved in the queue of database reaches predetermined threshold value, so when receiving new query task, database can not process the query task newly received in Preset Time, and namely database can not process the query task newly received in time.
According to the above embodiment of the present invention, each query task of the preservation performed in queue according to mission number can comprise: whether detect queue is empty; If queue is not empty, then read the 4th query task that the mission number of current the 3rd complete query task is corresponding, wherein, each query task of preservation comprises the 3rd query task and the 4th query task; Perform the 4th query task, and the 4th query task is removed from queue.
Particularly, when performing each query task of the preservation in queue according to mission number, whether the queue of Test database is empty, if the queue of database is not empty, enter the 4th query task of queue after then reading in current the 3rd complete query task, perform the 4th query task and it is removed from queue.
Further, when the queue of database is empty, suspends the flow process performing query task, start the time that timer record suspends, and after time out reaches the default stand-by period, whether the queue of Test database is empty again.
Need to further illustrate, the numerical values recited of the mission number of query task does not affect the precedence performing query task, is only used as to distinguish the sequencing that query task enters queue.
According to the above embodiment of the present invention, after each query task performing the preservation in queue according to mission number, manner of execution can also comprise: obtain the execution result data performing each query task preserved; Execution result data are preserved into result data set.
Particularly, after the mission number according to query task performs each query task of the preservation in queue, obtain the execution result data of each query task performed in queue, and result data is preserved in result data set.
Further, after executing a query task, the Query Result data of this query task are returned to the user sending this query task by result data set.
Fig. 2 is the process flow diagram of the manner of execution of the query task of a kind of optional database according to the embodiment of the present invention, and manner of execution as shown in Figure 2 can comprise the steps:
Step S202, receives query task.
Wherein, the mark performing the database taken needed for this query task is carried in query task.
Step S204, whether the packet queue detected corresponding to query task exists.
Particularly, detect in the database corresponding to mark carried in this query task and whether there is packet queue (queue namely in above-described embodiment), in the non-existent situation of the packet queue corresponding to query task, perform step S206; Packet queue corresponding to query task is deposited in case, performs step S208.
Step S206, for identifying corresponding database initialize packet queue.
Step S208, obtains the packet queue that query task is corresponding.
Step S210, whether the quantity detecting the query task preserved in packet queue reaches predetermined threshold value.
Particularly, whether the quantity detecting the query task (the second query task namely in above-described embodiment) preserved in packet queue reaches predetermined threshold value, namely whether the query task detected in packet queue has reached the process upper limit of database, when the quantity of the query task preserved in packet queue has reached predetermined threshold value, perform step S212; When the quantity of the query task preserved in packet queue does not reach predetermined threshold value, perform step S214.
Step S212, generating prompting cannot the information of query task in time.
Particularly, the quantity of the query task preserved in packet queue reaches predetermined threshold value, i.e. database busy, generates information and cannot process query task in time to point out customer data base.
Step S214, is saved to the queue end of packet queue by query task.
Step S216, waits for that result data set returns execution result data.
Particularly, can perform sub-process perform query task by initiating task, and obtain the execution result data of query task, wherein, tasks carrying sub-process can comprise step S302 as shown in Figure 3 to step S310.
Step S302, initiating task performs sub-process.
Whether step S304, detecting packet queue is empty.
Particularly, detect in packet queue whether have pending query task, when packet queue is empty, perform step S306, when packet queue is not empty, perform step S308.
Step S306, suspended task performs sub-process and starts timer, and logger task performs the time that sub-process is suspended.
Particularly, after the time that tasks carrying sub-process is suspended reaches Preset Time, return and perform step S302.
Step S308, obtains the query task coming head of the queue in packet queue, and is removed from packet queue by this query task.
Step S310, performs query task, and execution result data is saved to result data set.
It should be noted that, can perform in the computer system of such as one group of computer executable instructions in the step shown in the process flow diagram of accompanying drawing, and, although show logical order in flow charts, but in some cases, can be different from the step shown or described by order execution herein.
Fig. 4 is the schematic diagram of the actuating unit of the query task of database according to the embodiment of the present invention, as shown in Figure 4, this actuating unit can comprise: the first acquisition module 10, for obtaining the first pending query task, wherein, the mark of the database shared by execution first query task is carried in the first query task; First preserves module 30, for the first query task being preserved the queue pointed by inlet identity; Second acquisition module 50, for obtaining the mission number of each query task preserved in queue, wherein, each query task of preservation comprises the first query task; Execution module 70, for performing each query task of the preservation in queue according to mission number.
Adopt the embodiment of the present invention, after getting the first pending query task, according to the mark of the database shared by this task of the execution of carrying in the first query task, first query task is preserved the queue pointed by this mark, the order entering queue according to each query task obtains the mission number of each query task preserved in queue successively, and performs each query task according to the mission number serial got successively.In the above-described embodiments, for each database arranges a queue, by query task being preserved in the queue of corresponding database, and the order of queue is entered according to the mission number of each query task preserved in queue and query task, query task is performed to this database, can realize ranking to the query task of each database and each query task preserved in automated serial execution queue, avoid when multiple query task consuming time being performed simultaneously to a database in prior art, the problem that the resource of each consuming task to database is seized.Pass through the embodiment of the present invention, to solve in prior art when multiple inquiry consuming time being performed to a database simultaneously, the problem that multiple inquiry consuming time is seized database resource, achieves the effect simultaneously serialization during a database execution multiple query manipulation consuming time being performed to each query manipulation.
In the above-described embodiment, when obtaining the mission number of each query task preserved in queue, the order entering queue according to query task sequentially obtains mission number; When performing each query task of the preservation in queue according to mission number, perform each query task in queue successively according to the mission number got, instead of with the size of mission number for execution sequence performs each query task.
In an optional embodiment, can by realizing the above embodiment of the present invention for each database arranges unified database access interface, particularly, each query task of each database of access is received by unified database access interface, and packet queue is carried out to each query task, namely use unified database access interface to be saved in same queue by the query task of the same database of access, parallel seriesization performs each query task in queue.
Can automatically create as required for the queue of preserving query task in the present embodiment, without the need to manual creation, the database will be able to accessed according to query task divides into groups to query task, the resource of each database server can be utilized fully, avoid performing the problem that multiple queries task is seized database resource simultaneously.
Queue in above-described embodiment is the linear list of first in first out (First-In-First-Out, i.e. FIFO), and usual chained list or array realize in a particular application, and queue only allows to carry out update in rear end, carries out deletion action in front end.
According to the above embodiment of the present invention, first preserves module can comprise: first detection module, for detecting the queue corresponding to the mark that whether exists and created; Adding module, for when there is the queue corresponding to the mark that created, the first query task being added into the tail of the queue of queue; Preserve submodule, for when there is not the queue corresponding to the mark that created, creating queue, and the first query task is saved to queue.
Particularly, detect the queue corresponding to mark that whether there is the database carried in the first query task created, when the queue corresponding to this mark that existence has created, the first query task is added into the tail of the queue of this queue; When there is not the queue corresponding to this mark of having created (namely this database does not have corresponding queue), creating the queue corresponding to this mark, and the first query task is saved in queue.
In the above-described embodiments, a corresponding queue of database, when receiving query task, the mark of the database shared by this query task of the execution of carrying in query task, determine the database that query task will be accessed, and whether the queue detecting this database exists, and deposits in case in the queue of this database, the query task received is saved to the tail of the queue of queue; In the non-existent situation of the queue of this database, create queue and the query task received is saved in queue.
Pass through the above embodiment of the present invention, when a database receives multiple queries task, the query task received is preserved by the queue of database, parallel series performs the query task preserved in queue, avoid when performing multiple queries operation to database in prior art, multiple queries operation performs simultaneously and causes the problem seizing database resource.
In the above embodiment of the present invention, adding module can comprise: whether the second detection module, reach predetermined threshold value for the quantity detecting the second query task preserved in queue, and wherein, each query task of preservation comprises the second query task; Add submodule, the quantity for the second query task preserved in queue does not reach predetermined threshold value, the first query task is added into the tail of the queue of queue.
Particularly, whether the quantity of the second query task preserved in the queue of Test database reaches predetermined threshold value, if the quantity of the second query task preserved in the queue of database does not reach predetermined threshold value, then the first query task is added into the tail of the queue of queue; If the quantity of the second query task preserved in the queue of database reaches predetermined threshold value, then will generate information, this first query task cannot be processed in time to point out customer data base.
In the above-described embodiments, predetermined threshold value is the higher limit of the query task that the database preset can process in Preset Time, if the quantity of the query task preserved in the queue of database reaches predetermined threshold value, so when receiving new query task, database can not process the query task newly received in Preset Time, and namely database can not process the query task newly received in time.
Whether according to the above embodiment of the present invention, execution module can comprise: the 3rd detection module, be empty for detecting queue; Read module, for not being empty in queue, read the 4th query task that the mission number of current the 3rd complete query task is corresponding, wherein, each query task of preservation comprises the 3rd query task and the 4th query task; Implementation sub-module, for performing the 4th query task, and removes the 4th query task from queue.
Particularly, when performing each query task of the preservation in queue according to mission number, whether the queue of Test database is empty, if the queue of database is not empty, enter the 4th query task of queue after then reading in current the 3rd complete query task, perform the 4th query task and it is removed from queue.
Further, when the queue of database is empty, suspends the flow process performing query task, start the time that timer record suspends, and after time out reaches the default stand-by period, whether the queue of Test database is empty again.
Need to further illustrate, the numerical values recited of the mission number of query task does not affect the precedence performing query task, is only used as to distinguish the sequencing that query task enters queue.
According to the above embodiment of the present invention, actuating unit can also comprise: the 3rd acquisition module, for after each query task performing the preservation in queue according to mission number, obtains the execution result data performing each query task preserved; Second preserves module, for preserving execution result data into result data set.
Particularly, after the mission number according to query task performs each query task of the preservation in queue, obtain the execution result data of each query task performed in queue, and result data is preserved in result data set.
Further, after executing a query task, the Query Result data of this query task are returned to the user sending this query task by result data set.
The modules provided in the present embodiment is identical with the using method that the corresponding step of embodiment of the method provides, application scenarios also can be identical.It is noted, of course, that the scheme that above-mentioned module relates to can be not limited to content in above-described embodiment and scene, and above-mentioned module may operate in terminal or mobile terminal, can pass through software or hardware implementing.
As can be seen from the above description, present invention achieves following technique effect:
Adopt the embodiment of the present invention, after getting the first pending query task, according to the mark of the database shared by this task of the execution of carrying in the first query task, first query task is preserved the queue pointed by this mark, the order entering queue according to each query task obtains the mission number of each query task preserved in queue successively, and performs each query task according to the mission number serial got successively.In the above-described embodiments, for each database arranges a queue, by query task being preserved in the queue of corresponding database, and the order of queue is entered according to the mission number of each query task preserved in queue and query task, query task is performed to this database, can realize ranking to the query task of each database and each query task preserved in automated serial execution queue, avoid when multiple query task consuming time being performed simultaneously to a database in prior art, the problem that the resource of each consuming task to database is seized.Pass through the embodiment of the present invention, to solve in prior art when multiple inquiry consuming time being performed to a database simultaneously, the problem that multiple inquiry consuming time is seized database resource, achieves the effect simultaneously serialization during a database execution multiple query manipulation consuming time being performed to each query manipulation.
Obviously, those skilled in the art should be understood that, above-mentioned of the present invention each module or each step can realize with general calculation element, they can concentrate on single calculation element, or be distributed on network that multiple calculation element forms, alternatively, they can realize with the executable program code of calculation element, thus, they can be stored and be performed by calculation element in the storage device, or they are made into each integrated circuit modules respectively, or the multiple module in them or step are made into single integrated circuit module to realize.Like this, the present invention is not restricted to any specific hardware and software combination.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (10)

1. a manner of execution for the query task of database, is characterized in that, comprising:
Obtain the first pending query task, wherein, in described first query task, carry the mark of the database performed shared by described first query task;
Described first query task is preserved the queue pointed by described mark;
Obtain the mission number of each query task preserved in described queue, wherein, each query task of described preservation comprises described first query task;
Each query task of the described preservation in described queue is performed according to described mission number.
2. manner of execution according to claim 1, is characterized in that, the queue that described first query task is preserved pointed by described mark is comprised:
Detect and whether there is the described queue corresponding to described mark created;
If there is the described queue corresponding to described mark created, then described first query task is added into the tail of the queue of described queue;
Described queue corresponding to the described mark created if do not exist, then create described queue, and described first query task is saved to described queue.
3. manner of execution according to claim 2, is characterized in that, is comprised by the tail of the queue that described first query task is added into described queue:
Whether the quantity detecting the second query task preserved in described queue reaches predetermined threshold value, and wherein, each query task of described preservation comprises described second query task;
If the quantity of the second query task preserved in described queue does not reach predetermined threshold value, then described first query task is added into the tail of the queue of described queue.
4. manner of execution according to claim 1, is characterized in that, each query task of the described preservation performed in described queue according to described mission number comprises:
Whether detect described queue is empty;
If described queue is not empty, then read the 4th query task that the mission number of current the 3rd complete query task is corresponding, wherein, each query task of described preservation comprises described 3rd query task and described 4th query task;
Perform described 4th query task, and described 4th query task is removed from described queue.
5. manner of execution as claimed in any of claims 1 to 4, is characterized in that, after each query task performing the described preservation in described queue according to described mission number, described manner of execution also comprises:
Obtain the execution result data of each query task performing described preservation;
Described execution result data are preserved into result data set.
6. an actuating unit for the query task of database, is characterized in that, comprising:
First acquisition module, for obtaining the first pending query task, wherein, carries the mark of the database performed shared by described first query task in described first query task;
First preserves module, for described first query task being preserved the queue pointed by described mark;
Second acquisition module, for obtaining the mission number of each query task preserved in described queue, wherein, each query task of described preservation comprises described first query task;
Execution module, for performing each query task of the described preservation in described queue according to described mission number.
7. actuating unit according to claim 6, is characterized in that, described first preserves module comprises:
First detection module, for detecting the described queue corresponding to the described mark that whether exists and created;
Adding module, for when there is the described queue corresponding to the described mark that created, described first query task being added into the tail of the queue of described queue;
Preserve submodule, for when there is not the described queue corresponding to the described mark that created, creating described queue, and described first query task is saved to described queue.
8. actuating unit according to claim 7, is characterized in that, described interpolation module comprises:
Whether the second detection module, reach predetermined threshold value for the quantity detecting the second query task preserved in described queue, and wherein, each query task of described preservation comprises described second query task;
Add submodule, the quantity for the second query task preserved in described queue does not reach predetermined threshold value, described first query task is added into the tail of the queue of described queue.
9. actuating unit according to claim 6, is characterized in that, described execution module comprises:
Whether the 3rd detection module is empty for detecting described queue;
Read module, for not being empty in described queue, read the 4th query task that the mission number of current the 3rd complete query task is corresponding, wherein, each query task of described preservation comprises described 3rd query task and described 4th query task;
Implementation sub-module, for performing described 4th query task, and removes described 4th query task from described queue.
10. according to the actuating unit in claim 6 to 9 described in any one, it is characterized in that, described actuating unit also comprises:
3rd acquisition module, for after each query task performing the described preservation in described queue according to described mission number, obtains the execution result data of each query task performing described preservation;
Second preserves module, for preserving described execution result data into result data set.
CN201410771376.2A 2014-12-12 2014-12-12 The execution method and apparatus of the query task of database Active CN104462420B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410771376.2A CN104462420B (en) 2014-12-12 2014-12-12 The execution method and apparatus of the query task of database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410771376.2A CN104462420B (en) 2014-12-12 2014-12-12 The execution method and apparatus of the query task of database

Publications (2)

Publication Number Publication Date
CN104462420A true CN104462420A (en) 2015-03-25
CN104462420B CN104462420B (en) 2018-09-18

Family

ID=52908455

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410771376.2A Active CN104462420B (en) 2014-12-12 2014-12-12 The execution method and apparatus of the query task of database

Country Status (1)

Country Link
CN (1) CN104462420B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106227595A (en) * 2016-07-12 2016-12-14 乐视控股(北京)有限公司 Process the most quick operating method and system
CN107133332A (en) * 2017-05-11 2017-09-05 广州视源电子科技股份有限公司 The distribution method and device of a kind of query task
CN107491346A (en) * 2016-06-12 2017-12-19 阿里巴巴集团控股有限公司 A kind of task processing method of application, apparatus and system
CN107678856A (en) * 2017-09-20 2018-02-09 苏宁云商集团股份有限公司 The method and device of increment information in a kind of processing business entity
CN107766381A (en) * 2016-08-22 2018-03-06 北京京东尚科信息技术有限公司 Data query method, system and electronic equipment
CN114741422A (en) * 2022-06-09 2022-07-12 深圳华锐分布式技术股份有限公司 Query request method, device, equipment and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110066647A1 (en) * 2009-09-17 2011-03-17 International Business Machines Corporation Consolidating Related Task Data in Process Management Solutions
CN102752136A (en) * 2012-06-29 2012-10-24 广东东研网络科技有限公司 Method for operating and scheduling communication equipment
CN103177035A (en) * 2011-12-26 2013-06-26 中国银联股份有限公司 Data query device and data query method in data base
CN103235835A (en) * 2013-05-22 2013-08-07 曙光信息产业(北京)有限公司 Inquiry implementation method for database cluster and device
CN103353851A (en) * 2013-07-01 2013-10-16 华为技术有限公司 Method and equipment for managing tasks

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110066647A1 (en) * 2009-09-17 2011-03-17 International Business Machines Corporation Consolidating Related Task Data in Process Management Solutions
CN103177035A (en) * 2011-12-26 2013-06-26 中国银联股份有限公司 Data query device and data query method in data base
CN102752136A (en) * 2012-06-29 2012-10-24 广东东研网络科技有限公司 Method for operating and scheduling communication equipment
CN103235835A (en) * 2013-05-22 2013-08-07 曙光信息产业(北京)有限公司 Inquiry implementation method for database cluster and device
CN103353851A (en) * 2013-07-01 2013-10-16 华为技术有限公司 Method and equipment for managing tasks

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107491346A (en) * 2016-06-12 2017-12-19 阿里巴巴集团控股有限公司 A kind of task processing method of application, apparatus and system
CN106227595A (en) * 2016-07-12 2016-12-14 乐视控股(北京)有限公司 Process the most quick operating method and system
CN107766381A (en) * 2016-08-22 2018-03-06 北京京东尚科信息技术有限公司 Data query method, system and electronic equipment
CN107133332A (en) * 2017-05-11 2017-09-05 广州视源电子科技股份有限公司 The distribution method and device of a kind of query task
CN107133332B (en) * 2017-05-11 2020-10-16 广州视源电子科技股份有限公司 Query task allocation method and device
CN107678856A (en) * 2017-09-20 2018-02-09 苏宁云商集团股份有限公司 The method and device of increment information in a kind of processing business entity
CN114741422A (en) * 2022-06-09 2022-07-12 深圳华锐分布式技术股份有限公司 Query request method, device, equipment and medium

Also Published As

Publication number Publication date
CN104462420B (en) 2018-09-18

Similar Documents

Publication Publication Date Title
CN104462420A (en) Method and device for executing query tasks on database
CN110019876B (en) Data query method, electronic device and storage medium
CN107977346B (en) PDF document editing method and terminal equipment
CN105404627B (en) It is a kind of for determining the method and apparatus of search result
CN103177035A (en) Data query device and data query method in data base
CN104408169A (en) Multi-dimensional expression language based dimension query method and device
WO2015043227A1 (en) Systems and methods for contacts management
CN104182544B (en) The dimension method for decomposing and device of analytical database
CN109460398B (en) Time series data completion method and device and electronic equipment
CN116522403B (en) Interactive information desensitization method and server for focusing big data privacy security
CN105426392A (en) Collaborative filtering recommendation method and system
CN110929173A (en) Method, device, equipment and medium for identifying same person
CN104881475A (en) Method and system for randomly sampling big data
CN107870921B (en) Log data processing method and device
CN105939364A (en) Intelligent message push method and system
CN110442439B (en) Task process processing method and device and computer equipment
CN117093619A (en) Rule engine processing method and device, electronic equipment and storage medium
CN111768136A (en) Inventory scheduling method and device
KR101609915B1 (en) Method and apparatus for multi dimension time gap analysis
CN104268277A (en) Data reading method and device for database
CN105095455A (en) Data connection optimization method and data operation system
US11016828B2 (en) Task support system and method
CN113392105B (en) Service data processing method and terminal equipment
CN110472205A (en) Comparison method and device, the storage medium and electronic device of file difference
CN106372071A (en) Method and device for acquiring information of data warehouse

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: Method and device for executing query tasks on database

Effective date of registration: 20190531

Granted publication date: 20180918

Pledgee: Shenzhen Black Horse World Investment Consulting Co.,Ltd.

Pledgor: BEIJING GRIDSUM TECHNOLOGY Co.,Ltd.

Registration number: 2019990000503

PE01 Entry into force of the registration of the contract for pledge of patent right
CP02 Change in the address of a patent holder

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

Patentee after: BEIJING GRIDSUM TECHNOLOGY Co.,Ltd.

Address before: 100086 Beijing city Haidian District Shuangyushu Area No. 76 Zhichun Road cuigongfandian 8 layer A

Patentee before: BEIJING GRIDSUM TECHNOLOGY Co.,Ltd.

CP02 Change in the address of a patent holder
PP01 Preservation of patent right

Effective date of registration: 20240604

Granted publication date: 20180918