CN111694816B - Processing method and device for optimizing database table - Google Patents

Processing method and device for optimizing database table Download PDF

Info

Publication number
CN111694816B
CN111694816B CN202010545244.3A CN202010545244A CN111694816B CN 111694816 B CN111694816 B CN 111694816B CN 202010545244 A CN202010545244 A CN 202010545244A CN 111694816 B CN111694816 B CN 111694816B
Authority
CN
China
Prior art keywords
database table
determining
target
data
characteristic information
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.)
Active
Application number
CN202010545244.3A
Other languages
Chinese (zh)
Other versions
CN111694816A (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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202010545244.3A priority Critical patent/CN111694816B/en
Publication of CN111694816A publication Critical patent/CN111694816A/en
Application granted granted Critical
Publication of CN111694816B publication Critical patent/CN111694816B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/217Database tuning
    • 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/22Indexing; Data structures therefor; Storage structures
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

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)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present disclosure provides a processing method for optimizing database tables, the method comprising obtaining first characteristic information of each of at least one database table, and obtaining second characteristic information of an application associated with each database table; determining a target database table to be optimized according to the first characteristic information and the second characteristic information; and optimizing the target database table. The present disclosure also provides a processing apparatus for optimizing a database table, an electronic device, and a computer-readable storage medium.

Description

