CN108090219B - Method and device for processing built-in data of database - Google Patents

Method and device for processing built-in data of database Download PDF

Info

Publication number
CN108090219B
CN108090219B CN201711486486.4A CN201711486486A CN108090219B CN 108090219 B CN108090219 B CN 108090219B CN 201711486486 A CN201711486486 A CN 201711486486A CN 108090219 B CN108090219 B CN 108090219B
Authority
CN
China
Prior art keywords
database
functional
data
built
functional interface
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.)
Expired - Fee Related
Application number
CN201711486486.4A
Other languages
Chinese (zh)
Other versions
CN108090219A (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 Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo 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 Qihoo Technology Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201711486486.4A priority Critical patent/CN108090219B/en
Publication of CN108090219A publication Critical patent/CN108090219A/en
Application granted granted Critical
Publication of CN108090219B publication Critical patent/CN108090219B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (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 provides a method and a device for processing built-in data of a database. The method comprises the following steps: in the process of operating the database, receiving an operation instruction, wherein the operation instruction and the functional interface have a one-to-one correspondence relationship, and the generation method of the functional interface comprises the following steps: determining at least one functional operation capable of processing built-in data of a database; for each functional operation, generating a functional interface capable of executing the functional operation in a database; establishing a calling relation between the generated functional interface and the built-in data of the database so that when any functional interface is called, the functional interface is utilized to execute corresponding functional operation on the built-in data of the database; calling a functional interface corresponding to the received operation instruction; and executing corresponding functional operation on the built-in data of the database by using the functional interface. The problem that the built-in data of the database can only be processed by using an external environment and/or an external tool in the prior art can be solved.

Description

Method and device for processing built-in data of database
The application is a divisional application of a method for generating a database functional interface, a method and a device for processing built-in data:
application date of the original application: 20141224
Application No. of the original application: 201410817129.1
The invention of the original application is named: a method for generating a database function interface, and a method and a device for processing built-in data.
Technical Field
The invention relates to the technical field of internet, in particular to a method and a device for processing built-in data of a database.
Background
Conventionally, the relational database is favored by a large number of users due to superior data processing speed and data processing flexibility. In the relational database, MySQL is recognized and used by more and more users with the advantages of small size, high speed, low total cost, open source code, and the SQL language being the most common standardized language for accessing the database.
However, in the prior art, MySQL does not have a data management tool of its own. When performing various operations such as management, statistics, maintenance, and inspection, it is necessary to perform corresponding processing operations using an external environment and/or an external tool. This reliance on the use of external environments and/or external tools places significant limitations on MySQL management and other operations in time and/or space and requires significant maintenance costs.
Disclosure of Invention
In view of the foregoing problems, embodiments of the present invention provide a method and an apparatus for processing data in a database, so as to overcome the foregoing problems or at least partially solve the foregoing problems.
According to an aspect of the present invention, there is provided a method for generating a database function interface, including: determining at least one functional operation capable of processing built-in data of a database; for each functional operation, generating a functional interface capable of executing the functional operation in the database; and establishing a calling relation between the generated functional interface and the database built-in data so that when any functional interface is called, the functional interface is utilized to execute corresponding functional operation on the database built-in data.
Optionally, the database is a MySQL database.
According to another aspect of the present invention, a method for processing built-in data of a database is provided, which includes: receiving an operation instruction in the process of operating the database, wherein the operation instruction and the functional interface generated according to the method have a one-to-one correspondence relationship; calling a functional interface corresponding to the received running instruction; and executing corresponding functional operation on the built-in data of the database by using the functional interface.
Optionally, the method further comprises: after the functional interface is utilized to execute corresponding functional operation on the built-in data of the database, displaying an operation result according to a preset mode, wherein the preset mode comprises at least one of the following modes: a rolling display mode, a pop-up window display mode and a mode of displaying part or all of the execution results.
Optionally, the functional operations include at least one of: a query operation, wherein the query operation comprises at least one of: the method comprises the following steps of carrying out access quantity state query operation, index state query operation, lock state query operation, authorization information query operation, Structured Query Language (SQL) use frequency query operation and input/output consumption value query operation; a statistical operation, wherein the statistical operation comprises at least: access amount counting operation and/or table information counting operation; closing process operation in batches; slow sentence grabbing operation; index usage monitoring operations; and (5) emptying operation.
Optionally, the step of performing the corresponding functional operation on the built-in data of the database by using the functional interface further includes: acquiring a first com _ commit and a second com _ commit separated by preset time from an information _ schema. Acquiring a first com _ rollback and a second com _ rollback which are separated by the preset time from an information _ schema. And adding the first difference value and the second difference value, and dividing the obtained result by the preset time to obtain an access volume state value.
Optionally, the method further comprises: after the access quantity state value is obtained, determining the cycle number of displaying the access quantity state value according to the preset time; and displaying the access quantity state value according to the determined cycle number.
Optionally, the step of performing the corresponding functional operation on the built-in data of the database by using the functional interface further includes: obtaining library name information and table name information from information _ schema.tables by using a dbalcock function interface, and obtaining index name information from performance _ schema.table _ io _ ways _ summary _ by _ index _ use; and determining an unused index by using the library name information, the table name information and the index name information to finish index state query operation.
Optionally, the method further comprises: after determining the unused index, displaying a list of the determined unused index.
Optionally, the step of performing the corresponding functional operation on the built-in data of the database by using the functional interface further includes: acquiring an INNODB _ TRX table, an INNODB _ LOCK _ WAITS table and an INNODB _ LOCK table in an information _ schema library by using a dbalock functional interface as data to be managed; comparing the obtained InNODB _ TRX table, the InNODB _ LOCK _ WAITS table and the InNODB _ LOCK table to obtain locked thread information, and finishing the query operation of the LOCK state, wherein the locked thread information comprises at least one of the following items: the method comprises the steps of locking thread identification information, thread locking time information and structured query language SQL triggering thread locking.
Optionally, the method further comprises: and finishing the lock state query operation and displaying the locked thread information.
Optionally, the method further comprises: and before receiving the operation instruction, logging in the database by using the login identification information.
Optionally, the database is a MySQL database.
According to another aspect of the present invention, there is provided a database function interface generation apparatus, including: the determining module is suitable for determining at least one functional operation capable of processing the data built in the database; a generating module adapted to generate, for each functional operation, a functional interface in the database capable of performing the functional operation; and the relationship establishing module is suitable for establishing a calling relationship between the generated functional interfaces and the database built-in data so that when any one functional interface is called, the functional interface is utilized to execute corresponding functional operation on the database built-in data.
Optionally, the database is a MySQL database.
According to another aspect of the present invention, there is provided a device for processing data in a database, including: the device comprises a receiving module, a processing module and a processing module, wherein the receiving module is suitable for receiving an operation instruction in the process of operating a database, and the operation instruction and a functional interface generated according to the device have a one-to-one correspondence relationship; the calling module is suitable for calling a functional interface corresponding to the received running instruction; and the processing module is suitable for executing corresponding functional operation on the built-in data of the database by utilizing the functional interface.
Optionally, the apparatus further comprises: the display module is suitable for displaying an operation result according to a preset mode after the function interface executes corresponding functional operation on the built-in data of the database, wherein the preset mode comprises at least one of the following modes: a rolling display mode, a pop-up window display mode and a mode of displaying part or all of the execution results.
Optionally, the functional operations include at least one of: a query operation, wherein the query operation comprises at least one of: the method comprises the following steps of carrying out access quantity state query operation, index state query operation, lock state query operation, authorization information query operation, Structured Query Language (SQL) use frequency query operation and input/output consumption value query operation; a statistical operation, wherein the statistical operation comprises at least: access amount counting operation and/or table information counting operation; closing process operation in batches; slow sentence grabbing operation; index usage monitoring operations; and (5) emptying operation.
Optionally, the processing module further comprises: an obtaining unit adapted to obtain a first com _ commit and a second com _ commit separated by a preset time from an information _ schema. Acquiring a first com _ rollback and a second com _ rollback which are separated by the preset time from an information _ schema. The determining unit is suitable for carrying out difference operation on the first com _ commit and the second com _ commit to obtain a first difference; performing difference operation on the first com _ rollback and the second com _ rollback to obtain a second difference; and summing the first difference and the second difference, and dividing the obtained result by the preset time to obtain an access volume state value.
Optionally, the display module is further adapted to: determining the cycle number of displaying the access quantity state value according to the preset time; and displaying the access quantity state value according to the determined cycle number.
Optionally, the processing module further comprises: the acquiring unit is also suitable for acquiring library name information and table name information from information _ schema.tables by using a dblock functional interface, and acquiring index name information from performance _ schema.table _ io _ ways _ summary _ by _ index _ use; the determining unit is further adapted to determine an unused index by using the library name information, the table name information, and the index name information, and complete an index status query operation.
Optionally, the display module is further adapted to: after determining the unused index, displaying a list of the determined unused index.
Optionally, the processing module further comprises: the acquiring unit is further adapted to acquire an INNODB _ TRX table, an INNODB _ LOCK _ WAITS table and an INNODB _ LOCK table in the information _ schema library as data to be managed by using the dbalock functional interface; the determining unit is further adapted to compare the obtained inodb _ TRX table, inodb _ LOCK _ wait table, and inodb _ LOCKs table to obtain locked thread information, and complete a LOCK status query operation, where the locked thread information includes at least one of the following: the method comprises the steps of locking thread identification information, thread locking time information and structured query language SQL triggering thread locking.
Optionally, the display module is further adapted to: and finishing the lock state query operation, and displaying the locked thread information.
Optionally, the apparatus further comprises: and the login module is suitable for logging in the database by using login identification information before the receiving module receives any operation instruction.
Optionally, the database is a MySQL database.
According to the method for generating the functional interface of the database, at least one functional operation capable of processing the data in the database is determined, the functional interface capable of executing the functional operation is generated in the database aiming at each functional operation, and a calling relation is established between the generated functional interface and the data in the database, so that when any functional interface is called, the functional interface is utilized to execute the corresponding functional operation on the data in the database. Therefore, the functional interface which is generated by the generation method and used for processing the data in the database is the functional interface generated in the database, does not depend on an external environment and/or an external tool, and is provided for the database. For example, the functional interface for processing the data built in the database may be a functional interface which stores procedures based on the database and is written by using SQL statements. When the database runs, functional operations such as management and the like can be executed on the database by using the functional interface generated in the example without any additional condition, and the problem that the built-in data of the database can be processed only by using an external environment and/or an external tool in the prior art can be solved. Therefore, the functional interface generated by the method for generating the functional interface of the database according to the embodiment of the invention executes the functional operation on the database, which can greatly reduce the dependency on the outside when processing the built-in data of the database, thereby effectively reducing the maintenance cost, avoiding the limitation of time and/or space on the operation such as the management of the database, and expanding the application range of the database. In addition, the built-in data of the database is directly processed by using the functional interface generated according to the tool and/or the environment of the database, the participation of the external environment and/or the external tool is replaced, the memory resource can be saved, and the adverse effect on the operation of the database caused by processing the built-in data of the database by using the external environment and/or the external tool is avoided.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
The above and other objects, advantages and features of the present invention will become more apparent to those skilled in the art from the following detailed description of specific embodiments thereof, taken in conjunction with the accompanying drawings.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the embodiments. The drawings are only for purposes of illustrating embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 illustrates a process flow diagram of a method of generating a database function interface according to one embodiment of the invention;
FIG. 2 is a process flow diagram of a method for processing built-in data in a database according to an embodiment of the invention;
FIG. 3 is a schematic structural diagram of a device for generating a database function interface according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a processing device for built-in data in a database according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of a processing apparatus for database built-in data according to another embodiment of the present invention;
FIG. 6 is a schematic structural diagram of a processing device for database built-in data according to another embodiment of the present invention; and
fig. 7 is a schematic structural diagram of a processing device for database built-in data according to still another embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
In order to solve the above technical problem, an embodiment of the present invention provides a method for generating a database function interface. Fig. 1 shows a process flow diagram of a method for generating a database function interface according to an embodiment of the present invention. Referring to fig. 1, the process at least includes the following steps:
step S102: determining at least one functional operation capable of processing built-in data of a database;
step S104: for each functional operation, generating a functional interface capable of executing the functional operation in a database;
step S106: and establishing a calling relation between the generated functional interface and the built-in data of the database so that when any functional interface is called, the functional interface is utilized to execute corresponding functional operation on the built-in data of the database.
According to the method for generating the functional interface of the database, at least one functional operation capable of processing the data in the database is determined, the functional interface capable of executing the functional operation is generated in the database aiming at each functional operation, and a calling relation is established between the generated functional interface and the data in the database, so that when any functional interface is called, the functional interface is utilized to execute the corresponding functional operation on the data in the database. Therefore, the functional interface which is generated by the generation method and used for processing the data in the database is the functional interface generated in the database, does not depend on an external environment and/or an external tool, and is provided for the database. For example, the functional interface for processing the data built in the database may be a functional interface which stores procedures based on the database and is written by using SQL statements. When the database runs, functional operations such as management and the like can be executed on the database by using the functional interface generated in the example without any additional condition, and the problem that the built-in data of the database can be processed only by using an external environment and/or an external tool in the prior art can be solved. Therefore, the functional interface generated by the method for generating the functional interface of the database according to the embodiment of the invention executes the functional operation on the database, which can greatly reduce the dependency on the outside when processing the built-in data of the database, thereby effectively reducing the maintenance cost, avoiding the limitation of time and/or space on the operation such as the management of the database, and expanding the application range of the database. In addition, the built-in data of the database is directly processed by using the functional interface generated according to the tool and/or the environment of the database, the participation of the external environment and/or the external tool is replaced, the memory resource can be saved, and the adverse effect on the operation of the database caused by processing the built-in data of the database by using the external environment and/or the external tool is avoided.
It should be noted that the database in the embodiment of the present invention may be any database that can use its own tool and/or environment generation function interface to manage the content data, and the embodiment of the present invention is not limited to this. In practical operation, the MySQL database is recognized and used by more and more users with the advantages of small size, high speed, low total cost of ownership, open source code, and the fact that the SQL language is the most common standardized language for accessing the database.
The foregoing describes a method for generating a database function interface according to an embodiment of the present invention. After the database functional interface is generated, the generated functional interface can be used for processing the built-in data of the database. Therefore, based on the generation method of the database function interface provided by each embodiment, the embodiment of the present invention further provides a processing method of the built-in data of the database. Fig. 2 shows a process flow diagram of a processing method of database built-in data according to an embodiment of the present invention. Referring to fig. 2, the process at least includes the following steps:
step S202: receiving an operation instruction in the process of operating the database, wherein the operation instruction has a one-to-one correspondence relationship with the functional interface generated according to the method for generating the database functional interface;
step S204: calling a functional interface corresponding to the received operation instruction;
step S206: and executing corresponding functional operation on the built-in data of the database by using the functional interface.
According to the processing method of the built-in data of the database, disclosed by the embodiment of the invention, in the process of operating the database, the operating instruction which has one-to-one correspondence relationship with the functional interface generated by using the method is received, the corresponding functional interface is called, and the called functional interface is used for executing corresponding functional operation on the built-in data of the database. Therefore, according to the processing method of the built-in data of the database in the embodiment of the invention, the built-in data of the database can be processed by using the functional interface generated in the database, the problem that the built-in data of the database can be processed only by using an external environment and/or an external tool in the prior art is solved, and the efficiency of processing the built-in data of the database is improved.
When the method for generating the functional interface of the database is introduced, the database in the embodiment of the present invention may be any database that can generate the functional interface by using its own tool and/or environment to manage the content data, which is not limited in the embodiment of the present invention. Moreover, the database in the embodiment of the invention comprises a MySQL database. Now, the MySQL database is taken as an embodiment to introduce the processing method of the built-in data of the database, and the MySQL database is simply referred to as MySQL.
According to the above, in the process of running MySQL, a running instruction can be received. In order to ensure the security according to the received operation instruction and avoid the damage of the received malicious operation instruction to the MySQL built-in data, in this example, before the operation instruction is received, the MySQL is logged in by using the login identification information. And when the login is successful, calling a functional interface corresponding to the operation instruction when the operation instruction is received so as to process the MySQL built-in data. If the login fails and the current user may not have the processing authority on the MySQL built-in data, the MySQL built-in data is refused to be processed by calling a corresponding functional interface according to the received operation instruction, so that the security of the MySQL built-in data is ensured.
When the login is successful, if an operation instruction is received, the embodiment of the invention calls the functional interface corresponding to the received operation instruction, and executes corresponding functional operation on the MySQL built-in data by using the called functional interface. After the corresponding functional operation is executed on the MySQL built-in data by using the functional interface, in order to ensure that the operation result can be timely obtained so as to adjust the subsequent operation on the MySQL built-in data according to the operation result, the embodiment of the invention displays the operation result according to a preset mode. The preset mode used for displaying the operation result can be any mode capable of displaying the operation result. For example, the manner of displaying the operation result may include a scroll display manner, a pop-up window display manner, and a manner of displaying a part or all of the operation result.
In addition, the functional operation, which is executed on the MySQL built-in data by calling the functional interface corresponding to the received execution instruction in the embodiment of the present invention, may include any management operation and/or statistical operation and/or maintenance operation and/or detection operation, and the like, which are executed on the MySQL built-in data. For example, the functional operations performed on the MySQL built-in data may include batch close progress operations, slow statement grab operations, index usage monitoring operations, clean-up operations, statistical operations, query operations, and so on. Wherein, the statistic operation may further comprise an access amount statistic operation and/or a table information statistic operation. The query operations may further include an access volume status query operation, an index status query operation, a lock status query operation, an authorization information query operation, a Structured Query Language (SQL) usage frequency query operation, an input output consumption value query operation, and so on.
In order to explain the processing method of MySQL built-in data provided by the above embodiments more clearly and clearly, the embodiments are now provided to introduce the processing method of MySQL built-in data provided by the embodiments of the present invention.
Example one
In the MySQL operation process, an access quantity state value viewing instruction (one of operation instructions) is received, a dbastat function interface is called, a first com _ commit and a second com _ commit which are separated by preset time and a first com _ rollback and a second com _ rollback are obtained from an information _ schema.
For example, the first com _ commit and the second com _ commit at the interval time of 10 seconds are acquired as 80 and 90, respectively, the first com _ rollback and the second com _ rollback at the interval time of 10 seconds are acquired as 10 and 60, respectively, and after difference operation is performed, the first difference value is acquired as 10, and the second difference value is acquired as 50.
And adding the obtained first difference value and the second difference value, and keeping the obtained result in preset time to obtain the access volume state value. If the first difference is 10, the second difference is 50, and the predetermined time is 10 seconds as in the above example, the access volume status is 6 in units of each second.
After the access value state value is obtained, the cycle number of displaying the access value state value is determined according to the preset time, and the access value state value is displayed according to the determined cycle number. For example, the preset time is 10 seconds, and if the access amount status value is displayed once per second, the number of cycles is determined to be 10 times. In addition, since the access amount status value is a single value and is not usually compared with other status values, the access amount status value can be displayed in a manner of selecting a scroll presentation when the access amount status value is displayed.
Example two
In the process of running MySQL, if an index state viewing instruction (one of running instructions) is received, a dbaindenxno functional interface is called, library name information and table name information are obtained from information _ schema.
For example, using dbaindenxno to obtain the library name information and the table name information from the information _ schema. Then, using dbaindenxno to remove the index name information with empty index name information and the index name information with prime index name information from the performance _ schema _ table _ io _ criteria _ sum _ by _ index _ use, and determine the result (i.e. each index entry not used on the line) that COUNT _ STAR is 0.
After the index status query operation is completed, the determined each unused index entry is exposed, and when the number of unused index entries is too large, only a preset number of unused index entries may be displayed. For example, the number of currently unused index entries is 10000, and when the unused index entries are exposed, only 20 are displayed, so that the index is optimized in the subsequent operation.
EXAMPLE III
In the process of running MySQL, if a LOCK state query instruction (one of the running instructions) is received, a dblock functional interface is called, and an INNODB _ TRX table, an INNODB _ LOCK _ WAITS table and an INNODB _ LOCK table in the information _ schema library are obtained by using the dblock functional interface. And comparing the obtained INNODB _ TRX table, the INNODB _ LOCK _ WAITS table and the INNODB _ LOCK table to obtain locked thread information, finishing the LOCK state query operation and displaying the obtained locked thread information. When displaying the locked thread information, the obtained locked thread information may be displayed, including the locked thread identification information, the thread locking time information, and a Structured Query Language (SQL) that triggers thread locking.
The processing method of MySQL embedded data according to the embodiment of the present invention is further described above with three embodiments. It should be noted that, as can be seen from the foregoing, the functional operations performed on the MySQL built-in data in this example include any processing that can be performed on the MySQL built-in data, and are not limited to the functional operations provided in the above three embodiments. For example, the functional operations that can also be performed on MySQL built-in data in this example include:
(1) calling data in an information _ schema, processing list table according to the input field type by using a dbakell functional interface, and executing the operation of closing the corresponding connection thread;
(2) and calling data in the information _ schema, processing list table by using the dbaslow functional interface to obtain a preset number (for example, 100) of SQL with the longest execution time on the current line.
(3) Using a dbatable functional interface to call an information _ schema, schema and information _ schema, tables and calculate information such as distribution of the tables, size of indexes, number of rows of the tables and the like;
(4) using the dbaindex functional interface to call the information _ schema, static and information _ schema, tables of the specified library, and comparing to obtain the table index state, the table row number and other information of the specified library;
(5) calling the authorization information of the database by using a dbagarant functional interface, and fuzzy matching and listing the corresponding authorization information according to the provided user name, the network interconnection protocol field and the like;
(6) calling tables, statuses, columns and key _ column _ use in the information _ schema by using a dbaware functional interface so as to execute preheating operation on the database before each application is put into use;
(7) calculating a performance _ schema, events _ statuses _ summary _ by _ digest table by using a dbasqlmost functional interface to obtain a statement with the maximum execution times in the online statements from the starting time to the current time;
(8) calculating a performance _ schema, table _ io _ criteria _ summary _ by _ index _ use table by using a dbahottable functional interface to obtain table name information with the highest access frequency;
(9) calculating a performance _ schema, table _ io _ criteria _ summary _ by _ index _ use table by using a dbaiofile functional interface to obtain file name information of a file with highest input and output consumption;
(10) utilizing a dbacleanps functional interface to execute emptying operation on each statistical table under the performance _ schema;
(11) and performing joint calculation on tables such as events _ states _ summary _ by _ digest, table _ io _ ways _ summary _ by _ index _ use, events _ ways _ history and tables in information _ schema in the performance _ schema library by using a dbasqlanalyze functional interface, and obtaining the time consumption of each step in the execution process of the single SQL.
Based on the above methods for generating the database functional interface, the embodiment of the present invention provides a device for generating a database functional interface based on the same inventive concept. Fig. 3 is a schematic structural diagram of a generation apparatus of a database function interface according to an embodiment of the present invention. Referring to fig. 3, the apparatus for generating a database function interface according to an embodiment of the present invention at least includes a determining module 310, a generating module 320, and a relationship establishing module 330.
The functions of the devices or components of the apparatus for generating a database functional interface according to the embodiment of the present invention and the connection relationships between the components will now be described:
the determination module 310: is adapted to determine at least one functional operation capable of processing data built in the database;
the generation module 320: coupled to the determining module 310, adapted to generate, for each functional operation, a functional interface in the database capable of performing the functional operation;
the relationship establishing module 330: the generating module 320 is coupled to establish a calling relationship between the generated functional interface and the built-in data of the database, so that when any functional interface is called, the functional interface is used to execute corresponding functional operations on the built-in data of the database.
In another embodiment, the database is a MySQL database.
Based on the processing method of the built-in data of the database provided by the embodiments, the embodiment of the invention also provides a processing device of the built-in data of the database based on the same inventive concept. Fig. 4 is a schematic structural diagram of a processing device for database built-in data according to an embodiment of the present invention. Referring to fig. 4, the processing apparatus for database built-in data according to the embodiment of the present invention at least includes a receiving module 410, a calling module 420, and a processing module 430.
The functions of the devices or components of the processing device for the data built in the database and the connection relationship between the components in the embodiment of the invention are described as follows:
the receiving module 410: the database function interface generating device is suitable for receiving an operation instruction in the process of operating a database, wherein the operation instruction and the function interface generated by the database function interface generating device introduced above have a one-to-one correspondence relationship;
the calling module 420: coupled to the receiving module 410, adapted to call a functional interface corresponding to the received operation instruction;
the processing module 430: coupled to the calling module 420, is adapted to perform corresponding functional operations on the data built in the database by using the functional interface.
Fig. 5 is a schematic structural diagram of a processing device for database built-in data according to another embodiment of the present invention. Referring to fig. 4 and fig. 5 together, compared to the processing apparatus for database built-in data in fig. 4, the processing apparatus for database built-in data in the present embodiment (as shown in fig. 5) further includes:
the display module 440, coupled to the processing module 430, is adapted to display an operation result according to a preset manner after performing a corresponding functional operation on the data in the database by using the functional interface, where the preset manner includes at least one of the following: a scroll display mode, a pop-up window display mode, and a mode of displaying part or all of the execution results.
In another embodiment, the functional operations include at least one of:
a query operation, wherein the query operation comprises at least one of: the method comprises the following steps of carrying out access quantity state query operation, index state query operation, lock state query operation, authorization information query operation, Structured Query Language (SQL) use frequency query operation and input/output consumption value query operation;
a statistical operation, wherein the statistical operation at least comprises: access amount counting operation and/or table information counting operation; closing process operation in batches; slow sentence grabbing operation; index usage monitoring operations; and (5) emptying operation.
Fig. 6 is a schematic structural diagram of a processing device for database built-in data according to another embodiment of the present invention. Referring to fig. 4 and fig. 6 together, compared to the processing apparatus for data built in the database in fig. 4, the processing module 430 (shown in fig. 6) of the present embodiment further includes:
an obtaining unit 431 adapted to obtain, from the information _ schema, global _ status table, a first com _ commit and a second com _ commit separated by a preset time, using the dbast functional interface; and
acquiring a first com _ rollback and a second com _ rollback which are separated by preset time from an information _ schema.
A determining unit 432, coupled to the obtaining unit 431, adapted to perform a difference operation on the first com _ commit and the second com _ commit to obtain a first difference;
performing difference operation on the first com _ rollback and the second com _ rollback to obtain a second difference; and
and adding the first difference value and the second difference value, and dividing the obtained result by preset time to obtain an access volume state value.
In another embodiment, the display module 440 is further adapted to:
determining the cycle number of displaying the access quantity state value according to the preset time;
and displaying the access quantity state value according to the determined cycle number.
In another embodiment, the processing module 430 further comprises:
the obtaining unit 431 is further adapted to obtain, by using the dbmalk functional interface, the library name information and the table name information from the information _ schema.tables, and obtain the index name information from the performance _ schema.table _ io _ ways _ summary _ by _ index _ use;
the determining unit 432 is further adapted to determine an unused index by using the library name information, the table name information, and the index name information, and complete the index status query operation.
In another embodiment, the display module 440 is further adapted to:
after determining the unused index, list display is performed on the index determined to be unused.
In another embodiment, the processing module 430 further comprises:
the obtaining unit 431 is further adapted to obtain an inodb _ TRX table, an inodb _ LOCK _ wait table and an inodb _ LOCK table in the information _ schema library as data to be managed by using the dbalck function interface;
the determining unit 432 is further adapted to compare the obtained inodb _ TRX table, inodb _ LOCK _ wait table, and inodb _ LOCKs table to obtain locked thread information, and complete the LOCK status query operation, where the locked thread information includes at least one of the following: the method comprises the steps of locking thread identification information, thread locking time information and structured query language SQL triggering thread locking.
In another embodiment, the display module 440 is further adapted to:
and finishing the lock state query operation and displaying the locked thread information.
Fig. 7 is a schematic structural diagram of a processing device for database built-in data according to still another embodiment of the present invention. Referring to fig. 4 and 7 together, compared to the processing apparatus for database built-in data shown in fig. 4, the processing apparatus for database built-in data (shown in fig. 7) of the present embodiment further includes:
the login module 450 is adapted to log in the database by using the login identification information before the receiving module receives any operation instruction.
In another embodiment, the database is a MySQL database.
According to any one embodiment or a combination of multiple embodiments, the embodiment of the invention can achieve the following beneficial effects:
according to the method for generating the functional interface of the database, at least one functional operation capable of processing the data in the database is determined, the functional interface capable of executing the functional operation is generated in the database aiming at each functional operation, and a calling relation is established between the generated functional interface and the data in the database, so that when any functional interface is called, the functional interface is utilized to execute the corresponding functional operation on the data in the database. Therefore, the functional interface which is generated by the generation method and used for processing the data in the database is the functional interface generated in the database, does not depend on an external environment and/or an external tool, and is provided for the database. For example, the functional interface for processing the data built in the database may be a functional interface which stores procedures based on the database and is written by using SQL statements. When the database runs, functional operations such as management and the like can be executed on the database by using the functional interface generated in the example without any additional condition, and the problem that the built-in data of the database can be processed only by using an external environment and/or an external tool in the prior art can be solved. Therefore, the functional interface generated by the method for generating the functional interface of the database according to the embodiment of the invention executes the functional operation on the database, which can greatly reduce the dependency on the outside when processing the built-in data of the database, thereby effectively reducing the maintenance cost, avoiding the limitation of time and/or space on the operation such as the management of the database, and expanding the application range of the database. In addition, the built-in data of the database is directly processed by using the functional interface generated according to the tool and/or the environment of the database, the participation of the external environment and/or the external tool is replaced, the memory resource can be saved, and the adverse effect on the operation of the database caused by processing the built-in data of the database by using the external environment and/or the external tool is avoided.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in an apparatus or device according to embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
Thus, it should be appreciated by those skilled in the art that while a number of exemplary embodiments of the invention have been illustrated and described in detail herein, many other variations or modifications consistent with the principles of the invention may be directly determined or derived from the disclosure of the present invention without departing from the spirit and scope of the invention. Accordingly, the scope of the invention should be understood and interpreted to cover all such other variations or modifications.

Claims (12)

1. A processing method of built-in data of a database comprises the following steps:
in the process of operating a database, receiving an operation instruction, wherein the operation instruction and a functional interface have a one-to-one correspondence relationship, and the generation method of the functional interface comprises the following steps: determining at least one functional operation capable of processing built-in data of a database;
for each functional operation, generating a functional interface capable of executing the functional operation in the database; and the number of the first and second groups,
establishing a calling relationship between the generated functional interfaces and the database built-in data so that when any one functional interface is called, the functional interface is utilized to execute corresponding functional operation on the database built-in data;
calling a functional interface corresponding to the received running instruction; and
executing corresponding functional operation on the built-in data of the database by using the functional interface;
wherein, the step of executing corresponding functional operation to the built-in data of the database by using the functional interface further comprises the following steps:
obtaining library name information and table name information from information _ schema.tables by using a dbaindenxno functional interface, and obtaining index name information from performance _ schema.table _ io _ ways _ summary _ by _ index _ use;
and determining an unused index by using the library name information, the table name information and the index name information to finish index state query operation.
2. The method of claim 1, wherein the method further comprises:
after the functional interface is utilized to execute corresponding functional operation on the built-in data of the database, displaying an operation result according to a preset mode, wherein the preset mode comprises at least one of the following modes: a rolling display mode, a pop-up window display mode and a mode of displaying part or all of the operation results.
3. The method of claim 1 or 2, wherein the functional operation comprises at least one of:
a query operation, wherein the query operation comprises at least one of: the method comprises the following steps of carrying out access quantity state query operation, index state query operation, lock state query operation, authorization information query operation, Structured Query Language (SQL) use frequency query operation and input/output consumption value query operation;
a statistical operation, wherein the statistical operation comprises at least: access amount counting operation and/or table information counting operation;
closing process operation in batches;
slow sentence grabbing operation;
index usage monitoring operations;
and (5) emptying operation.
4. The method of claim 1, wherein the method further comprises: after determining the unused index, displaying a list of the determined unused index.
5. The method according to claim 1 or 2, wherein the method further comprises: and before receiving the operation instruction, logging in the database by using the login identification information.
6. The method of claim 1 or 2, wherein the database is a MySQL database.
7. A processing apparatus for built-in data of a database, comprising:
the receiving module is suitable for receiving an operation instruction in the process of operating the database, wherein the operation instruction and the functional interface have a one-to-one correspondence relationship, and the functional interface is generated as follows: the determining module is suitable for determining at least one functional operation capable of processing the data built in the database;
a generating module adapted to generate, for each functional operation, a functional interface in the database capable of performing the functional operation;
the relation establishing module is suitable for establishing a calling relation between the generated functional interfaces and the database built-in data so that when any one functional interface is called, the functional interface is utilized to execute corresponding functional operation on the database built-in data;
the calling module is suitable for calling a functional interface corresponding to the received running instruction;
the processing module is suitable for executing corresponding functional operation on the built-in data of the database by utilizing the functional interface;
wherein the processing module further comprises:
the system comprises an acquisition unit, a database function interface, a database management unit and a database management unit, wherein the acquisition unit is suitable for acquiring library name information and table name information from information _ schema.tables by using the database function interface and acquiring index name information from performance _ schema.table _ io _ ways _ summary _ by _ index _ use; and the determining unit is suitable for determining an unused index by utilizing the library name information, the table name information and the index name information to finish index state query operation.
8. The apparatus of claim 7, wherein the apparatus further comprises:
the display module is suitable for displaying an operation result according to a preset mode after the function interface executes corresponding functional operation on the built-in data of the database, wherein the preset mode comprises at least one of the following modes: a rolling display mode, a pop-up window display mode and a mode of displaying part or all of the operation results.
9. The apparatus of claim 7 or 8, wherein the functional operation comprises at least one of:
a query operation, wherein the query operation comprises at least one of: the method comprises the following steps of carrying out access quantity state query operation, index state query operation, lock state query operation, authorization information query operation, Structured Query Language (SQL) use frequency query operation and input/output consumption value query operation; a statistical operation, wherein the statistical operation comprises at least: access amount counting operation and/or table information counting operation; closing process operation in batches; slow sentence grabbing operation; index usage monitoring operations; and (5) emptying operation.
10. The apparatus of claim 8, wherein the display module is further adapted to: after determining the unused index, displaying a list of the determined unused index.
11. The apparatus of claim 7 or 8, wherein the apparatus further comprises:
and the login module is suitable for logging in the database by using login identification information before the receiving module receives any operation instruction.
12. The apparatus of claim 7 or 8, wherein the database is a MySQL database.
CN201711486486.4A 2014-12-24 2014-12-24 Method and device for processing built-in data of database Expired - Fee Related CN108090219B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711486486.4A CN108090219B (en) 2014-12-24 2014-12-24 Method and device for processing built-in data of database

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410817129.1A CN104516964B (en) 2014-12-24 2014-12-24 The generation method of database function interface, the processing method and processing device of onboard data
CN201711486486.4A CN108090219B (en) 2014-12-24 2014-12-24 Method and device for processing built-in data of database

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN201410817129.1A Division CN104516964B (en) 2014-12-24 2014-12-24 The generation method of database function interface, the processing method and processing device of onboard data

Publications (2)

Publication Number Publication Date
CN108090219A CN108090219A (en) 2018-05-29
CN108090219B true CN108090219B (en) 2021-08-20

Family

ID=52792263

Family Applications (3)

Application Number Title Priority Date Filing Date
CN201711486486.4A Expired - Fee Related CN108090219B (en) 2014-12-24 2014-12-24 Method and device for processing built-in data of database
CN201711482742.2A Pending CN107977475A (en) 2014-12-24 2014-12-24 The processing method and processing device of database onboard data
CN201410817129.1A Active CN104516964B (en) 2014-12-24 2014-12-24 The generation method of database function interface, the processing method and processing device of onboard data

Family Applications After (2)

Application Number Title Priority Date Filing Date
CN201711482742.2A Pending CN107977475A (en) 2014-12-24 2014-12-24 The processing method and processing device of database onboard data
CN201410817129.1A Active CN104516964B (en) 2014-12-24 2014-12-24 The generation method of database function interface, the processing method and processing device of onboard data

Country Status (1)

Country Link
CN (3) CN108090219B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109460416B (en) * 2018-12-12 2020-02-04 成都四方伟业软件股份有限公司 Data processing method and device, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1595386A (en) * 2003-09-09 2005-03-16 华为技术有限公司 A method for implementing database access
CN101217711A (en) * 2008-01-15 2008-07-09 中国移动通信集团福建有限公司 A CRBT Portal stripping method and new platform construction for CRBT after the stripping
CN101398915A (en) * 2007-09-24 2009-04-01 广州市百成科技有限公司 Electronic stamp platform system based on internet
CN102508929A (en) * 2011-12-01 2012-06-20 浪潮(北京)电子信息产业有限公司 System, device and method for realizing data migration of heterogeneous database
CN103500202A (en) * 2013-09-29 2014-01-08 中国船舶重工集团公司第七0九研究所 Security protection method and system for light-weight database
CN104216989A (en) * 2014-09-09 2014-12-17 广东电网公司中山供电局 Method for storing transmission line integrated data based on HBase

Family Cites Families (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1264106C (en) * 2002-03-30 2006-07-12 中兴通讯股份有限公司 Method for accessing database system uniformly
US20060122976A1 (en) * 2004-12-03 2006-06-08 Shumeet Baluja Predictive information retrieval
US8041742B1 (en) * 2004-12-20 2011-10-18 American Megatrends, Inc. Method, system, and apparatus for providing generic database services within an extensible firmware interface environment
CN1848111A (en) * 2005-04-15 2006-10-18 中兴通讯股份有限公司 Realizing method of a data operating interface used in internal-memory database
CN100433011C (en) * 2006-01-17 2008-11-12 中兴通讯股份有限公司 Under embedded environment, method for protecting consistency of memory database
JP4940973B2 (en) * 2007-02-02 2012-05-30 富士通株式会社 Logical structure recognition processing program, logical structure recognition processing method, and logical structure recognition processing apparatus
US7769789B2 (en) * 2007-05-11 2010-08-03 Oracle International Corporation High performant row-level data manipulation using a data layer interface
CN101075266B (en) * 2007-07-16 2010-04-14 华为技术有限公司 Searching system and method
CN101252547B (en) * 2008-04-14 2010-12-08 广州汇思通讯科技有限公司 Middleware system for realizing interactive increase value traffic based on IP set top box and method thereof
US20100114905A1 (en) * 2008-11-03 2010-05-06 Elvin Slavik Method, System, and Product for Managing Spatial Data in a Database
CN202217381U (en) * 2011-09-14 2012-05-09 青岛精益优华能源科技有限公司 Data collector
CN102750354B (en) * 2012-06-11 2014-08-20 清华大学 Method for analyzing and processing non-structured data query operating language
CN102902798A (en) * 2012-10-11 2013-01-30 德讯科技股份有限公司 SQL information acquisition and audit method and system for Informix database
US8909621B2 (en) * 2012-11-16 2014-12-09 International Business Machines Corporation Contextual search history in collaborative archives
CN103019721B (en) * 2012-12-14 2016-03-30 上海华勤通讯技术有限公司 The implementation method of automation mechanized operation and mobile terminal
CN103198140B (en) * 2013-04-16 2017-09-19 上海斐讯数据通信技术有限公司 A kind of database storage system and date storage method
CN103795814B (en) * 2014-02-13 2019-06-25 浪潮软件股份有限公司 A kind of short message equipment universal communication interface producing CPU and OS based on the whole nation

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1595386A (en) * 2003-09-09 2005-03-16 华为技术有限公司 A method for implementing database access
CN101398915A (en) * 2007-09-24 2009-04-01 广州市百成科技有限公司 Electronic stamp platform system based on internet
CN101217711A (en) * 2008-01-15 2008-07-09 中国移动通信集团福建有限公司 A CRBT Portal stripping method and new platform construction for CRBT after the stripping
CN102508929A (en) * 2011-12-01 2012-06-20 浪潮(北京)电子信息产业有限公司 System, device and method for realizing data migration of heterogeneous database
CN103500202A (en) * 2013-09-29 2014-01-08 中国船舶重工集团公司第七0九研究所 Security protection method and system for light-weight database
CN104216989A (en) * 2014-09-09 2014-12-17 广东电网公司中山供电局 Method for storing transmission line integrated data based on HBase

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
MYSQL-INFORMATION_SCHEMA信息数据库(MYSQL注入猜解);springside例子;《https://www.cnblogs.com/springside-example/archive/2007/08/07/2529965.html》;20070807;第2页第5行-第7行 *

Also Published As

Publication number Publication date
CN108090219A (en) 2018-05-29
CN104516964B (en) 2018-06-08
CN107977475A (en) 2018-05-01
CN104516964A (en) 2015-04-15

Similar Documents

Publication Publication Date Title
US8996465B2 (en) Replicating data to a database
US20170242881A1 (en) Tenant data mapping for multiple tenant cloud applications
US8850596B2 (en) Data leakage detection in a multi-tenant data architecture
CN109871368B (en) Database detection method, database detection device, computer device and storage medium
CN106293744A (en) A kind of application version dynamic switching method and device
CN108090219B (en) Method and device for processing built-in data of database
CN111026574B (en) Method and device for diagnosing elastiscearch cluster problem
US11301515B2 (en) Method and apparatus for generating data based on query content
CN109542922A (en) For the processing method and related system of real-time service data
CN110874365B (en) Information query method and related equipment thereof
EP3462341B1 (en) Local identifiers for database objects
CN106648911B (en) Key jitter removal method and device
US8881093B2 (en) Apparatus and method for reconstructing embedded software development environment
CN106570035B (en) Database authorization method and device
EP4022434A1 (en) Hardware acceleration for function processing
US11347505B2 (en) Processor performance monitor that logs reasons for reservation loss
CN108255904B (en) Table structure modeling method and server
CN109828983A (en) PG data base processing method, device, electronic equipment and storage medium
CN109101440B (en) Method for processing trace data concurrent request based on JVM (Java virtual machine) cache
CN112395197A (en) Data processing method, data processing device and electronic equipment
Pradhan et al. Optimal Query Plans for Geo-distributed Data Analytics at Scale
CN114253593A (en) Information feedback method and device of application program, terminal equipment and storage medium
CN116775626A (en) Historical data cleaning method and device, electronic equipment and storage medium
CN113806436A (en) Method and device for improving access efficiency based on AMDP (advanced metering disk) and storage medium
CN117312273A (en) Database management method, device, equipment and computer 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
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20210820

CF01 Termination of patent right due to non-payment of annual fee