CN108959454A - A kind of prompt clause designation method, device, equipment and storage medium - Google Patents

A kind of prompt clause designation method, device, equipment and storage medium Download PDF

Info

Publication number
CN108959454A
CN108959454A CN201810619012.0A CN201810619012A CN108959454A CN 108959454 A CN108959454 A CN 108959454A CN 201810619012 A CN201810619012 A CN 201810619012A CN 108959454 A CN108959454 A CN 108959454A
Authority
CN
China
Prior art keywords
parameter
clause
prompt
sql statement
hash
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
CN201810619012.0A
Other languages
Chinese (zh)
Other versions
CN108959454B (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.)
Shanghai Dameng Database Co Ltd
Original Assignee
Shanghai Dameng Database 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 Shanghai Dameng Database Co Ltd filed Critical Shanghai Dameng Database Co Ltd
Priority to CN201810619012.0A priority Critical patent/CN108959454B/en
Publication of CN108959454A publication Critical patent/CN108959454A/en
Application granted granted Critical
Publication of CN108959454B publication Critical patent/CN108959454B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

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

Abstract

The embodiment of the invention discloses a kind of prompt clause designation method, device, equipment and storage mediums.This method comprises: establishing the Hash table of the corresponding relationship about SQL statement and prompt clause;It is that target SQL statement specifies matching target prompting clause according to Hash table, according to the technical solution of the present invention, to realize when application system is in operation and externally provides the state of service, directly to the specified prompt clause of SQL statement in application system.

Description