Processing method and device for optimizing database table
Technical Field
The present disclosure relates to the field of data processing technologies, and in particular, to a processing method and apparatus for optimizing a database table.
Background
Database tables are a common form of data storage. Along with the overlong service time, the database table has the defect of poor data processing efficiency, so that the problems of slow transaction response and overlong batch execution time are caused. Therefore, to ensure data processing efficiency, the database table needs to be optimized.
In the related art, the method for optimizing the database table includes that an operation and maintenance person periodically checks the database table according to a set judgment rule and screens out a target database table needing to be optimized.
However, the operation and maintenance personnel can check the database table periodically according to the established judgment rule, so that the problems of untimely optimization of the database table, poor instantaneity and poor optimization effect may exist.
Disclosure of Invention
One aspect of the present disclosure provides a processing method for optimizing a database table. The method includes obtaining first characteristic information of each database table in at least one database table, and obtaining second characteristic information of an application program associated with each database table; determining a target database table to be optimized according to the first characteristic information and the second characteristic information; and optimizing the target database table.
As an optional embodiment, the determining a target database table to be optimized according to the statistical feature and the performance feature includes determining a capacity feature of each database table according to the first feature information; determining response characteristics of the application program associated with each database table according to the second characteristic information; and determining the target database table according to the capacity characteristic and the response characteristic.
As an optional embodiment, the determining the target database table according to the capacity feature and the response feature includes determining a database table in which the data capacity meets a first preset condition according to the data capacity characterized by the capacity feature, so as to obtain a first database table; determining a database table of which the data capacity change rate meets a second preset condition according to the data capacity change rate characterized by the capacity characteristics, and obtaining a second database table; determining a database table associated with the application program of which the response time length meets a third preset condition according to the response time length characterized by the response characteristics, and obtaining a third database table; and obtaining a union of the first database table, the second database table and the third database table to obtain the target database table.
As an optional embodiment, the obtaining the union of the first database table, the second database table and the third database table to obtain the target database table includes removing a fourth database table from the union to obtain the target database table, where the fourth database table is a database table whose data capacity satisfies a fourth preset condition.
As an optional embodiment, after determining the target database table that needs to be optimized according to the first feature information and the second feature information, the method further includes: determining an abnormal database table containing a target data partition in other database tables except the target database table, wherein the ratio of the data capacity of the target data partition to the data capacity of the abnormal database table exceeds a first preset threshold; determining whether the file capacity of the abnormal database table exceeds a second preset threshold; if yes, determining the abnormal database table as a target database table needing to be subjected to optimization processing.
As an optional embodiment, the optimizing the target database table includes at least one of: carrying out data partition processing again on the target database table; and carrying out aggregation processing on blank data in the target database table.
As an alternative embodiment, the method further comprises determining a frequency of invocations of the target database table; and determining the optimization processing frequency of the target database table according to the called frequency.
Another aspect of the present disclosure provides a processing apparatus for optimizing a database table, comprising: the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring first characteristic information of each database table in at least one database table and acquiring second characteristic information of an application program associated with each database table; the first determining module is used for determining a target database table which needs to be optimized according to the first characteristic information and the second characteristic information; and the optimization processing module is used for performing optimization processing on the target database table.
Another aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the methods of embodiments of the present disclosure.
Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions that, when executed, are configured to implement a method of an embodiment of the present disclosure.
Drawings
For a more complete understanding of the present disclosure, and the advantages thereof, reference is now made to the following descriptions taken in conjunction with the accompanying drawings, in which,
FIG. 1 schematically illustrates a system architecture of a processing method and apparatus for optimizing database tables according to an embodiment of the present disclosure;
FIG. 2 schematically illustrates a flow chart of a processing method for optimizing database tables according to an embodiment of the disclosure;
FIG. 3A schematically illustrates a flow chart of a processing method for optimizing database tables according to another embodiment of the present disclosure;
FIG. 3B schematically illustrates a flow chart of a processing method for optimizing database tables according to another embodiment of the present disclosure;
FIG. 4 schematically illustrates a block diagram of a processing apparatus for optimizing database tables according to an embodiment of the present disclosure; and
Fig. 5 schematically illustrates a block diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is intended by way of example only and is not intended to limit the scope of the disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. In addition, in the following description, descriptions of well-known structures and techniques are omitted so as not to unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, operations, and/or components, but do not preclude the presence or addition of one or more other features, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the terms used herein should be construed to have meanings consistent with the context of the present specification and should not be construed in an idealized or overly formal manner.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a convention should be interpreted in accordance with the meaning of one of skill in the art having generally understood the convention (e.g., "a system having at least one of A, B and C" would include, but not be limited to, systems having a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
Some of the block diagrams and/or flowchart illustrations are shown in the figures. It will be understood that some blocks of the block diagrams and/or flowchart illustrations, or combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the instructions, when executed by the processor, create means for implementing the functions/acts specified in the block diagrams and/or flowchart. The techniques of this disclosure may be implemented in hardware and/or software (including firmware, microcode, etc.). Additionally, the techniques of this disclosure may take the form of a computer program product on a computer-readable storage medium having instructions stored thereon, the computer program product being for use by or in connection with an instruction execution system.
Embodiments of the present disclosure provide a processing method for optimizing a database table, which may include, for example, the following operations, and a processing apparatus capable of applying the method. Acquiring first characteristic information of each database table in at least one database table, acquiring second characteristic information of an application program associated with each database table, determining a target database table needing to be optimized according to the first characteristic information and the second characteristic information, and further optimizing the target database table.
Fig. 1 schematically illustrates a system architecture of a processing method and apparatus for optimizing database tables according to an embodiment of the present disclosure. It should be noted that fig. 1 is only an example of a system architecture to which embodiments of the present disclosure may be applied to assist those skilled in the art in understanding the technical content of the present disclosure, but does not mean that embodiments of the present disclosure may not be used in other devices, systems, environments, or scenarios.
As shown in fig. 1, the system architecture includes at least one device center (a plurality of which are shown in the figure, such as device centers 101, 102, 103) and a server 104 (a server cluster is also possible, which is not shown in the figure). In the system architecture 100, a large amount of data is stored in each device center, such as device centers 101, 102, 103, and the data is stored in a data file in the form of a database table. The server 104 can obtain the feature information associated with the database table from the device center, and determine the target database table to be optimized according to the obtained feature information.
The equipment center comprises a main equipment center and a standby equipment center, and database tables stored in the main equipment center and the standby equipment center are the same. Illustratively, the device center 101 is a primary device center and the device centers 102, 103 are backup device centers. Preferably, the server 104 acquires the feature information associated with the database table from the master center 101, and determines a target database table to be subjected to the optimization processing according to the feature information. After determining the target database table, the server 104 performs optimization processing on the target database table synchronization in the device centers 101, 102, 103.
In the process of realizing the inventive concept, the inventor finds that in the existing database table optimizing method, operation and maintenance personnel periodically check the database table according to the set judging rule and screen out the target database table needing to be optimized. However, the database table is checked regularly by the operation and maintenance personnel at a preset time, so that the problems of untimely optimization and low optimization efficiency of the database table may exist, and further the database table performance is poor and the data processing response is slow.
The disclosure will be described in detail below with reference to the drawings and specific examples.
Fig. 2 schematically illustrates a flow chart of a processing method for optimizing database tables according to an embodiment of the disclosure.
As shown in fig. 2, the method may include operations S210 to S230.
In operation S210, first characteristic information of each of at least one database table is acquired, and second characteristic information of an application associated with each database table is acquired.
In an embodiment of the present disclosure, in particular, a system architecture to which the present method is applied may be provided with a plurality of device centers, where the device centers include a main device center and a standby device center. The primary and backup centers each store a large amount of data in the form of database tables stored in data files. The data in the database tables include, for example, user account information, transaction records, etc., and a large number of database tables are stored in different data files according to the data characteristics of the data. Illustratively, the database tables corresponding to the users in the Beijing area and the Shanghai area are stored in different data files according to the account opening information of the users.
The larger the amount of data in the database table, the larger the file partition occupied by the database table. When the data capacity of the database table exceeds a preset threshold, the file partition corresponding to the database table is too large, and the calling efficiency and the management effect of the data in the database table are affected. For example, the number of users who open accounts in the beijing area is large, and the data capacity of the database table storing the user data in the beijing area exceeds a preset threshold, so that the database table corresponding to the user data in the beijing area needs to be optimized. The data stored in the database table may also include blank data, and when the occupied space of the blank data is large, the consulting efficiency of the database table is affected, and at this time, the database table also needs to be optimized.
The key of optimizing the database table comprises the steps of determining a target database table which needs to be optimized, wherein the determination efficiency of the target database table influences the optimization efficiency of the database table. According to the method and the device for determining the target database table, the target database table which needs to be optimized can be automatically determined according to the acquired characteristic information associated with the database table, so that the determination efficiency of the target database table is high. Furthermore, the determination efficiency of the target database table is high, the timely optimization of the database table is facilitated, and the optimization effect of the database table is good.
Specifically, first characteristic information of each of the at least one database table is acquired, and the first characteristic information may include attribute information of a plurality of categories of the database tables. Illustratively, the first characteristic information includes information of table names of database tables, corresponding file partitions, utilized spaces, and the like. The first characteristic information can represent information such as data capacity, data capacity change rate, file capacity and the like of the database table, wherein the data capacity is the capacity of data stored in the database table, and the file capacity is the product of the number of data pages included in the database table and the size of each data page.
In addition to the first characteristic information of each database table, second characteristic information of an application associated with each database table is also acquired. Different database tables may be invoked by different applications, and one database table may not be associated with an application or may be associated with at least one application. Second characteristic information of the application program associated with each database table is acquired, wherein the second characteristic information can comprise various kinds of performance information of the application program. Illustratively, the second characteristic information includes information of a program name, a call number, a response time length, and the like of the application program. The second characteristic information can represent information such as average response time length, response time length change rate and the like of the application program.
Next, in operation S220, a target database table that needs to be optimized is determined according to the first feature information and the second feature information.
In the embodiment of the disclosure, specifically, according to the obtained first feature information of at least one database table and according to the second feature information of the application program associated with each database table, the database table in which the data capacity, the data capacity change rate and the application program response time may be abnormal is determined, and then the target database table to be optimized is determined. The target database table can be automatically determined and completed by the server, and compared with the target database table which is required to be optimized and screened out by operators according to the established rules, the method and the device are beneficial to effectively improving the screening efficiency of the target database table and further improving the optimizing efficiency of the target database table.
Then, in operation S230, an optimization process is performed on the target database table.
As an alternative embodiment, the optimizing the target database table may comprise, for example, at least one of: carrying out data partition processing again on the target database table; and performing aggregation processing on blank data in the target database table.
Specifically, the data partition processing is performed on the target database table again, which may include splitting and reorganizing the target database table, or dynamically deleting part of information in the target database table, so as to optimize the data partition of the target database table, and further optimize the distribution of the data files occupied by the target database table. The aggregation of the blank data in the target database table may include, for example, concentrating the blank data in the target database table, i.e., the gaps in the target database table, at the rearmost location of the target database table.
According to the embodiment of the disclosure, first characteristic information of each database table in at least one database table is obtained, second characteristic information of an application program associated with each database table is obtained, then a target database table needing to be optimized is determined according to the first characteristic information and the second characteristic information, and further optimization is performed on the target database table. According to the embodiment of the disclosure, the target database table to be optimized is determined according to the acquired characteristic information associated with each database table, so that the automatic determination of the target database table can be realized, the screening efficiency of the target database table is improved, and the optimization efficiency and the optimization effect of the target database table are improved; meanwhile, the labor cost and time cost of screening the target database table are effectively reduced, the optimization cost of the target database table is reduced, the high-efficiency stability performance of the database table is guaranteed, and meanwhile, the transaction response time length and the time consumption for controlling batch business processing are shortened.
Fig. 3A schematically illustrates a flow chart of a processing method for optimizing database tables according to another embodiment of the present disclosure.
As shown in fig. 3A, the method may include operations S210, S310 to S320, S230.
In operation S210, first characteristic information of each of at least one database table is acquired, and second characteristic information of an application associated with each database table is acquired.
In an embodiment of the present disclosure, in particular, the first characteristic information associated with the at least one database table is collected at a predetermined time of day by deploying an automated timing collection script. Specifically, first characteristic information of each database table in at least one database table is obtained, and second characteristic information of an application program associated with each database table is obtained, so that a result file of each database table is obtained. In the subsequent operation, according to operation and maintenance experience and algorithm, according to the result file of each database table, automatically analyzing the performance characteristics and the state characteristics indicated by the result file and associated with each database table, and calculating a target database table list needing to implement recombination optimization.
The first feature information of each database table obtained may include, for example: tbname (corresponding table name), partition (corresponding partition), reorglasttime (latest reorganization time), space (space used), dssize (maximum space set), extensions (number of extensions), totalrows (total number of records), npages (using data page), nactive (formatted data page), reorgfar (number of unordered records out of 16 pages before and after), reorgnear (number of unordered records out of 16 pages before and after).
The meaning of tbname (corresponding to a table name) in the first feature information includes a table name of the database table. The meaning of partition (corresponding partition) includes a data partition or a data file partition corresponding to the database table, and the data partition corresponding to the database table a includes, for example, a beijing area and a Tianjin area, where the beijing area occupies 1-15 parts of the database table a, and the Tianjin area occupies 16-20 parts of the database table a. reorglasttime (last reorganization time) means that the database table last reorganizes the partition, and extensions means that the database table one time expands the number of data pages in the data file system. To avoid wasting time in partitioning data, a page space is formatted into the database in advance, and nactive (formatting pages of data) means that the number of pages of data formatted for the database table is included, illustratively 6 pages for the number of pages of data formatted for the database table and npages (using pages of data) for the database table is 2 pages. The meaning of reorgfar and reorgnear includes the ordering state of the data/data pages after the last reorganization of the database table.
The application conditions of different database tables are different, and different database tables may be accessed by different hosts and called by different application programs for processing. A database table may or may not have associated applications with it at least one application. The second feature information of the application program associated with each database table may include, for example: package (application name), date (call date), occur (call number), tran_time (average response time length), io_time (IO response time length).
Next, in operation S310, capacity characteristics of each database table are determined according to the first characteristic information, and response characteristics of an application associated with each database table are determined according to the second characteristic information.
In the embodiment of the present disclosure, specifically, the first feature information can represent a capacity feature of the database table, for example, may represent information such as a data capacity, a data capacity change rate, a file capacity, a data volume ratio of the data partition, and a reorganization time of the database table.
The data capacity may be represented, for example, using at least one of the following characteristic information: extensions (number of extensions), space/dssize (space utilized/maximum space set), reorgunclustins/totalrows (recent reassembly time/total number of records), npages/nactive (data page used/data page formatted), reorgfar (unordered number of records out of front and back 16 pages), reorgnear (unordered number of records out of front and back 16 pages), totalrows (total number of records), part (total number of records).
The rate of change of data capacity may be represented, for example, using at least one of the following characteristic information: space daily rate of increase s-rate = (st 2-st 1)/st 1, totalrows daily rate of increase t-rate = (tt 2-ttl)/ttl, reorgar daily rate of increase rf-rate = (rf 2-rf 1)/rf 1, reorgnerr daily rate of increase greater than 10% rn-rate = (rn 2-rn 1)/rn 1.
The file capacity may be expressed, for example, in terms of the product of the number of data pages of the database table and the size of each data page. A database table may include a plurality of data partitions, wherein the data volume of one data partition is the ratio of the data volume in that data partition to the data volume of the entire database table. The recombination time can be represented by reorglasttime, for example.
The second feature information can represent response features of the application program, and the response features can comprise information such as average response time length, response time length change rate, IO response time length occupation ratio and the like.
The average response time period may be represented using tran_time, for example. The rate of change of the response time period can be represented, for example, using IO-rate= (IOt 2-IOt 1)/IOt 1, where IOt is the IO response time period before the last reorganization optimization and IOt is the current IO response time period. The IO response time period duty cycle may be represented using IO_time/tran_time, for example.
Next, in operation S320, a target database table is determined according to the capacity characteristics and the response characteristics.
In the embodiment of the disclosure, determining a target database table according to capacity characteristics and response characteristics, including determining a database table with data capacity meeting a first preset condition according to data capacity characterized by the capacity characteristics, to obtain a first database table; determining a database table with the data capacity change rate meeting a second preset condition according to the data capacity change rate characterized by the capacity characteristics, and obtaining a second database table; determining a database table associated with the application program with the response time length meeting a third preset condition according to the response time length characterized by the response characteristics, and obtaining a third database table; and obtaining a union of the first database table, the second database table and the third database table to obtain a target database table.
And determining a database table with the data capacity meeting a first preset condition according to the data capacity characterized by the capacity characteristics, and obtaining a first database table. The first preset condition may include, for example, the following condition.
Reorglasttime is earlier than 2 years (the latest recombination time is earlier than 2 years) & space/dssize > 0.2 (space utilized/maximum space set > 0.2);
space/dssize > 40% (space utilized/set maximum space > 40%);
extensions > 100 (number of extensions > 100);
reorgunclustins/totalrows > 2% (recent recombination time/total number of recordings > 2%);
npages/nactive < 50% (using data page/formatted data page < 50%) & space/dssize > 25% (space utilized/maximum space set > 25%);
reorgfar > 100000 (unordered record number > 100000 out of 16 pages before and after);
reorgnear > 100000 (unordered records out of 16 pages before and after > 100000).
The database table satisfying any one of the first preset conditions is the first database table. According to the conditions, the database table with the overlarge data capacity can be screened out. When the data capacity of the database table is overlarge, occupied data files are overlarge, and the disk consumption is huge. In order to improve the performance of the database table and ensure the calling efficiency of the database table, the database table with the data capacity exceeding a preset threshold value needs to be optimized.
And determining a database table with the data capacity change rate meeting a second preset condition according to the data capacity change rate characterized by the capacity characteristics, and obtaining a second database table. The second preset condition may include, for example, the following condition.
Space (space utilized) daily rate of increase s-rate = (st 2-st 1)/st 1 is greater than 0.5% & totalrows daily rate of increase t-rate = (tt 2-tt 1)/tt 1 is less than 0.5%;
reorgfar (disordered records out of 16 pages before and after) the daily growth rate is greater than 10% rf-rate= (rf 2-rf 1)/rfl:
reorgnerr (number of unordered records out of 16 pages back and forth) the daily growth rate is greater than 10% rn-rate= (rn 2-rn 1)/rn 1.
And the database table meeting any second preset condition is the second database table. According to the above conditions, a database table with an excessively large data capacity change rate can be screened out. When the data capacity change rate of the database table is too large, the data capacity of the database table is indicated to be increased rapidly, which may lead to insufficient space of the database table and even may induce explosion of the table. In order to improve the performance of the database table and ensure the calling efficiency of the database table, the database table with the data capacity change rate exceeding a preset threshold value needs to be optimized.
And determining a database table associated with the application program of which the response time length meets a third preset condition according to the response time length represented by the response characteristics, and obtaining a third database table. The third preset condition may include, for example, the following condition.
Tran_time > 5s (average response time > 5 s) & IO_time/tran_time > 90% (IO response time/average response time > 90%);
The rate of increase IOrate = (IOt-IOt 1)/IOt 1 of io_time (IO response duration) is greater than 1%.
And the database table meeting any of the third preset conditions is the third database table. When the response time of the application program associated with the database table exceeds a preset threshold value, the use efficiency of the database table is deteriorated when the application program calls the database table for data processing, which may result in slow transaction response time and long batch execution time, so that the determined third database table needs to be optimized.
And obtaining a union set of the first database table, the second database table and the third database table, wherein the centralized database table is a target database table which needs to be optimized. However, since the migration of data in the database table is involved in the optimization processing of the database table, the transaction operation and the data access cannot be performed during the data migration. Illustratively, the data migration time requires 5 times of 30 seconds, during which two transactions may occur. However, when the data capacity in the database table is too large, the large-capacity transaction is not operable in the data migration process, and normal transaction operation and data access are affected. Meanwhile, when the data capacity in the database is too large, there may be no suitable window for data migration. Therefore, to ensure the database table optimizing effect and reduce the influence of the database table optimizing on the normal transaction operation and the data access, the database tables in the union need to be cleaned, and the database tables with the data capacity meeting certain conditions are removed.
Optionally, the embodiment of the disclosure further includes removing a fourth database table in the union to obtain the target database table, where the fourth database table is a database table whose data capacity satisfies a fourth preset condition.
And determining a database table with the data capacity meeting a fourth preset condition according to the data capacity characterized by the capacity characteristics, and obtaining a fourth database table. The fourth preset condition may include, for example, the following condition.
Space/dssize > 70% (space utilized/maximum space set > 70%) & npages/nactive > 85% (data page used/data page formatted > 85%);
partition > 256 or totalrows (total number of records) > 1 billion.
And respectively representing the first database table, the second database table, the third database table and the fourth database table by using T1, T2, T3 and T4, and determining a target database table set T5=T1+T2+T3-T4 needing optimization processing.
Then, in operation S230, an optimization process is performed on the target database table.
In the embodiment of the disclosure, specifically, the database tables in T1, T2, T3, and T4 have corresponding called frequencies, where the called frequencies are called times of the database tables in a single hour. In optimizing the target database table, the embodiment of the disclosure may further include, for example, determining a called frequency of the target database table, and then determining an optimization processing frequency of the target database table according to the called frequency.
The higher the frequency of database tables called, the greater the number of times the database tables are called to conduct transactions per unit time. In order to reduce the influence of database table optimization on the transaction behavior of a user, the optimization processing frequency of the target database table is determined according to the called frequency of the target database table, specifically, the higher the called frequency is, the lower the corresponding optimization processing frequency is. For example, for a database table with a called frequency of 5000, the database table is called for 5000 times in one hour, the data migration time of the database table is about 150 seconds, the number of completed transactions is about 2, and the database table is optimized, so that the optimization frequency of the database table can be set to be twice a week.
Illustratively, determining the optimized processing frequency of the target database table according to the invoked frequency may include, for example:
T5(A)=T1+T2+T3-T4,occur<5000;
T5(B)=T1+T2+T3-T4,5000<=occur<36000;
T5(C)=T1+T2+T3-T4,occur>36000;
The target database table set t5=t1+t2+t3-T4, where T5 includes T5 (a), T5 (B), and T5 (C), and the frequencies of calls to database tables in T5 (a), T5 (B), and T5 (C) are occur different. Determining an optimization frequency according to the called frequency of the target database table, wherein the optimization frequency is determined to be twice weekly for T5 (A) of occur < 5000; for T5 (B) of 5000 < = occur < 36000, determining the optimization treatment frequency to be once a month; for occur > 36000, the optimization frequency is determined to be once per quarter.
Fig. 3B schematically illustrates a flow chart of a processing method for optimizing database tables according to another embodiment of the present disclosure. As shown in fig. 3B, embodiments of the present disclosure may further include, for example:
in operation S410, it is determined whether the database table is a target database table according to the capacity characteristics and the response characteristics associated with the database table. If the determination result is no, operation S420 is executed, and if the determination result is yes, operation S450 is executed.
In operation S420, it is determined whether the database table is an abnormal database table containing the target data partition. Wherein, the operation is ended if the determination result is no, and the operation S430 is performed if the determination result is yes.
In operation S430, it is determined whether the file capacity of the database table exceeds a second preset threshold. If the determination result is no, operation S440 is performed, and if the determination result is yes, it is determined that the database table is the target database table, and operation S450 is performed.
In operation S440, an anomaly database table is monitored.
In operation S450, an optimization process is performed on the target database table.
Ending after operation S440 and operation S450.
That is, determining an abnormal database table including a target data partition among other database tables except the target database table, wherein the ratio of the data capacity of the target data partition to the data capacity of the abnormal database table exceeds a first preset threshold; determining whether the file capacity of the abnormal database table exceeds a second preset threshold; and if so, determining the abnormal database table as a target database table needing to be subjected to optimization processing.
After determining the target database table to be optimized according to the capacity characteristics and the response characteristics, determining whether the target database table to be optimized exists or not according to other rules for other database tables except the target database table. Specifically, among the database tables other than the target database table, an abnormal database table including the target data partition is determined. The database table may include a plurality of data partitions, the target data partition is a data partition with a data capacity ratio exceeding a preset threshold, further, the ratio of the data capacity of the target data partition to the data capacity of the database table where the target data partition is located exceeds a first preset threshold, and the database table containing the target data partition is determined as an abnormal database table. Optionally, the first preset threshold is 80%.
After the abnormal database table is determined, outputting the data distribution current situation and the data growth history of the abnormal database table, so that research and development personnel can estimate the data growth trend of the abnormal database table according to the data distribution current situation and the data growth history, and determine the risk level of the abnormal database table according to the data growth trend.
The database table B contains 5 data partitions, wherein the data in the data partition B (1) is transaction record data of users in beijing area, the ratio of the data capacity of the data partition B (1) to the data capacity of the database table B reaches 90%, exceeds a first preset threshold, the data in the database table B is concentrated in the data partition B (1), and the data capacity of the rest of the data partition is too small, so that the database table B needs to be optimized, for example, the optimization may include repartitioning the database table B into only the data partition B (1), and even may include continuing to partition the data partition B (1) into a plurality of sub-partitions, for example, by region, dividing the data partition B (1) into a lake region, a cation region, a west city region, an east city region, and other beijing regions.
After determining the abnormal database table containing the target data partition, continuously determining whether the file capacity in the abnormal database exceeds a second preset threshold value, and if so, determining the abnormal database table as the target database table needing to be subjected to optimization processing. The file size is the product of the number of pages of data contained in the database table and the size of each page of data, illustratively, database table C contains 10 pages of data, each page of data having a size of 4K. Optionally, the second preset threshold is 25%.
After the target database table needing to be optimized is determined, triggering operation of the optimizing operation is automatically executed, so that a list in the optimizing operation is automatically loaded, and the optimizing processing of the target database table is performed in parallel in the main equipment center and the standby equipment center. The main equipment center has high load and rich system resources, and simultaneously bears a large amount of transaction operations; the standby equipment center is low in load, system resources are scarce, and does not assume transaction operations. The target database table optimization operations of the main equipment center and the standby equipment center can be performed simultaneously or not.
According to the embodiment of the disclosure, the first characteristic information of each database table and the second characteristic information of the application program associated with each database table are automatically collected, the target database table needing to be optimized is automatically detected according to the first characteristic information and the second characteristic information, and then automatic adjustment is implemented. The method is beneficial to realizing the distribution optimization of the database table, improving the performance of the application program related to the database table and guaranteeing the high-efficiency stability performance of the database table of the main equipment center. Meanwhile, the target database table optimization processing is high in automation degree, high in instantaneity and capable of effectively controlling the optimization cost, and the problems of slow transaction response and long batch execution time are solved.
Fig. 4 schematically illustrates a block diagram of a processing apparatus for optimizing database tables according to an embodiment of the present disclosure.
As shown in fig. 4, the processing apparatus 400 includes an acquisition module 401, a first determination module 402, and an optimization processing module 403. The processing device may perform the method described above with reference to the method embodiment section, and will not be described here again.
Specifically, the obtaining module 401 is configured to obtain first feature information of each database table in the at least one database table, and obtain second feature information of an application program associated with each database table. A first determining module 402, configured to determine a target database table that needs to be optimized according to the first feature information and the second feature information; and an optimization processing module 403, configured to perform optimization processing on the target database table.
According to the embodiment of the disclosure, first characteristic information of each database table in at least one database table is obtained, second characteristic information of an application program associated with each database table is obtained, then a target database table needing to be optimized is determined according to the first characteristic information and the second characteristic information, and further optimization is performed on the target database table. According to the embodiment of the disclosure, the target database table to be optimized is determined according to the acquired characteristic information associated with each database table, so that the automatic determination of the target database table can be realized, the screening efficiency of the target database table is improved, and the optimization efficiency and the optimization effect of the target database table are improved; meanwhile, the labor cost and time cost of screening the target database table are effectively reduced, the optimization cost of the target database table is further effectively reduced, the performance of the database table is guaranteed, the response time of data processing is shortened, and the time consumption of batch business processing is controlled.
As an alternative embodiment, the processing device includes, in addition to the acquisition module 401, the first determination module 402, and the optimization processing module 403 shown in fig. 5, the first determination module further includes a first determination submodule, configured to determine a capacity feature of each database table according to the first feature information; a second determining sub-module for determining a response characteristic of the application associated with each database table according to the second characteristic information; and a third determination submodule for determining a target database table according to the capacity characteristics and the response characteristics.
As an alternative embodiment, the third determining sub-module comprises: the first processing unit is used for determining a database table with the data capacity meeting a first preset condition according to the data capacity characterized by the capacity characteristics to obtain a first database table; the second processing unit is used for determining a database table with the data capacity change rate meeting a second preset condition according to the data capacity change rate characterized by the capacity characteristics to obtain a second database table; the third processing unit is used for determining a database table associated with the application program, the response time length of which meets a third preset condition, according to the response time length characterized by the response characteristics, so as to obtain a third database table; and a fourth processing unit, configured to obtain a union of the first database table, the second database table, and the third database table, to obtain a target database table.
As an alternative embodiment, the fourth processing unit includes: and the first processing subunit is used for removing the fourth database table in the union set to obtain a target database table, wherein the fourth database table is a database table with data capacity meeting a fourth preset condition.
As an optional embodiment, the processing apparatus further includes a second determining module, where the second determining module includes a fourth determining submodule configured to determine, among other database tables except the target database table, an abnormal database table including the target data partition, where a ratio of a data capacity of the target data partition to a data capacity of the abnormal database table exceeds a first preset threshold; a fifth determining submodule, configured to determine whether a file capacity of the abnormal database table exceeds a second preset threshold; and the sixth determining submodule is used for determining the abnormal database table as a target database table needing to be optimized under the condition that the file capacity of the abnormal database table exceeds a second preset threshold value.
As an alternative embodiment, the optimization processing module includes at least one of: the first processing sub-module is used for carrying out data partition processing on the target database table again; and the second processing sub-module is used for carrying out aggregation processing on blank data in the target database table.
According to the embodiment of the disclosure, the first characteristic information of each database table and the second characteristic information of the application program associated with each database table are automatically collected, the target database table needing to be optimized is automatically detected according to the first characteristic information and the second characteristic information, and then automatic adjustment is implemented. The method is beneficial to realizing the distribution optimization of the database table, improving the performance of the application program related to the database table and guaranteeing the high-efficiency stability performance of the database table of the main equipment center. Meanwhile, the target database table optimization processing is high in automation degree, high in instantaneity and capable of effectively controlling the optimization cost, and the problems of slow transaction response and long batch execution time are solved.
Any number of the modules, or at least some of the functionality of any number, according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules according to embodiments of the present disclosure may be implemented as split into multiple modules. Any one or more of the modules according to embodiments of the present disclosure may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system-on-chip, a system-on-a-substrate, a system-on-a-package, an Application Specific Integrated Circuit (ASIC), or in hardware or firmware in any other reasonable manner of integrating or packaging the circuits, or in any one of or in any suitable combination of three of software, hardware, and firmware. Or one or more of the modules according to embodiments of the present disclosure may be at least partially implemented as computer program modules that, when executed, perform the corresponding functions.
For example, any of the fetching module 401, the first determining module 402, and the optimizing processing module 403 may be combined in one module to be implemented, or any of the modules may be split into a plurality of modules. Or at least some of the functionality of one or more of the modules may be combined with, and implemented in, at least some of the functionality of other modules. According to embodiments of the present disclosure, at least one of the acquisition module 401, the determination module 402, the optimization processing module 403, and the notification module 404 may be implemented at least in part as hardware circuitry, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware in any other reasonable way of integrating or packaging the circuitry, or in any one of or a suitable combination of any of the three implementations of software, hardware, and firmware. Or at least one of the acquisition module 401, the determination module 402, the optimization processing module 403 and the notification module 404 may be at least partially implemented as a computer program module which, when executed, may perform the respective functions.
Fig. 5 schematically illustrates a block diagram of an electronic device according to an embodiment of the disclosure. The electronic device shown in fig. 5 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 5, the electronic device 500 includes a processor 510, a computer-readable storage medium 520. The electronic device 500 may perform methods according to embodiments of the present disclosure.
In particular, processor 510 may include, for example, a general purpose microprocessor, an instruction set processor and/or an associated chipset and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), or the like. Processor 510 may also include on-board memory for caching purposes. Processor 510 may be a single processing module or multiple processing modules for performing the different actions of the method flows according to embodiments of the disclosure.
Computer-readable storage medium 520, which may be, for example, a non-volatile computer-readable storage medium, specific examples include, but are not limited to: magnetic storage devices such as magnetic tape or hard disk (HDD); optical storage devices such as compact discs (CD-ROMs); a memory, such as a Random Access Memory (RAM) or a flash memory; etc.
The computer-readable storage medium 520 may include a computer program 521, which computer program 521 may include code/computer-executable instructions that, when executed by the processor 510, cause the processor 510 to perform a method according to an embodiment of the present disclosure or any variation thereof.
The computer program 521 may be configured with computer program code comprising, for example, computer program modules. For example, in an example embodiment, code in computer program 521 may include one or more program modules, including, for example, 521A, 521B, … …. It should be noted that the division and number of modules is not fixed, and that a person skilled in the art may use suitable program modules or combinations of program modules according to the actual situation, which when executed by the processor 510, enable the processor 510 to perform the method according to embodiments of the present disclosure or any variations thereof.
According to an embodiment of the present disclosure, at least one of the acquisition module 401, the first determination module 402 and the optimization processing module 403 may be implemented as computer program modules described with reference to fig. 5, which, when executed by the processor 510, may implement the respective operations described above.
The present disclosure also provides a computer-readable storage medium that may be embodied in the apparatus/device/system described in the above embodiments; or may exist alone without being assembled into the apparatus/device/system. The computer-readable storage medium carries one or more programs which, when executed, implement methods in accordance with embodiments of the present disclosure.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
It will be understood by those skilled in the art that while the present disclosure has been shown and described with reference to particular exemplary embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present disclosure as defined by the appended claims and their equivalents. The scope of the disclosure should, therefore, not be limited to the above-described embodiments, but should be determined not only by the following claims, but also by the equivalents of the following claims.

