A kind of method and system of improving processing performance of memory database
Technical field
The present invention relates to a kind of value-added telecom services field, relate in particular to a kind of method and system of improving processing performance of memory database.
Background technology
The value-added telecom services field is because professional own to high performance demand, and memory database uses very extensive.The general intermediateness data of using the memory database storage service.Such as, information series business after source user is initiated the service request success, generally need generate the O ticket at message center, the service condition data is inserted in the memory database does preservation as a record simultaneously, so that follow-up flow process is taken.Then, message center can be forwarded to message the purpose user.Message is transmitted successfully, and then the service condition data in the updating memory database are foundation according to the service condition data of preserving in this memory database, generate correct T ticket.In memory database, delete the business record that has generated ticket then.Retransmission failure needs to upgrade the professional intermediateness data that were kept at just now in the memory database.Until message is expired, till perhaps message is transmitted successfully.Expired for message, generally be to generate expired T ticket according to the service condition data in the memory database, after having generated the T ticket, this professional corresponding record has not just needed yet in the memory database, because the memory size of memory database is limited, must delete this business record simultaneously.Describe as can be known from the treatment scheme of this information series business, this service feature of value-added telecom services field information series business is particularly suitable for using memory database.
Usually, memory database is supported the standard SQL interface, and increasing (insert), looking into (select), change (update), delete (delete) is the most basic command interface.Realize in inside, it is basic increasing (insert), looking into (select), changes (update), deletes (delete) and be based upon on the basis of looking into (select), has only earlier and finds, navigate to the position of physical record in internal memory, just may change, delete operation.
Convential memory database efficient of (select) in retrieval is whether to build the situation of index and different according to tables of data.Suppose that the record number in the table is N, carry out the select operation for the table of not setting up index, then need every record in the his-and-hers watches to travel through to search, the complexity of algorithm is O (N).For the table of having set up index, it builds the indexed data structure generally is B tree, and the complexity of algorithm is O (logN), that is to say, traditional deletes, changes, looks into operation, its complexity also O (logN) just under best situation.For increasing (insert) operation, for not setting up the indexed data table, as long as find a free memory, put gets final product, and complexity is O (1); And for the table of having set up index, except finding a free memory put, the core position of also need be in index record just now being deposited and the corresponding relation of major key are inserted in the index structure, the algorithm complex of this operation is O (logN), namely, concerning the indexed data table was arranged, the algorithm complex of insert operation was O (logN).
Along with telecommunication service comprises the rapid growth of information series business, when running into the long-time concurrent operations of big capacity, memory database also becomes performance bottleneck gradually, needs to be optimized.
Summary of the invention
Technical matters to be solved by this invention is: the method and system that a kind of improving processing performance of memory database is provided, can effectively improve the performance of memory database, thereby promote the performance of the system of whole use memory database significantly, reach the optimization system performance, the purpose of reducining the construction costs.
The present invention adopts following technical scheme:
A kind of method of improving processing performance of memory database comprises: expand inserting the generic operation order, described expansion requires command execution to finish back feedback addresses information, and described address information comprises the storage address of business record in memory database; Insertion generic operation order after the client of memory database is expanded to the server transmission of memory database; The server of described memory database receives and carries out the insertion generic operation order after the described expansion, to the storage address of client feedback business record in memory database of described memory database; The storage address of the described business record of the client stores of described memory database in memory database.
In one embodiment, this method also comprises: order is expanded to the inquiry generic operation, includes address information in the querying condition that carries when described expansion requires to send order, and described address information comprises the storage address of business record in memory database; Inquiry generic operation order after the client of memory database is expanded to the server transmission of memory database; The server of described memory database receives and resolves the inquiry generic operation order after the described expansion, according to the address information that parses described business record is inquired about and the feedback query result.
In another kind of embodiment, this method also comprises: order is expanded to the deletion generic operation, includes address information in the deletion condition of carrying when described expansion requires to send order, and described address information comprises the storage address of business record in memory database; Deletion generic operation order after the client of memory database is expanded to the server transmission of memory database; The server of described memory database receives and resolves the deletion generic operation order after the described expansion, according to the address information that parses described business record is deleted.
In another embodiment, this method also comprises: expand revising the generic operation order, include address information in the modification condition of carrying when described expansion requires to send order, described address information comprises the storage address of business record in memory database; Modification generic operation order after the client of memory database is expanded to the server transmission of memory database; The server of described memory database receives and resolves the modification generic operation order after the described expansion, according to the address information that parses described business record is made amendment.
Also comprise after this step of inquiry generic operation order after the described expansion of above-mentioned parsing: if do not comprise described address information in the order after resolving, then return error message; If include described address information in the order after resolving, then directly navigate to the particular location of business record in internal memory according to described address information.
Also comprise after this step of deletion generic operation order after the described expansion of above-mentioned parsing: if do not comprise described address information in the order after resolving, then return error message; If include described address information in the order after resolving, then directly navigate to the particular location of business record in internal memory according to described address information;
Also comprise after this step of modification generic operation order after the described expansion of above-mentioned parsing: if do not comprise described address information in the order after resolving, then return error message; If include described address information in the order after resolving, then directly navigate to the particular location of business record in internal memory according to described address information.
Above-mentioned described business record is deleted this step comprise: described business record is carried out release in memory database, and discharge the corresponding memory block of this record.
The present invention correspondingly also provides a kind of system that uses memory database, comprise: insert class order expansion module, be used for expanding inserting the generic operation order, described expansion requires command execution to finish back feedback addresses information, and described address information comprises the storage address of business record in memory database.
In one embodiment, this system also comprises: inquiry class order expansion module, be used for expanding inquiring about the generic operation order, include address information in the querying condition that carries when described expansion requires fill order, described address information comprises the storage address of business record in memory database.
In another kind of embodiment, this system also comprises: deletion class order expansion module, be used for expanding deleting the generic operation order, include address information in the deletion condition of carrying when described expansion requires fill order, described address information comprises the storage address of business record in memory database.
In another embodiment, this system also comprises: revise class order expansion module, be used for expanding revising the generic operation order, include address information in the modification condition of carrying when described expansion requires fill order, described address information comprises the storage address of business record in memory database.
The invention has the beneficial effects as follows: insert the class order by expansion, make it return this and be recorded in physical location in the memory database.When subsequent query, be querying condition with this position, then can directly navigate to the record in the memory database.Thereby be O (logN) with the SQL operative algorithm of memory database from common algorithm complex, being improved to algorithm complex is O (1), has greatly improved the performance of memory database.
Description of drawings
Fig. 1 is the schematic flow sheet that the generic operation order is inserted in expansion among the inventive method embodiment;
Fig. 2 is the schematic flow sheet of expanding query generic operation order among the inventive method embodiment;
Fig. 3 is the schematic flow sheet that the generic operation order is revised in expansion among the inventive method embodiment;
Fig. 4 is the schematic flow sheet of expansion deletion generic operation order among the inventive method embodiment.
Embodiment
By reference to the accompanying drawings the present invention is described in further detail below by embodiment.
Consider the service feature of telecommunication service field classes of messages product, and being recorded in the internal memory in every tables of data all is that definite address is arranged in the memory database, the inventive method embodiment does the order extension process at the standard SQL interface that memory database provides, keep original command interface constant, do not influencing on original operation interface basis, insert, select, update, delete are expanded newly-increased four orders insertEx, selectEx, updateEx, deleteEx.Because updateEx, deleteEx depend on the complexity of selectEx; Therefore, problem reduction is the algorithm optimization of insertEx and selectEx.
Because whether success and failure of common insert return, this method embodiment insertEx rreturn value then more broad sense some, except returning failure, for returning success, not to replace with result code, but be recorded in position in the memory database, can be understood as and be recorded in the pointer of depositing in the memory database.Look into, change, delete follow-up, be initial conditions with this pointer directly, then memory database can directly navigate to the position that is recorded in the internal memory, operates then, thereby the algorithm complex that increases, looks into all is O (1), has greatly improved the operating performance of memory database.
As shown in Figure 1, among this method embodiment, the client of memory database is carried out the insertEx operation, SQL analyzer in the server of memory database judges it is after insertEx operates, in the management structure of memory database, seek the internal memory of a free time, and this piece free memory is labeled as uses, record copies is preserved in this free memory block, then memory address is returned to when searching after client is provided with and directly use.That is, it is on the basis of carrying out original insert operation that the generic operation order is inserted in expansion, when returning, be not to return success sign indicating number simply, but the position that will be recorded in the internal memory returns to client.
As shown in Figure 2, client is when carrying out the selectEx query manipulation, and memory database SQL analyzer judges it is the selectEx operation, in the condition behind the judgement where ptAddr key word must be arranged; If do not contain this key word, then return error message; If contain this key word, then take out RecAddr, namely be recorded in the actual address in the memory database, directly navigate to the particular location that is recorded in the internal memory, get final product thereby carry out internal memory operation.Among a kind of embodiment, RecAddr is the address of broad sense, may be a kind of coding of actual physics memory address, when inquiry, as long as it is decoded into original physical memory addresses.
Having the statement that is recorded in the address in the internal memory in the where condition can be selectEx*from table where ptAddr=RecAddr in one embodiment, rreturn value when wherein RecAddr is exactly step 1 execution insertEx operation, ptAddr is newly-increased in a memory database SQL analyzer Token, and what expression was followed later is the actual address of record.
Inquiry generic operation order after the expansion is carried out verification to record when carrying out internal memory operation, judge whether it is real complete documentation, if not then returning error message, if then record copies is come out and return to client.
As shown in Figure 3, revise the generic operation order for the updateEx after the expansion, memory database SQL analyzer judges it is the updateEx operation, in the condition behind the judgement where ptAddr key word must be arranged, take out RecAddr, namely be recorded in the actual address in the memory database, directly navigate to the particular location that is recorded in the internal memory, carry out original update operation; Retrieving when updateEx after the expansion revises the generic operation order and omitted original update.Among a kind of embodiment, RecAddr is the address of broad sense, may be a kind of coding of actual physics memory address, when inquiry, as long as it is decoded into original physical memory addresses.
As shown in Figure 4, for the order of the deletion of the deleteEx after expansion generic operation, memory database SQL analyzer judges it is the deleteEx operation, in the condition behind the judgement where ptAddr key word must be arranged, take out RecAddr, namely be recorded in the actual address in the memory database, directly navigate to the particular location that is recorded in the internal memory, this is recorded in the memory database to carry out to discharge to handle gets final product.DeleteEx deletion generic operation order after the expansion is the same with original delete operation, has just economized retrieving, and the process of deleting index from index structure.Among a kind of embodiment, RecAddr is the address of broad sense, may be a kind of coding of actual physics memory address, when inquiry, as long as it is decoded into original physical memory addresses.
Fig. 1 to method embodiment shown in Figure 4 be a kind of improvement to the memory database algorithm, can be O (logN) from common algorithm complex with the SQL operative algorithm of memory database, being improved to algorithm complex is O (1), greatly improve the performance of memory database, therefore be particularly suitable for the information series business in the field of telecommunications.Message center is after the business of receiving source user is submitted request to, carrying out the insertEx operation is inserted into record in the memory database, the address RecAddr of memory database return recording in memory database, the continue center can be transmitted message, in transmitting signaling, this RecAddr can be encoded in the signaling body, in synchronous signaling, this RecAddr directly has preservation at message center, need in the mutual asynchronous signalling of complex message in multimedia message and so on, after the signaling body of RecAddr coding is given to the purpose terminal, the signaling body that the purpose terminal can contain this RecAddr coding returns to message center (the most frequently used be in the signaling transactionID field), thereby in subsequent query, can use RecAddr directly to navigate to record in the memory database.
Corresponding said method embodiment, a kind of system embodiment of using memory database also is provided, comprise: insert class order expansion module, be used for expanding inserting the generic operation order, described expansion requires command execution to finish back feedback addresses information, and described address information comprises the storage address of business record in memory database.
This system embodiment also comprises: inquiry class order expansion module, be used for expanding inquiring about the generic operation order, include address information in the querying condition that carries when described expansion requires fill order, described address information comprises the storage address of business record in memory database; Deletion class order expansion module is used for expanding deleting the generic operation order, includes address information in the deletion condition of carrying when described expansion requires fill order, and described address information comprises the storage address of business record in memory database; Revise class order expansion module, be used for expanding revising the generic operation order, include address information in the modification condition of carrying when described expansion requires fill order, described address information comprises the storage address of business record in memory database.The process that how each module operates after how expanding and expanding in the system embodiment is identical with preceding method embodiment, repeats no more herein.
Adopt the present invention, can improve the performance of memory database, thereby significantly promote the performance of the system of whole use memory database.Reach the optimization system performance, the purpose of reducining the construction costs.
Above content be in conjunction with concrete embodiment to further describing that the present invention does, can not assert that concrete enforcement of the present invention is confined to these explanations.For the general technical staff of the technical field of the invention, without departing from the inventive concept of the premise, can also make some simple deduction or replace, all should be considered as belonging to protection scope of the present invention.