A kind of prompt clause designation method, device, equipment and storage medium
Technical field
The present embodiments relate to database technology more particularly to a kind of prompt clause designation method, device, equipment and deposit Storage media.
Background technique
It is also most common that structured query language (Structured Query Language, sql like language), which is most important, Relational database operation language, SQL statement will generally pass through morphology, grammer, semantic analysis in the database, then by optimizer Executive plan is generated, finally by actuator executive plan.Under normal circumstances, optimizer can detect various possible executive plans And the cost of more each executive plan is calculated, relatively optimal executive plan is then selected, but sometimes, due to the generation of optimizer Valence estimates that some inappropriate system configurations that not accurate enough or user carries out will lead to optimizer and not detect optimal hold Row plan.Prompt clause is used as solving the means of such case by some databases, it allows user can be to a certain degree The generation of upper manual intervention executive plan.
In general, prompt clause HINT writes in SQL statement, and data base management system is in grammatical and semantic analysis When all HINT information are taken out, and according to these HINT information ensure executive plan tree when optimizer generates executive plan Corresponding part generate user expected from executive plan node.But in some cases, aforesaid way seems inflexible.Example Such as, in actual items application process, execute the SQL statement of degraded performance for a part, it can be by increasing or modifying The mode of HINT allows optimizer to generate more preferably executive plan.But at this moment application system is in operation and externally provides service State, the directly SQL statement in modification application will first stop applying, interrupt service, and cost is higher.
Summary of the invention
The embodiment of the present invention provides a kind of prompt clause designation method, device, equipment and storage medium, is being applied with realizing When system is in operation and externally provides the state of service, directly to the specified prompt clause of SQL statement in application system.
In a first aspect, the embodiment of the invention provides a kind of prompt clause's designation methods, comprising:
Establish the Hash table of the corresponding relationship about SQL statement and prompt clause;
It is that target SQL statement specifies matching target prompting clause according to the Hash table.
Further, further includes:
Obtain function name be objective function title system function, wherein the system function include the first parameter and Second parameter;
The Hash table is searched according to first parameter, obtains Hash slot corresponding with first parameter;
If there is identical with first parameter SQL statement in the Hash slot, by the Hash table with institute It states the corresponding prompt clause of the identical SQL statement of the first parameter and replaces with second parameter.
Further, further includes:
If in the Hash slot be not present SQL statement identical with first parameter, by the SQL statement with it is described Second parameter is stored to the Hash slot.
Further, Hash table is searched according to first parameter, obtains Hash slot packet corresponding with first parameter It includes:
Obtain the cryptographic Hash of first parameter;
Hash table is searched according to the cryptographic Hash, obtains Hash slot corresponding with the cryptographic Hash.
Further, further includes: successively judge whether the prompt clause in second parameter belongs to prompt clause's list, Wherein, second parameter includes at least a prompt clause;
If the prompt clause in second parameter belongs to prompt clause's list, correspondingly, if the Hash slot It is middle to there is SQL statement identical with first parameter, then by the SQL language identical with first parameter in the Hash table The corresponding prompt clause of sentence replaces with second parameter and includes:
If there is identical with first parameter SQL statement in the Hash slot, by the Hash table with institute It states the corresponding prompt clause of the identical SQL statement of the first parameter and replaces with second parameter;
If there is the prompt clause for being not belonging to prompt clause's list in second parameter, from second parameter The prompt clause that middle deletion is not belonging to prompt clause's list obtains the second new parameter;Correspondingly, if in the Hash slot In the presence of SQL statement identical with first parameter, then by the SQL statement identical with first parameter in the Hash table Corresponding prompt clause replaces with second parameter
If there is identical with first parameter SQL statement in the Hash slot, by the Hash table with institute It states the corresponding prompt clause of the identical SQL statement of the first parameter and replaces with the second new parameter.
Further, first parameter is target SQL statement, and second parameter is target prompting clause.
Second aspect, the embodiment of the invention also provides a kind of prompt clause's specified device, which includes:
Module is established, for establishing the Hash table of the corresponding relationship about SQL statement and prompt clause;
Specified module, for being that target SQL statement specifies matching target prompting clause according to the Hash table.
Further, further includes:
First obtains module, for obtaining the system function that function name is objective function title, wherein the system letter Number includes the first parameter and the second parameter;
Second obtains module, for searching the Hash table according to first parameter, obtains and first parameter pair The Hash slot answered;
Replacement module, if for there is SQL statement identical with first parameter in the Hash slot, by the Kazakhstan The corresponding prompt clause of SQL statement identical with first parameter in uncommon table replaces with second parameter.
The third aspect the embodiment of the invention also provides a kind of computer equipment, including memory, processor and is stored in On memory and the computer program that can run on a processor, the processor are realized when executing described program as the present invention is real Apply any prompt clause's designation method in example.
Fourth aspect, the embodiment of the invention also provides a kind of computer readable storage mediums, are stored thereon with computer Program realizes prompt clause's designation method as described in any in the embodiment of the present invention when program is executed by processor.
The embodiment of the present invention is by establishing the Hash table about SQL statement and the corresponding relationship for prompting clause;According to Hash Table is that target SQL statement specifies matching target prompting clause, runs and externally provides to realize to be in application system When the state of service, directly to the specified prompt clause of SQL statement in application system.
Detailed description of the invention
In order to illustrate the technical solution of the embodiments of the present invention more clearly, below will be to needed in the embodiment attached Figure is briefly described, it should be understood that the following drawings illustrates only certain embodiments of the present invention, therefore is not construed as pair The restriction of range for those of ordinary skill in the art without creative efforts, can also be according to this A little attached drawings obtain other relevant attached drawings.
Fig. 1 is the flow chart of one of embodiment of the present invention one prompt clause's designation method;
Fig. 2 is the flow chart of one of embodiment of the present invention two prompt clause's designation method;
Fig. 3 is the structural schematic diagram of one of embodiment of the present invention three prompt clause's specified device;
Fig. 4 is the structural schematic diagram of one of the embodiment of the present invention four computer equipment.
Specific embodiment
The present invention is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched The specific embodiment stated is used only for explaining the present invention rather than limiting the invention.It also should be noted that in order to just Only the parts related to the present invention are shown in description, attached drawing rather than entire infrastructure.
It should also be noted that similar label and letter indicate similar terms in following attached drawing, therefore, once a certain Xiang Yi It is defined in a attached drawing, does not then need that it is further defined and explained in subsequent attached drawing.Meanwhile of the invention In description, term " first ", " second " etc. are only used for distinguishing description, are not understood to indicate or imply relative importance.
Embodiment one
Fig. 1 is a kind of flow chart for prompt clause designation method that the embodiment of the present invention one provides, and the present embodiment is applicable In the situation that prompt clause specifies, this method can be executed by the prompt clause specified device in the embodiment of the present invention, the dress Setting can be used the mode of software and/or hardware and realizes, as shown in Figure 1, this method specifically comprises the following steps:
S110 establishes the Hash table of the corresponding relationship about SQL statement and prompt clause.
Wherein, structured query language (Structured Query Language) abbreviation SQL, structured query language It is a kind of data base querying and programming language, for accessing data and querying, updating, and managing relational database system; The SQL statement is exactly a kind of language operated to database, in embodiments of the present invention the SQL statement be need by The SQL statement of specified prompt clause.
Wherein, the prompt clause enables to optimizer to generate more preferably executive plan.
Wherein, SQL statement and the corresponding relationship of prompt clause are that optimizer can be made to generate optimal execution plan, SQL language Sentence needs appointed prompt clause, such as can be, for original SQL statement: SELECT*FROM T;If performance is bad, It at this moment can just need to modify SQL statement are as follows: SELECT/*+PARALLEL (4) */* by increasing degree of parallelism come improving performance FROM T;Here PARALLEL (4) is exactly to prompt clause, wherein/*+*/it is defined syntax format, illustrate to execute this 4 tunnel parallel processings are used when SQL statement.The prompt clause that each system can be supported is a fixed and disclosed list, one A/*+*/in can specify multiple prompt clauses, separated with space.
Specifically, establishing the Hash table of the corresponding relationship about SQL statement and prompt clause, SQL is stored in Hash table The corresponding relationship of sentence and prompt clause, such as can be, the corresponding prompt clause X of SQL statement A, SQL language are stored in Hash table Corresponding corresponding prompt clause Z of prompt clause Y, SQL statement C of sentence B etc..
S120 is that target SQL statement specifies matching target prompting clause according to Hash table.
Wherein, the target SQL statement is the SQL statement for needing to increase and/or modify prompt clause, such as be can be, SQL statement: SELECT*FROM T, above-mentioned SQL statement performance is bad, needs by increasing degree of parallelism come improving performance, at this moment Need to increase for above-mentioned SQL statement prompt clause, and then improving performance.
Wherein, after the target prompting clause is inquiry Hash table, what is determined is sub with the matched prompt of target SQL statement Sentence.
Wherein, the mode for being the specified target prompting clause of target SQL statement can be that target SQL statement increase target mentions Show clause, or target SQL statement modification prompt clause, can also be both be that target SQL statement increases target prompting Sentence, and target prompting clause is modified for target SQL statement, it is not limited by the embodiments of the present invention.
Specifically, in inquiry Hash table the corresponding storage of identical with target SQL statement SQL statement prompt clause, if Inquire that SQL statement is identical as target SQL statement in Hash table, then corresponding prompt of the SQL statement inquired in Hash table Sentence, then for the matched target prompting clause of target SQL statement, and for target SQL statement specify target prompting clause.
In a specific example, a Hash table is increased in systems for recording SQL statement and corresponding prompt The mapping relations of clause read above-mentioned Hash table, root when optimizer is that target SQL statement generates optimal execution plan automatically It is that target SQL statement specifies target prompting clause according to target SQL statement and the Hash table.
In another specific example, be stored in Hash table: SQL statement A, which is corresponded to, prompts clause X, and B pairs of SQL statement Clause Y should be prompted, the corresponding prompt clause Z of SQL statement C, target SQL statement is SQL statement A, is target SQL statement in optimizer When generating optimal execution plan, Hash table is inquired, knows with the matched target prompting clause of target SQL statement to be prompt clause X.
The technical solution of the present embodiment, by the Hash table for establishing the corresponding relationship about SQL statement and prompt clause;Root According to Hash table be target SQL statement specify matching target prompting clause, with realize application system be in operation and it is right When the outer state for providing service, directly to the specified prompt clause of SQL statement in application system.
Embodiment two
Fig. 2 is the flow chart that one of embodiment of the present invention two prompts clause's designation method, and the present embodiment is with above-mentioned reality It applies and optimizes based on example, in the present embodiment, further includes: the system function that function name is objective function title is obtained, Wherein, the system function includes the first parameter and the second parameter;Search the Hash table according to first parameter, obtain with The corresponding Hash slot of first parameter;If there is SQL statement identical with first parameter in the Hash slot, by institute It states the corresponding prompt clause of the SQL statement identical with first parameter in Hash table and replaces with second parameter.
As shown in Fig. 2, the method for the present embodiment specifically comprises the following steps:
S210 establishes the Hash table of the corresponding relationship about SQL statement and prompt clause.
S220, obtain function name be objective function title system function, wherein system function include the first parameter and Second parameter.
Wherein, the objective function is the system function for updating Hash table, can modify Hash by objective function The corresponding relationship of SQL statement and prompt clause in table, such as can be, the corresponding prompt clause X of SQL statement A in script Hash table, The corresponding corresponding prompt clause Z of prompt clause Y, SQL statement C of SQL statement B, if objective function is the corresponding prompt clause of SQL statement A Q, then updating the corresponding prompt clause of SQL statement A in Hash table according to objective function is prompt clause Q or SQL statement A corresponding Prompting clause is prompt clause Q and prompt clause X, and it is not limited by the embodiments of the present invention.
Wherein, the form of the objective function can be SF_INJECT_HINT (the first parameter, the second parameter), wherein The form of the objective function may be the form that other can update Hash table, and the embodiment of the present invention is to this without limit System.Wherein, the mode for distinguishing the first parameter and the second parameter separator can be distinguished according to, can also be according to other modes area Point, it is not limited by the embodiments of the present invention.Wherein, second parameter includes at least a prompt clause.
In a specific example, one system function of login system and execution, target SQL statement in system operation For " SELECT*FROM T ", objective function is SF_INJECT_HINT (' SELECT*FROM T', ' PARALLEL (4) '), In, PARALLEL (4) is prompt clause, if it is prompt that former Hash table, which is the corresponding prompt clause of SQL statement SELECT*FROM T, The corresponding prompt clause of SQL statement SELECT*FROM T in Hash table is then updated to PARALLEL (4), Huo Zhegeng by clause X It is newly PARALLEL (4) and prompt clause X.
S230 searches Hash table according to the first parameter, obtains Hash slot corresponding with the first parameter.
Wherein, first parameter is the SQL statement for needing to increase and/or modify prompt clause, such as be can be, first Parameter is SQL statement " SELECT*FROM T ".
Wherein, the Hash table includes keyword and Hash slot, and the Hash slot is a part of Hash table, specifically, And the corresponding Hash slot of the first parameter is Hash slot corresponding with the first parameter in Hash table.
S240, if there is identical with the first parameter SQL statement in Hash slot, by Hash table with the first parameter phase The same corresponding prompt clause of SQL statement replaces with the second parameter.
Wherein, second parameter is prompt clause corresponding with the first parameter.Such as can be, the first parameter is SQL Sentence " SELECT*FROM T ", then the second parameter is prompt clause corresponding with SQL statement " SELECT*FROM T ": “PARALLEL(4)”。
Specifically, the Hash table according to first parameter query, if existing and the first parameter phase in Hash table With SQL statement, then the corresponding prompt clause of SQL statement identical with first parameter in the Hash table is replaced with the Two parameters.
Optionally, if SQL statement identical with the first parameter if it exists in the Hash slot, by Hash table with The corresponding prompt clause of the identical SQL statement of one parameter replaces with the second parameter and former prompt clause.
Specifically, the Hash table according to first parameter query, if existing and the first parameter phase in Hash table With SQL statement, then the corresponding prompt clause of SQL statement identical with first parameter in the Hash table is replaced with the Two parameters and former prompt clause.
Optionally, further includes:
If in the Hash slot be not present SQL statement identical with first parameter, by the SQL statement with it is described Second parameter is stored to the Hash slot.
Specifically, illustrating not deposit in Hash table if SQL statement identical with first parameter is not present in Hash slot In SQL statement identical with the first parameter, also just there is no the corresponding prompt clause of SQL statement identical with the first parameter, because This, need by objective function the first parameter and the second parameter correspondence store to Hash table, that is, by SQL statement and prompt Clause's correspondence is stored to Hash table.In order to next time execute SQL statement identical with the first parameter when, can direct basis Hash table is inquired, for the specified prompt clause of SQL statement identical with the first parameter.
Optionally, Hash table is searched according to first parameter, obtaining Hash slot corresponding with first parameter includes:
Obtain the cryptographic Hash of first parameter;
Hash table is searched according to the cryptographic Hash, obtains Hash slot corresponding with the cryptographic Hash.
Specifically, needing first to obtain first when whether there is SQL statement identical with the first parameter in determining Hash table Then the cryptographic Hash of parameter searches Hash table according to the cryptographic Hash of the first parameter, obtain Hash slot corresponding with cryptographic Hash.
Optionally, further includes: successively judge whether the prompt clause in second parameter belongs to prompt clause's list, In, second parameter includes at least a prompt clause;
If the prompt clause in second parameter belongs to prompt clause's list, correspondingly, if the Hash slot It is middle to there is SQL statement identical with first parameter, then by the SQL language identical with first parameter in the Hash table The corresponding prompt clause of sentence replaces with second parameter and includes:
If there is identical with first parameter SQL statement in the Hash slot, by the Hash table with institute It states the corresponding prompt clause of the identical SQL statement of the first parameter and replaces with second parameter;
If there is the prompt clause for being not belonging to prompt clause's list in second parameter, from second parameter The prompt clause that middle deletion is not belonging to prompt clause's list obtains the second new parameter;Correspondingly, if in the Hash slot In the presence of SQL statement identical with first parameter, then by the SQL statement identical with first parameter in the Hash table Corresponding prompt clause replaces with second parameter
If there is identical with first parameter SQL statement in the Hash slot, by the Hash table with institute It states the corresponding prompt clause of the identical SQL statement of the first parameter and replaces with the second new parameter.
Optionally, first parameter is target SQL statement, and second parameter is target prompting clause.
Wherein, the first parameter is that specified needs increase or modify the SQL statement of HINT, and the second parameter is after increasing or modifying Prompt clause.
Wherein, prompt clause's list is pre-stored prompt clause's list.
Wherein, second parameter includes at least one prompt clause, needs when being read out to objective function First parameter and the second parameter are read out and are parsed, include in the second parameter, which mentions, is determined for resolving to for the second parameter Show whether clause is the prompt clause prompted in clause's list.
Specifically, the second parameter of analysis, determines whether the prompt clause that the second parameter includes belongs to prompt clause's list, if The prompt clause that second parameter includes belongs to prompt clause's list, then by SQL statement identical with the first parameter in Hash table Corresponding prompt clause replaces with the second parameter;Prompt clause's list is not belonging to if existing in the prompt clause that the second parameter includes Prompt clause, then the prompt clause that will not belong to deletes, and obtains the second new parameter, will be identical as the first parameter in Hash table The corresponding prompt clause of SQL statement replace with the second new parameter;If the prompt clause that the second parameter includes is not admitted to mention Show clause's list, then carries out the prompting that reports an error.
In a specific example, when system identification function entitled " SF_INJECT_HINT ", determine that current function is Objective function checks whether the parameter of user's input is two, and whether parameter type meets the requirements, and otherwise reports an error, and exits place Reason;It takes out the second parameter to be analyzed, judges whether the prompt clause's list for belonging to system support.If the second parameter includes more A prompt clause then judges whether to belong to prompt clause's list of system support respectively, being not belonging to mentioning for prompt clause's list Show that clause abandons.It reports an error if all prompt clauses in the second parameter are not belonging to prompt clause's list of system support, Exit processing;Otherwise continue.The first parameter (SQL statement for needing to increase or modify prompt clause) is taken out, to the character string The corresponding SQL statement of parameter carries out morphology and syntactic analysis, continues if correct, otherwise reports an error, exit processing;Join to first Number calculates cryptographic Hash by predetermined Hash algorithm, and into Hash table, corresponding Hash slot is detected according to this cryptographic Hash.Such as Fruit is not matched to identical SQL statement, then is inserted into this SQL statement and corresponding prompt into the correspondence Hash slot of Hash table Clause;If being matched to identical SQL statement, (having used system function before explanation is that this SQL statement specified prompt Sentence), then the corresponding prompt clause of this in Hash table SQL statement is revised as the prompt clause being this time arranged.
It should be noted that being also possible to first take out the first parameter in above-mentioned example, SQL corresponding to the string argument Sentence carries out morphology and syntactic analysis, continues if correct, otherwise reports an error, exit processing, then be taken out the second parameter into Row analysis judges whether the prompt clause's list for belonging to system support.If the second parameter includes multiple prompt clauses, distinguish Judge whether the prompt clause's list for belonging to system support, the prompt clause for being not belonging to prompt clause's list is abandoned.If the The HINT list that all prompt clauses in two parameters are not belonging to system support then reports an error, and exits processing;Otherwise continue.It is preferred that , the analysis to the second parameter is first carried out, because the analysis expense to the second parameter is smaller, need not be opened if wrong The step of selling the bigger analysis to the first parameter.
It should be noted that being prompted in above-mentioned example when user is that the repetition of same SQL statement is specified using objective function When clause, after use specify prompt clause replacement before prompt clause, can also by rear specified prompt clause with before Prompt clause combine to form a new prompt clause, implementation is essentially identical.
S250 is that target SQL statement specifies matching target prompting clause according to Hash table.
Specifically, being replaced by the corresponding prompt clause of SQL statement identical with first parameter in the Hash table After being changed to second parameter, the update of Hash table is realized, is that target SQL statement is specified therewith according to updated Hash table Matched target prompting clause.
Optionally, can also directly according in objective function the first parameter and the second parameter be embodied as target SQL statement Specified target prompting clause.
Specifically, determining target SQL statement according to the first parameter, determine that target SQL statement is corresponding according to the second parameter Target prompting clause specifies target prompting clause for target SQL statement.
In a specific example, the SQL statement that system docking receives carries out morphology, syntax and semantics analysis, if It is correct then continue, it otherwise reports an error, exits processing;Wherein, if there is prompt clause in SQL statement, for prompting clause part Analysis also complete in above process.When there is prompt clause in SQL statement, in this SQL statement running environment memory Record the analog value of prompt clause's instruction.If there are aforementioned Hash tables in system, then use with it is identical pre- in step 230 Determine the cryptographic Hash that hash algorithm obtains this SQL statement, and corresponding Hash slot is visited into Hash table according to this cryptographic Hash It surveys.If being matched to identical SQL statement, the corresponding prompt clause HINT of this SQL statement in Hash table is obtained, its value is remembered It records in this SQL statement running environment memory (if there is prompt clause in SQL statement before and SQL statement operation has been recorded Environment, the value before covering at this time);If being not matched to identical SQL statement, without any processing, continue next Step;If aforementioned Hash table is not present in system, also directly carry out in next step.Then optimizer can generate optimal for SQL statement Executive plan, if having prompt clause HINT value, meeting when optimizer generates optimal execution plan in SQL statement running environment memory Ensure that the corresponding part of executive plan tree generates the corresponding executive plan node of prompt clause HINT value, actuator presses optimal execution Plan executes SQL statement, returns to implementing result to user.
The technical solution of the present embodiment is obtained by establishing the Hash table of the corresponding relationship about SQL statement and prompt clause Taking function name is the system function of objective function title, wherein system function includes the first parameter and the second parameter, according to the One parameter searches Hash table, obtains Hash slot corresponding with the first parameter, if there is SQL identical with the first parameter in Hash slot The corresponding prompt clause of SQL statement identical with the first parameter in Hash table is then replaced with the second parameter, according to Kazakhstan by sentence Uncommon table is that target SQL statement specifies matching target prompting clause, runs and externally mentions to realize to be in application system For service state when, prompt clause directly specified to the SQL statement in application system.
Embodiment three
Fig. 3 is a kind of structural schematic diagram for prompt clause specified device that the embodiment of the present invention three provides.The present embodiment can Suitable for the situation for prompting clause to specify, the mode which can be used software and/or hardware realizes that the device can integrate in office What, which provides prompt clause, is specified in the equipment of function, as shown in figure 3, prompt clause's specified device specifically includes: establishing mould Block 310 and specified module 320.
Wherein, module 310 is established, for establishing the Hash table of the corresponding relationship about SQL statement and prompt clause;
Specified module 320, for being that target SQL statement specifies matching target prompting according to the Hash table Sentence.
Optionally, further includes:
First obtains module, for obtaining the system function that function name is objective function title, wherein the system letter Number includes the first parameter and the second parameter;
Second obtains module, for searching the Hash table according to first parameter, obtains and first parameter pair The Hash slot answered;
Replacement module, if for there is SQL statement identical with first parameter in the Hash slot, by the Kazakhstan The corresponding prompt clause of SQL statement identical with first parameter in uncommon table replaces with second parameter.
Optionally, further includes:
Memory module, if for SQL statement identical with first parameter to be not present in the Hash slot, it will be described SQL statement and second parameter are stored to the Hash slot.
Optionally, the second acquisition module is specifically used for:
Obtain the cryptographic Hash of first parameter;
Hash table is searched according to the cryptographic Hash, obtains Hash slot corresponding with the cryptographic Hash.
Optionally, first parameter is target SQL statement, and second parameter is target prompting clause.
Method provided by any embodiment of the invention can be performed in the said goods, has the corresponding functional module of execution method And beneficial effect.
The technical solution of the present embodiment, by the Hash table for establishing the corresponding relationship about SQL statement and prompt clause;Root According to Hash table be target SQL statement specify matching target prompting clause, with realize application system be in operation and it is right When the outer state for providing service, directly to the specified prompt clause of SQL statement in application system.
Example IV
Fig. 4 is the structural schematic diagram of one of the embodiment of the present invention four computer equipment.Fig. 4, which is shown, to be suitable for being used in fact The block diagram of the exemplary computer device 12 of existing embodiment of the present invention.The computer equipment 12 that Fig. 4 is shown is only one and shows Example, should not function to the embodiment of the present invention and use scope bring any restrictions.
As shown in figure 4, computer equipment 12 is showed in the form of universal computing device.The component of computer equipment 12 can be with Including but not limited to: one or more processor or processing unit 16, system storage 28 connect different system components The bus 18 of (including system storage 28 and processing unit 16).
Bus 18 indicates one of a few class bus structures or a variety of, including memory bus or Memory Controller, Peripheral bus, graphics acceleration port, processor or the local bus using any bus structures in a variety of bus structures.It lifts For example, these architectures include but is not limited to industry standard architecture (ISA) bus, microchannel architecture (MAC) Bus, enhanced isa bus, Video Electronics Standards Association (VESA) local bus and peripheral component interconnection (PCI) bus.
Computer equipment 12 typically comprises a variety of computer system readable media.These media can be it is any can be by The usable medium that computer equipment 12 accesses, including volatile and non-volatile media, moveable and immovable medium.
System storage 28 may include the computer system readable media of form of volatile memory, such as arbitrary access Memory (RAM) 30 and/or cache memory 32.Computer equipment 12 may further include it is other it is removable/can not Mobile, volatile/non-volatile computer system storage medium.Only as an example, storage system 34 can be used for reading and writing not Movably, non-volatile magnetic media (Fig. 4 do not show, commonly referred to as " hard disk drive ").It although not shown in fig 4, can be with The disc driver for reading and writing to removable non-volatile magnetic disk (such as " floppy disk ") is provided, and non-volatile to moving The CD drive of CD (such as CD-ROM, DVD-ROM or other optical mediums) read-write.In these cases, each driving Device can be connected by one or more data media interfaces with bus 18.Memory 28 may include that at least one program produces Product, the program product have one group of (for example, at least one) program module, these program modules are configured to perform of the invention each The function of embodiment.
Program/utility 40 with one group of (at least one) program module 42 can store in such as memory 28 In, such program module 42 includes --- but being not limited to --- operating system, one or more application program, other programs It may include the realization of network environment in module and program data, each of these examples or certain combination.Program mould Block 42 usually executes function and/or method in embodiment described in the invention.
Computer equipment 12 can also be with one or more external equipments 14 (such as keyboard, sensing equipment, display 24 Deng) communication, can also be enabled a user to one or more equipment interact with the computer equipment 12 communicate, and/or with make The computer equipment 12 any equipment (such as network interface card, the modulatedemodulate that can be communicated with one or more of the other calculating equipment Adjust device etc.) communication.This communication can be carried out by input/output (I/O) interface 22.In addition, the calculating in the present embodiment Machine equipment 12, display 24 exist not as independent individual, but are embedded in mirror surface, not aobvious in the display surface of display 24 When showing, the display surface of display 24 visually combines together with mirror surface.Also, computer equipment 12 can also be suitable by network Orchestration 20 and one or more network (such as local area network (LAN), wide area network (WAN) and/or public network, such as internet) Communication.As shown, network adapter 20 is communicated by bus 18 with other modules of computer equipment 12.It should be understood that the greatest extent Pipe is not shown in the figure, and other hardware and/or software module can be used in conjunction with computer equipment 12, including but not limited to: micro- generation Code, device driver, redundant processing unit, external disk drive array, RAID system, tape drive and data backup are deposited Storage system etc..
Processing unit 16 by the program that is stored in system storage 28 of operation, thereby executing various function application and Data processing, such as realize and prompt clause's designation method provided by the embodiment of the present invention: it establishes about SQL statement and prompt The Hash table of the corresponding relationship of sentence;It is that target SQL statement specifies matching target prompting clause according to the Hash table.
Embodiment five
The embodiment of the present invention five provides a kind of computer readable storage medium, is stored thereon with computer program, the journey The prompt clause's designation method provided such as all inventive embodiments of the application is provided when sequence is executed by processor: being established about SQL The Hash table of sentence and the corresponding relationship of prompt clause;It is that target SQL statement specifies matching mesh according to the Hash table Mark prompt clause.
It can be using any combination of one or more computer-readable media.Computer-readable medium can be calculating Machine readable signal medium or computer readable storage medium.Computer readable storage medium for example can be --- but it is unlimited In system, device or the device of --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor, or any above combination.It calculates The more specific example (non exhaustive list) of machine readable storage medium storing program for executing includes: electrical connection with one or more conducting wires, just Taking formula computer disk, hard disk, random access memory (RAM), read-only memory (ROM), erasable type may be programmed read-only storage Device (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device, Or above-mentioned any appropriate combination.In this document, computer readable storage medium can be it is any include or storage journey The tangible medium of sequence, the program can be commanded execution system, device or device use or in connection.
Computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal, Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including --- but It is not limited to --- electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be Any computer-readable medium other than computer readable storage medium, which can send, propagate or Transmission is for by the use of instruction execution system, device or device or program in connection.
The program code for including on computer-readable medium can transmit with any suitable medium, including --- but it is unlimited In --- wireless, electric wire, optical cable, RF etc. or above-mentioned any appropriate combination.
The computer for executing operation of the present invention can be write with one or more programming languages or combinations thereof Program code, described program design language include object oriented program language-such as Java, Smalltalk, C++, It further include conventional procedural programming language-such as " C " language or similar programming language.Program code can be with It fully executes, partly execute on the user computer on the user computer, being executed as an independent software package, portion Divide and partially executes or executed on a remote computer or server completely on the remote computer on the user computer.? Be related in the situation of remote computer, remote computer can pass through the network of any kind --- including local area network (LAN) or Wide area network (WAN)-be connected to subscriber computer, or, it may be connected to outer computer (such as mentioned using Internet service It is connected for quotient by internet).
Note that the above is only a better embodiment of the present invention and the applied technical principle.It will be appreciated by those skilled in the art that The invention is not limited to the specific embodiments described herein, be able to carry out for a person skilled in the art it is various it is apparent variation, It readjusts and substitutes without departing from protection scope of the present invention.Therefore, although being carried out by above embodiments to the present invention It is described in further detail, but the present invention is not limited to the above embodiments only, without departing from the inventive concept, also It may include more other equivalent embodiments, and the scope of the invention is determined by the scope of the appended claims.

Claims (10)

1. a kind of prompt clause's designation method characterized by comprising
Establish the Hash table of the corresponding relationship about SQL statement and prompt clause;
It is that target SQL statement specifies matching target prompting clause according to the Hash table.
2. the method according to claim 1, wherein further include:
Obtain the system function that function name is objective function title, wherein the system function includes the first parameter and second Parameter;
The Hash table is searched according to first parameter, obtains Hash slot corresponding with first parameter;
If there is identical with first parameter SQL statement in the Hash slot, by the Hash table with described the The corresponding prompt clause of the identical SQL statement of one parameter replaces with second parameter.
3. according to the method described in claim 2, it is characterized by further comprising:
If SQL statement identical with first parameter is not present in the Hash slot, by the SQL statement and described second Parameter is stored to the Hash slot.
4. according to the method described in claim 2, it is characterized in that, searching Hash table, acquisition and institute according to first parameter Stating the corresponding Hash slot of the first parameter includes:
Obtain the cryptographic Hash of first parameter;
Hash table is searched according to the cryptographic Hash, obtains Hash slot corresponding with the cryptographic Hash.
5. according to the method described in claim 2, it is characterized by further comprising:
Successively judge whether the prompt clause in second parameter belongs to prompt clause's list, wherein second parameter is extremely It less include a prompt clause;
If the prompt clause in second parameter belongs to prompt clause's list, correspondingly, if being deposited in the Hash slot In SQL statement identical with first parameter, then by the SQL statement pair identical with first parameter in the Hash table The prompt clause answered replaces with second parameter
If there is identical with first parameter SQL statement in the Hash slot, by the Hash table with described the The corresponding prompt clause of the identical SQL statement of one parameter replaces with second parameter;
If there is the prompt clause for being not belonging to prompt clause's list in second parameter, deleted from second parameter Except the prompt clause for being not belonging to prompt clause's list obtains the second new parameter;Correspondingly, if existing in the Hash slot SQL statement identical with first parameter, then it is the SQL statement identical with first parameter in the Hash table is corresponding Prompt clause replace with second parameter and include:
If there is identical with first parameter SQL statement in the Hash slot, by the Hash table with described the The corresponding prompt clause of the identical SQL statement of one parameter replaces with the second new parameter.
6. according to the method described in claim 2, described second joins it is characterized in that, first parameter is target SQL statement Number is target prompting clause.
7. a kind of prompt clause's specified device characterized by comprising
Module is established, for establishing the Hash table of the corresponding relationship about SQL statement and prompt clause;
Specified module, for being that target SQL statement specifies matching target prompting clause according to the Hash table.
8. device according to claim 7, which is characterized in that further include:
First obtains module, for obtaining the system function that function name is objective function title, wherein the system function packet Include the first parameter and the second parameter;
Second obtains module, for searching the Hash table according to first parameter, obtains corresponding with first parameter Hash slot;
Replacement module, if for there is SQL statement identical with first parameter in the Hash slot, by the Hash table In the corresponding prompt clause of SQL statement identical with first parameter replace with second parameter.
9. a kind of computer equipment including memory, processor and stores the meter that can be run on a memory and on a processor Calculation machine program, which is characterized in that the processor realizes such as side as claimed in any one of claims 1 to 6 when executing described program Method.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is by processor Such as method as claimed in any one of claims 1 to 6 is realized when execution.
CN201810619012.0A 2018-06-15 2018-06-15 Prompting clause specifying method, device, equipment and storage medium Active CN108959454B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810619012.0A CN108959454B (en) 2018-06-15 2018-06-15 Prompting clause specifying method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810619012.0A CN108959454B (en) 2018-06-15 2018-06-15 Prompting clause specifying method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN108959454A true CN108959454A (en) 2018-12-07
CN108959454B CN108959454B (en) 2020-12-04

Family

ID=64489435

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810619012.0A Active CN108959454B (en) 2018-06-15 2018-06-15 Prompting clause specifying method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN108959454B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109710635A (en) * 2018-12-29 2019-05-03 联想(北京)有限公司 For the processing method of database, processing system and server group
CN111949684A (en) * 2020-08-06 2020-11-17 上海达梦数据库有限公司 SQL statement execution method, device, equipment and storage medium
CN113849520A (en) * 2021-09-30 2021-12-28 平安科技(深圳)有限公司 Intelligent identification method and device of abnormal SQL (structured query language), electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030236782A1 (en) * 1998-10-05 2003-12-25 Oracle International Corporation Dynamic generation of optimizer hints
US20040019587A1 (en) * 2002-07-25 2004-01-29 You-Chin Fuh Method and device for processing a query in a database management system
CN101162462A (en) * 2006-10-11 2008-04-16 国际商业机器公司 Tools and method for making prompt
CN102591964A (en) * 2011-12-30 2012-07-18 北京新媒传信科技有限公司 Implementation method and device for data reading-writing splitting system
CN103984726A (en) * 2014-05-16 2014-08-13 上海新炬网络技术有限公司 Local revision method for database execution plan
CN106933845A (en) * 2015-12-30 2017-07-07 阿里巴巴集团控股有限公司 The method and apparatus that MDX inquires about effect are realized using SQL

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030236782A1 (en) * 1998-10-05 2003-12-25 Oracle International Corporation Dynamic generation of optimizer hints
US20040019587A1 (en) * 2002-07-25 2004-01-29 You-Chin Fuh Method and device for processing a query in a database management system
CN101162462A (en) * 2006-10-11 2008-04-16 国际商业机器公司 Tools and method for making prompt
CN102591964A (en) * 2011-12-30 2012-07-18 北京新媒传信科技有限公司 Implementation method and device for data reading-writing splitting system
CN103984726A (en) * 2014-05-16 2014-08-13 上海新炬网络技术有限公司 Local revision method for database execution plan
CN106933845A (en) * 2015-12-30 2017-07-07 阿里巴巴集团控股有限公司 The method and apparatus that MDX inquires about effect are realized using SQL

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
甘桂梅: "SQL语句的分析与查询优化策略", 《科技咨询》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109710635A (en) * 2018-12-29 2019-05-03 联想(北京)有限公司 For the processing method of database, processing system and server group
CN109710635B (en) * 2018-12-29 2021-03-19 联想(北京)有限公司 Processing method and processing system for database and server group
CN111949684A (en) * 2020-08-06 2020-11-17 上海达梦数据库有限公司 SQL statement execution method, device, equipment and storage medium
CN111949684B (en) * 2020-08-06 2023-08-11 上海达梦数据库有限公司 SQL sentence execution method, device, equipment and storage medium
CN113849520A (en) * 2021-09-30 2021-12-28 平安科技(深圳)有限公司 Intelligent identification method and device of abnormal SQL (structured query language), electronic equipment and storage medium
CN113849520B (en) * 2021-09-30 2024-05-28 平安科技(深圳)有限公司 Intelligent recognition method and device for abnormal SQL, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN108959454B (en) 2020-12-04

Similar Documents

Publication Publication Date Title
JP6736173B2 (en) Method, system, recording medium and computer program for natural language interface to a database
US10552416B2 (en) Processing SQL statement in alternating modes
US10025846B2 (en) Identifying entity mappings across data assets
US7401095B2 (en) Method and system for composing a query for a database and traversing the database
CN104765731B (en) Database inquiry optimization method and apparatus
CN110502227A (en) The method and device of code completion, storage medium, electronic equipment
CN109918394A (en) Data query method, system, computer installation and computer readable storage medium
KR20060050069A (en) Robust detector of fuzzy duplicates
EP3709195B1 (en) System and method for interoperable communication between entities with different structures
CN109491989A (en) Data processing method and device, electronic equipment, storage medium
JP5791149B2 (en) Computer-implemented method, computer program, and data processing system for database query optimization
CN113760891B (en) Data table generation method, device, equipment and storage medium
CN108959454A (en) A kind of prompt clause designation method, device, equipment and storage medium
CN109947791A (en) A kind of database statement optimization method, device, equipment and storage medium
US10572881B2 (en) Applying entity search techniques to expedite entitlement resolution in support services
CN117389541B (en) Configuration system and device for generating template based on dialogue retrieval
CN108536728A (en) A kind of data query method and apparatus
US20120330988A1 (en) Systems And Methods For Performing Index Joins Using Auto Generative Queries
CN104598374B (en) The method and apparatus of correction failure script
CN111984745A (en) Dynamic expansion method, device, equipment and storage medium for database field
CN114356964A (en) Data blood margin construction method and device, storage medium and electronic equipment
CN112905620A (en) Data query method and device, electronic equipment and storage medium
CN108549666B (en) Data table sorting method, device, equipment and storage medium
US11526522B2 (en) Collaborative search of databases
CN111666302A (en) User ranking query method, device, equipment and storage medium

Legal Events

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