Claims (6)

1. A processing method for optimizing a database table, comprising:
Acquiring first characteristic information of each database table in at least one database table, and acquiring second characteristic information of an application program associated with each database table;
Determining a target database table to be optimized according to the first characteristic information and the second characteristic information; and
Optimizing the target database table,
The determining, according to the first feature information and the second feature information, a target database table that needs to be optimized includes: determining capacity characteristics of each database table according to the first characteristic information; determining response characteristics of the application program associated with each database table according to the second characteristic information; determining the target database table according to the capacity characteristic and the response characteristic;
Wherein said determining said target database table based on said capacity characteristics and said response characteristics comprises: determining a database table of which the data capacity meets a first preset condition according to the data capacity characterized by the capacity characteristics, and obtaining a first database table; determining a database table of which the data capacity change rate meets a second preset condition according to the data capacity change rate characterized by the capacity characteristics, and obtaining a second database table; determining a database table associated with the application program of which the response time length meets a third preset condition according to the response time length characterized by the response characteristics, and obtaining a third database table; obtaining a union of the first database table, the second database table and the third database table to obtain the target database table;
The obtaining the union of the first database table, the second database table and the third database table to obtain the target database table includes: removing a fourth database table in the union to obtain the target database table, wherein the fourth database table is a database table with the data capacity meeting a fourth preset condition;
Wherein the optimizing the target database table includes at least one of: carrying out data partition processing again on the target database table; and carrying out aggregation processing on blank data in the target database table.
2. The method of claim 1, after determining a target database table that requires optimization based on the first characteristic information and the second characteristic information, the method further comprising:
Determining an abnormal database table containing a target data partition in other database tables except the target database table, wherein the ratio of the data capacity of the target data partition to the data capacity of the abnormal database table exceeds a first preset threshold;
Determining whether the file capacity of the abnormal database table exceeds a second preset threshold;
If yes, determining the abnormal database table as a target database table needing to be subjected to optimization processing.
3. The method of claim 1, further comprising:
determining the called frequency of the target database table;
and determining the optimization processing frequency of the target database table according to the called frequency.
4. A processing apparatus for optimizing a database table, comprising:
The system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring first characteristic information of each database table in at least one database table and acquiring second characteristic information of an application program associated with each database table;
the first determining module is used for determining a target database table which needs to be optimized according to the first characteristic information and the second characteristic information; and
An optimization processing module for performing optimization processing on the target database table,
The determining, according to the first feature information and the second feature information, a target database table that needs to be optimized includes: determining capacity characteristics of each database table according to the first characteristic information; determining response characteristics of the application program associated with each database table according to the second characteristic information; determining the target database table according to the capacity characteristic and the response characteristic;
Wherein said determining said target database table based on said capacity characteristics and said response characteristics comprises: determining a database table of which the data capacity meets a first preset condition according to the data capacity characterized by the capacity characteristics, and obtaining a first database table; determining a database table of which the data capacity change rate meets a second preset condition according to the data capacity change rate characterized by the capacity characteristics, and obtaining a second database table; determining a database table associated with the application program of which the response time length meets a third preset condition according to the response time length characterized by the response characteristics, and obtaining a third database table; obtaining a union of the first database table, the second database table and the third database table to obtain the target database table;
The obtaining the union of the first database table, the second database table and the third database table to obtain the target database table includes: removing a fourth database table in the union to obtain the target database table, wherein the fourth database table is a database table with the data capacity meeting a fourth preset condition;
Wherein the optimizing the target database table includes at least one of: carrying out data partition processing again on the target database table; and carrying out aggregation processing on blank data in the target database table.
5. An electronic device, comprising:
One or more processors;
A memory for storing one or more programs,
Wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-3.
6. A computer readable storage medium storing computer executable instructions which when executed are adapted to implement the method of any one of claims 1 to 3.
CN202010545244.3A 2020-06-15 2020-06-15 Processing method and device for optimizing database table Active CN111694816B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010545244.3A CN111694816B (en) 2020-06-15 2020-06-15 Processing method and device for optimizing database table

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010545244.3A CN111694816B (en) 2020-06-15 2020-06-15 Processing method and device for optimizing database table

Publications (2)

Publication Number Publication Date
CN111694816A CN111694816A (en) 2020-09-22
CN111694816B true CN111694816B (en) 2024-04-23

Family

ID=72481087

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010545244.3A Active CN111694816B (en) 2020-06-15 2020-06-15 Processing method and device for optimizing database table

Country Status (1)

Country Link
CN (1) CN111694816B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112783732B (en) * 2021-01-29 2023-10-10 中国农业银行股份有限公司 Database table capacity monitoring method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101059810A (en) * 2007-03-16 2007-10-24 华为技术有限公司 System and method for implementing automatic optimization of data base system
CN104714984A (en) * 2013-12-17 2015-06-17 中国移动通信集团湖南有限公司 Database optimization method and device
CN106528896A (en) * 2016-12-29 2017-03-22 网易(杭州)网络有限公司 Database optimization method and apparatus

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9582526B2 (en) * 2014-05-02 2017-02-28 International Business Machines Corporation Optimizing database definitions in an existing database

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101059810A (en) * 2007-03-16 2007-10-24 华为技术有限公司 System and method for implementing automatic optimization of data base system
CN104714984A (en) * 2013-12-17 2015-06-17 中国移动通信集团湖南有限公司 Database optimization method and device
CN106528896A (en) * 2016-12-29 2017-03-22 网易(杭州)网络有限公司 Database optimization method and apparatus

Also Published As

Publication number Publication date
CN111694816A (en) 2020-09-22

Similar Documents

Publication Publication Date Title
CN109739929B (en) Data synchronization method, device and system
CN111367984B (en) Method and system for loading high-timeliness data into data lake
CN109981702B (en) File storage method and system
CN110727685B (en) Data compression method, equipment and storage medium based on Cassandra database
CN109840248B (en) Operation flow optimization method and device and storage medium
CN111694816B (en) Processing method and device for optimizing database table
CN112988679A (en) Log collection control method and device, storage medium and server
CN110543279B (en) Data storage and processing method, device and system
WO2023071969A1 (en) Manycore system-based task scheduling method and system, electronic device, and medium
CN114153609A (en) Resource control method and device, electronic equipment and computer readable storage medium
CN105912664B (en) File processing method and equipment
US11250001B2 (en) Accurate partition sizing for memory efficient reduction operations
CN116248699A (en) Data reading method, device, equipment and storage medium in multi-copy scene
CN108090224B (en) Cascade connection method and device
US10956369B1 (en) Data aggregations in a distributed environment
CN114546714B (en) Data backup method, system, device and storage medium
CN114020214A (en) Storage cluster capacity expansion method and device, electronic equipment and readable storage medium
CN108279973B (en) Information statistical method and device and electronic equipment
US20170010935A1 (en) Dumping resources
CN114116790A (en) Data processing method and device
CN117493296A (en) Data migration method, device, electronic equipment and storage medium
CN111459937B (en) Data table association method, device, server and storage medium
CN117591301B (en) Monitoring cloud resource allocation optimization method and system
CN116932551A (en) Data table processing method and device, electronic equipment and storage medium
CN116048840A (en) Multi-tenant-based order ES high-speed writing method and system

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