Statistical information management method and device, electronic equipment, medium and program product
By determining the access frequency and target operation amount of each data table based on the data operation parameters, and timely updating the statistical information of the data table, the problem of untimely update of statistical information in the existing technology is solved, and the performance of database data query is improved.
Patent Information
- Application Number
- CN202510049347.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-13
- Publication Date
- 2025-04-22
AI Technical Summary
In the prior art, the determination threshold for automatic collection and update of statistical information cannot be configured according to a single data table in the database, resulting in a long interval of statistical information updates in some data tables, which in turn affects the data query performance.
By obtaining the data operation parameters corresponding to the target structured query language, the access frequency and target operation amount of each data table are determined. If the target operation amount is greater than the operation amount threshold corresponding to the data table, the statistical information of the data table is updated.
It ensures that the statistical information of each data table can be updated in a timely manner, avoids the decline in data query performance caused by untimely update of statistical information, and improves the query efficiency of data in the database.
Smart Images

Figure CN119862193A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a statistical information management method, device, electronic device, medium and program product. Background Art
[0002] Statistical information refers to information used to describe the size, scale, and data distribution of tables and indexes in a database. When querying data in a distributed database, correct statistical information can instruct the database optimizer to find a data query method suitable for the database, thereby effectively improving the efficiency of data query.
[0003] Currently, the collection and update of statistical information is automatically triggered when the data update scale in the database reaches a certain threshold, and the minimum granularity of collecting and updating statistical information is the table in the database.
[0004] However, the threshold for automatically collecting and updating statistics cannot be configured for a single data table in the database, so that the statistics of the entire database are updated through the same database update threshold. As a result, the time interval for collecting and updating statistics for some data tables is long, resulting in untimely updates of statistics, which in turn makes it impossible to determine the correct query plan when querying data, resulting in reduced data query performance. Summary of the invention
[0005] The present application provides a statistical information management method, device, electronic device, medium and program product to solve the problem in the prior art that the time interval for collecting and updating statistical information of some data tables is long, resulting in untimely statistical information updates, which in turn leads to the inability to determine the correct query plan when querying data, resulting in reduced data query performance.
[0006] In a first aspect, the present application provides a statistical information management method, the method comprising:
[0007] Obtain data operation parameters corresponding to the target structured query language;
[0008] Determine the access frequency and target operation amount of each data table in the target database according to the data operation parameter; wherein the target database includes a plurality of the data tables, and the target operation amount is used to represent the ratio of the operated data in the data table to the total amount of data in the data table;
[0009] For each of the data tables, if the target operation volume is greater than an operation volume threshold corresponding to the data table, the statistical information of the data table is updated.
[0010] In a second aspect, the present application provides a statistical information management device, the device comprising:
[0011] An acquisition module, used to acquire data operation parameters corresponding to the target structured query language;
[0012] A determination module, configured to determine the access frequency and target operation amount of each data table in a target database according to the data operation parameter; wherein the target database includes a plurality of the data tables, and the target operation amount is used to characterize the ratio of the operated data in the data table to the total amount of data in the data table;
[0013] An updating module is used to update the statistical information of each data table if the target operation amount is greater than the operation amount threshold corresponding to the data table.
[0014] In a third aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the statistical information management method as described in any embodiment of the present application is implemented.
[0015] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the statistical information management method as described in any embodiment of the present application.
[0016] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the statistical information management method as described in any embodiment of the present application.
[0017] The scheme of the present application obtains data operation parameters corresponding to the target structured query language; determines the access frequency and target operation volume of each data table in the target database according to the data operation parameters; wherein the target database includes multiple data tables, and the target operation volume is used to characterize the ratio of the operated data in the data table to the total amount of data in the data table; for each data table, if the target operation volume is greater than the operation volume threshold corresponding to the data table, the statistical information of the data table is updated. That is, the scheme of the present application, for each data table, when it is determined that the target operation volume is greater than the operation volume threshold of the table, the statistical information of the table is updated, ensuring that the optimizer of the target database can determine the query method suitable for the data in the database according to the latest statistical information, thereby avoiding the situation where the statistical information is not updated in time due to the long interval between the collection and update of statistical information of some data tables, thereby enabling the optimizer to determine the appropriate data operation execution plan and improve the query performance of the data in the database. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 It is a flowchart of the statistical information management method provided by this application;
[0020] Figure 2 is another flow chart of the statistical information management method provided by the present application;
[0021] Figure 3 It is a structural schematic diagram of the statistical information management device provided by the present application;
[0022] Figure 4 It is a structural schematic diagram of the electronic device provided by this application. DETAILED DESCRIPTION
[0023] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0024] The acquisition, storage, use, and processing of data in the technical solution of this application comply with the relevant provisions of national laws and regulations.
[0025] Figure 1 The present invention provides a flow chart of a statistical information management method, which can be executed by a statistical information management device, which can be implemented in software and / or hardware. In a specific embodiment, the device can be applied to an electronic device, which can be a computer. The following embodiments will be described by taking the application of the device in an electronic device as an example, referring to Figure 1 , the method may specifically include the following steps:
[0026] Step 101: Obtain data operation parameters corresponding to the target structured query language.
[0027] Specifically, Structured Query Language (SQL) is a database query and programming language used to access data, query, update and manage relational database systems. The target structured query language is the structured query language corresponding to the currently performed database query operation. The data operation parameters corresponding to the target structured query language are multiple parameters that can characterize the operations performed by the target structured query language on the data in the database, for example, the data operation parameters include pre-modification information and post-modification information of multiple modified data. The method of obtaining the data operation parameters corresponding to the target structured query language can be that the electronic device executing this embodiment sends a data operation parameter acquisition request to the device that inputs the target structured query language to the target database once every preset time interval, and the received parameters are returned by the device that inputs the target structured query language. It can also be the data operation parameters obtained after the electronic device executing this embodiment collects the data operation parameters corresponding to the target structured query language once every preset time interval, and this application does not limit this.
[0028] Optionally, the data operation parameters include operation data type, operation object, operation data volume, operation execution times and parameter acquisition time.
[0029] Specifically, the data operation parameters corresponding to the target structured query language include the operation data type corresponding to the target structured query language, the operation object corresponding to the target structured query language, the operation data volume corresponding to the target structured query language, the operation execution times corresponding to the target structured query language, and the parameter acquisition time of the target structured query language. The operation data type corresponding to the target structured query language is the type of SQL executed, such as the operation of adding, deleting, modifying and checking data. The operation object corresponding to the target structured query language is the operation object of SQL, such as a certain data table. The operation data volume corresponding to the target structured query language is the data volume of the operation executed by SQL, such as operating 1000 data in a certain data table. The operation execution times corresponding to the target structured query language is the number of times SQL is executed, and the parameter acquisition time of the target structured query language is the interval time for acquiring the data operation parameters. Limiting the data operation parameters can refine the parameters that need to be obtained, provide a data basis for the subsequent operation of updating statistical information according to the parameters, so as to improve the efficiency of the subsequent statistical information update according to the parameters, thereby further improving the query performance of the data in the database.
[0030] Optionally, before executing step 101, steps 11 to 13 may also be executed.
[0031] Step 11: Obtain the target structured query language.
[0032] Specifically, the target structured query language may be obtained by sending a target structured query language acquisition request to a device that inputs the target structured query language to a target database by an electronic device executing this embodiment, and then receiving the target structured query language returned by the device that inputs the target structured query language. Alternatively, the target structured query language may be obtained by collecting the target structured query language by the electronic device executing this embodiment, and this application does not limit this.
[0033] Step 12: determining a target execution operation of the target database according to the target structured query language, statistical information of the target database, and preset execution operation judgment rules.
[0034] Specifically, the statistical information of the target database refers to information used to describe the size, scale, data distribution status, etc. of tables and indexes in the database. In the case where the database is composed of multiple data tables, the statistical information of the database is information that describes the size, scale, data distribution status, etc. of multiple data tables in the database. The preset execution operation is a preset way of executing an operation on the target database. For example, the preset execution operation may include an index scan database and a full table scan database. The preset execution operation judgment rule refers to a rule for judging which execution operation among the preset execution operations is applicable to the current database. For example, the preset execution operation judgment rule is to select an execution operation that consumes less memory as the target execution operation. Determining the target execution operation of the target database according to the target structured query language, the statistical information of the target database, and the preset execution operation judgment rule can be achieved by controlling the optimizer of the database. The optimizer of the database is a core component in the database management system. Its main responsibility is to select the optimal execution operation when executing a structured query language query, thereby determining how the database accesses data, which indexes in the database are used, and the order of connecting tables. The optimizer can select the execution operation that consumes the least memory to execute the query by comparing multiple possible execution operations and the memory size required for each execution operation. The optimizer determines the target data according to the target structured query language, and then determines the location of the target data through the statistical information of the target database, and then determines the target execution operation of the target database according to the location of the target data and the preset execution operation judgment rules. As a result, the target execution operation of the database is the optimal execution operation corresponding to the target database, thereby improving the efficiency of the operation execution in the database.
[0035] For example, there is an index in the a field of a certain table, but there are 10,000 rows of 0 and 1 row of 1 in the a field data. At this time, if the target structured query language indicates that the information is to find a=1, the optimizer determines from the statistical information that the number of occurrences of 1 is one time. At this time, the memory consumed by the index scan database is less than the memory consumed by the full table scan database. Therefore, the optimizer determines the index scan database as the target execution operation according to the preset execution operation judgment rule. However, if the target structured query language indicates that the information is to find a=0, the optimizer determines from the statistical information that the number of occurrences of 0 is 10,000 times. At this time, the memory consumed by the index scan database is greater than the memory consumed by the full table scan database. The efficiency of the index scan is much lower than that of the full table scan. Therefore, the optimizer determines the full table scan database as the target execution operation according to the preset execution operation judgment rule.
[0036] Step 13, performing an operation in the target database according to the target execution operation, and obtaining the target database after the execution of the operation.
[0037] Specifically, after determining the target execution operation, the target execution operation is executed in the target database according to the target execution operation, such as performing operations of adding, deleting, modifying and querying data in the database, and obtaining the target database after executing the target execution operation.
[0038] Step 102: Determine the access frequency and target operation volume of each data table in the target database according to the data operation parameters.
[0039] The target database includes multiple data tables, and the target operation volume is used to represent the ratio of the operated data in the data table to the total amount of data in the data table.
[0040] Specifically, the access frequency of a data table is the frequency at which the table is accessed when the operation corresponding to the target structured query language is executed. The target database includes multiple data tables. After the operation corresponding to the target structured query language is executed, the data in multiple tables of the target database changes, and the change can be characterized by the data operation parameters. Therefore, the access frequency and target operation amount of each data table in the target database can be determined according to the data operation parameters.
[0041] Exemplarily, the number of rows of operated data in the data table is 500 rows, and the number of rows of all data in the data table is 10,000 rows, so the target operation volume is 5%.
[0042] Optionally, the target operation volume includes a ratio of a total operation data volume to the number of rows in the data table.
[0043] Specifically, the total amount of operation data refers to the amount of data that has changed after the data table has been accessed multiple times. The target amount of operation includes the ratio of the total amount of operation data to the number of rows in the data table, making the target amount of operation more accurate, providing a data basis for subsequent steps, and thus improving the accuracy of the statistical information update of the data table.
[0044] Exemplarily, the total number of rows in the data table is 10,000 rows. If the total operation data volume is 1,000 rows of data updated, the target operation volume is 1,000 / 10,000*100%=10%.
[0045] Step 103: for each data table, if the target operation volume is greater than the operation volume threshold corresponding to the data table, the statistical information of the data table is updated.
[0046] Specifically, the statistical information of the data table is the information in the statistical information of the target database that can describe the size, scale and data distribution status of the index of each data table. The operation volume threshold refers to the data volume change in the data table reaching the threshold, at which time it is determined to update the statistical information. The operation volume threshold corresponding to the data table can be the corresponding preset operation volume threshold set according to the data volume size of each data table. For example, the data volume of data table A is large, and the corresponding preset operation volume threshold set is 5%, and the data volume of data table B is small, and the corresponding preset operation volume threshold set is 10%. The operation volume threshold corresponding to the data table can also be the operation threshold obtained according to the data volume, access frequency and threshold determination rule of the data table. For example, the threshold determination rule can be that the larger the data volume and the higher the access frequency, the smaller the operation threshold. The operation threshold of each data table is obtained according to the data volume, access frequency and threshold determination rule. For each data table, if the target operation volume is greater than the operation volume threshold corresponding to the data table, it means that the data change in the data table has reached the threshold, so the statistical information of the data table is updated, that is, the updated statistical information can describe the information of the data in the data table after the data change occurs.
[0047] For example, if the target operation volume is 10%, the operation volume threshold corresponding to the data table is 5%. Therefore, the target operation volume is greater than the operation volume threshold corresponding to the data table. At this time, the statistical information of the data table is updated so that the updated statistical information can describe the information of the data in the data table after the data change occurs.
[0048] Optionally, when executing steps 11 to 13, after executing step 103, step 31 may also be executed.
[0049] Step 31, according to the updated statistical information corresponding to each data table, determine the statistical information corresponding to the target database after the operation is performed.
[0050] Specifically, by combining the updated statistical information corresponding to each data table in the multiple data tables in the target database, the statistical information corresponding to the target database after the operation is performed can be determined, and the statistical information is stored to facilitate the corresponding update of the updated statistical information when the target database after the operation is performed is accessed again later.
[0051] The scheme of the present application obtains data operation parameters corresponding to the target structured query language; determines the access frequency and target operation volume of each data table in the target database according to the data operation parameters; wherein the target database includes multiple data tables, and the target operation volume is used to characterize the ratio of the operated data in the data table to the total amount of data in the data table; for each data table, if the target operation volume is greater than the operation volume threshold corresponding to the data table, the statistical information of the data table is updated. That is, the scheme of the present application, for each data table, when it is determined that the target operation volume is greater than the operation volume threshold of the table, updates the statistical information of the table, ensuring that the optimizer of the target database can determine the query method suitable for the data in the database according to the latest statistical information, thereby avoiding the situation where the statistical information is not updated in time due to the long interval between the collection and update of statistical information of some data tables, thereby enabling the optimizer to determine the appropriate data operation execution plan and improve the query performance of the data in the database.
[0052] Figure 2 is another flow chart of the statistical information management method provided by the present application. Figure 1 Based on the illustrated embodiment and various optional implementation schemes, the steps of storing data operation parameters when the statistical information of the full amount of data in the data table is stored in the statistical information storage unit are described in detail. Figure 2 As shown, the method may include the following steps:
[0053] Step 201: Obtain data operation parameters corresponding to the target structured query language.
[0054] Step 202: Store the data operation parameters corresponding to the target structured query language into an access information storage unit.
[0055] Specifically, the access information storage unit is a part of memory pre-set in the electronic device executing this embodiment that can store access information. The access information storage unit stores data operation parameters corresponding to the target structured query language and historical data operation parameters corresponding to multiple historical structured query languages in the process of historically updating the data table, which are recorded as historical access information. The data operation parameters corresponding to the target structured query language are stored in the access information storage unit, so that when an error occurs in the subsequent steps, the data operation parameters can be checked in the access information storage unit to determine whether there is a fault. In the access information storage unit, the data operation parameters corresponding to the target structured query language are stored by separating hot and cold data, that is, the data operation parameters corresponding to the target structured query language are stored as accessible data, while the data operation parameters corresponding to the historical structured query language are only stored as historical access records, thereby reducing the memory space required by the access information storage unit.
[0056] Step 203, determining the access frequency and target operation amount of each data table in the target database according to the data operation parameters in the access information storage unit and the current stored data information of the data table in the statistical information storage unit.
[0057] Specifically, the statistical information storage unit is a part of memory pre-set in the electronic device executing this embodiment that can store the statistical information corresponding to the target database. According to the data operation parameters in the access information storage unit, that is, the data operation parameters corresponding to the target structured query language, and the current stored data information of the data table in the statistical information storage unit, that is, the statistical information corresponding to the data table, the access frequency and the target operation amount of each data table in the target database are determined.
[0058] Optionally, for each data table, before executing step 204 , steps 41 to 42 may also be executed.
[0059] Step 41, determining the query frequency corresponding to the data table according to the historical access information in the access information storage unit.
[0060] Specifically, the query frequency corresponding to each data table is determined according to the information on the access of each data table in the historical access information in the access information storage unit.
[0061] Exemplarily, in the historical access information, the target database is queried 10 times, of which data table A is accessed 6 times and data table B is accessed once, so the query frequency corresponding to data table A is 0.6 and the query frequency corresponding to data table B is 0.1.
[0062] Step 42: Determine the operation volume threshold corresponding to the query frequency according to the preset correspondence relationship between the query frequency and the operation volume threshold and the query frequency.
[0063] Specifically, the correspondence between the preset query frequency and the operation volume threshold is the correspondence between the preset query frequency and the operation volume threshold, which shows a relationship that the higher the query frequency, the smaller the operation volume threshold. Since the higher the query frequency, the more times the data table is accessed, and the data table with more access times has more changes, the update frequency of the statistical information corresponding to the data table should be increased accordingly. Therefore, the higher the query frequency, the smaller the operation volume threshold. According to the correspondence between the preset query frequency and the operation volume threshold and the query frequency of each data table, the operation volume threshold corresponding to the query frequency of each data table is determined.
[0064] Step 204: for each data table, if the target operation volume is greater than the operation volume threshold corresponding to the data table, the statistical information of the data table is updated.
[0065] Exemplarily, after executing the above steps, a database execution log is generated according to the above steps and the output results obtained in each step, and the log is stored in a preset log management unit, so that staff can view the log when a fault occurs to quickly identify the cause of the fault.
[0066] Exemplarily, in the above-mentioned target database, the data table can also be a total data table, that is, a data partition composed of multiple single data tables, so each data partition includes multiple single data tables. According to the data operation parameters, the access frequency and operation volume of each data partition in the target database are determined, and then for each data partition, if the target operation volume of the data partition is greater than the operation volume threshold corresponding to the data partition, the statistical information of the data partition is updated. The executable operations and optional execution steps for each data partition are the same as the operations and steps of the above-mentioned data table, and are not repeated here. Compared with triggering the collection and update tasks of statistical information by using data tables as dimensions, triggering the collection and update tasks of statistical information by using data partitions as dimensions can reduce the resource utilization of the computer, thereby improving the collection and update efficiency of statistical information.
[0067] The solution of the present application adjusts the operation threshold of each data table based on the number of times each data table is queried and accessed, thereby changing the frequency of updating statistical information, so that the more times the query is accessed, the higher the number of times the statistical information is updated, thereby ensuring that the query execution method obtained based on the statistical information is the optimal query execution method. This further avoids the situation where the interval between collecting and updating statistical information of some data tables is long, resulting in untimely statistical information updates, and further improves the query performance of the database.
[0068] Figure 3is a structural diagram of a statistical information management device provided by the present application, and the device is suitable for executing the statistical information management method provided by the present application. Figure 3 As shown, the device may specifically include:
[0069] The acquisition module 301 is used to acquire data operation parameters corresponding to the target structured query language.
[0070] The determination module 302 is used to determine the access frequency and target operation amount of each data table in the target database according to the data operation parameters; wherein the target database includes multiple data tables, and the target operation amount is used to characterize the ratio of the operated data in the data table to the total amount of data in the data table.
[0071] The updating module 303 is configured to update the statistical information of each of the data tables if the target operation amount is greater than the operation amount threshold corresponding to the data table.
[0072] In one embodiment, the data operation parameters acquired by the module 301 include operation data type, operation object, operation data volume, operation execution times and parameter acquisition time.
[0073] In one embodiment, the device also includes: a storage module, which is used to store the data operation parameters corresponding to the target structured query language in an access information storage unit after the acquisition module 301 acquires the data operation parameters corresponding to the target structured query language; the statistical information of the full amount of data in the data table is stored in the statistical information storage unit, and the determination module 302 is specifically used to: determine the access frequency and target operation amount of each data table in the target database according to the data operation parameters in the access information storage unit and the current storage data information of the data table in the statistical information storage unit.
[0074] In one embodiment, the device also includes: a threshold determination module, which is used to determine the query frequency corresponding to the data table based on the historical access information in the access information storage unit before updating the statistical information of the data table if the target operation amount is greater than the operation amount threshold corresponding to the data table in the update module 303; and determine the operation amount threshold corresponding to the query frequency based on the correspondence between the preset query frequency and the operation amount threshold and the query frequency.
[0075] In one embodiment, the device also includes: an operation execution module, which is used to obtain the target structured query language before the acquisition module 301 obtains the data operation parameters corresponding to the target structured query language; determine the target execution operation of the target database according to the target structured query language, the statistical information of the target database and the preset execution operation judgment rule; perform the operation in the target database according to the target execution operation to obtain the target database after the operation is performed; an information determination module, which is used to determine the statistical information corresponding to the target database after the operation is performed according to the updated statistical information corresponding to each data table after updating the statistical information of the data table for each data table in the update module 303 if the target operation amount is greater than the operation amount threshold corresponding to the data table.
[0076] In one embodiment, the target operation amount determined by the module 302 includes a ratio of a total operation data amount to the number of rows in the data table.
[0077] The device of the present application obtains data operation parameters corresponding to the target structured query language; determines the access frequency and target operation volume of each data table in the target database according to the data operation parameters; wherein the target database includes multiple data tables, and the target operation volume is used to characterize the ratio of the operated data in the data table to the total amount of data in the data table; for each data table, if the target operation volume is greater than the operation volume threshold corresponding to the data table, the statistical information of the data table is updated. That is, the scheme of the present application, for each data table, when it is determined that the target operation volume is greater than the operation volume threshold of the table, the statistical information of the table is updated, ensuring that the optimizer of the target database can determine the query method suitable for the data in the database according to the latest statistical information, thereby avoiding the situation where the statistical information is not updated in time due to the long interval between the collection and update of statistical information of some data tables, thereby enabling the optimizer to determine a suitable data operation execution plan and improve the query performance of the data in the database.
[0078] The present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the statistical information management method provided in any of the above embodiments when executing the program.
[0079] The present application also provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the statistical information management method provided in any of the above embodiments is implemented.
[0080] Reference below Figure 4 , which shows a structural schematic diagram of an electronic device 400 suitable for implementing the present application. Figure 4 The electronic device shown is only an example and should not bring any limitation to the function and scope of use of the present application.
[0081] like Figure 4 As shown, the electronic device 400 includes a central processing unit (CPU) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage part 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 are also stored. The CPU 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0082] The following components are connected to the I / O interface 405: an input section 406 including a keyboard, a mouse, etc.; an output section 407 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 408 including a hard disk, etc.; and a communication section 409 including a network interface card such as a LAN card, a modem, etc. The communication section 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to the I / O interface 405 as needed. A removable medium 411, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 410 as needed, so that a computer program read therefrom is installed into the storage section 408 as needed.
[0083] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 409, and / or installed from the removable medium 411. When the computer program is executed by the central processing unit (CPU) 401, the above-mentioned functions defined in the system of the present application are executed.
[0084] It should be noted that the computer-readable medium shown in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0085] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0086] The modules and / or units described in this application may be implemented in software or hardware. The modules and / or units described may also be set in a processor. For example, they may be described as: a processor includes an acquisition module, a determination module, and an update module. The names of these modules do not, in some cases, constitute limitations on the modules themselves.
[0087] As another aspect, the present application also provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device performs the following operations:
[0088] Obtain data operation parameters corresponding to the target structured query language; determine the access frequency and target operation volume of each data table in the target database according to the data operation parameters; wherein the target database includes multiple data tables, and the target operation volume is used to characterize the ratio of the operated data in the data table to the total amount of data in the data table; for each data table, if the target operation volume is greater than the operation volume threshold corresponding to the data table, update the statistical information of the data table.
[0089] According to the technical solution of the present application, the data operation parameters corresponding to the target structured query language are obtained; the access frequency and target operation volume of each data table in the target database are determined according to the data operation parameters; wherein the target database includes multiple data tables, and the target operation volume is used to characterize the ratio of the operated data in the data table to the total amount of data in the data table; for each data table, if the target operation volume is greater than the operation volume threshold corresponding to the data table, the statistical information of the data table is updated. That is, the solution of the present application, for each data table, when it is determined that the target operation volume is greater than the operation volume threshold of the table, the statistical information of the table is updated, ensuring that the optimizer of the target database can determine the query method suitable for the data in the database according to the latest statistical information, thereby avoiding the situation where the statistical information is not updated in time due to the long interval between the collection and update of statistical information of some data tables, thereby enabling the optimizer to determine the appropriate data operation execution plan and improve the query performance of the data in the database.
[0090] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements a statistical information management method as provided in any embodiment of the present application.
[0091] In the process of implementation, the computer program product can be written in one or more programming languages or a combination thereof to perform the computer program code of the present application, and the programming language includes an object-oriented programming language, such as Java, Smalltalk, C++, and also includes a conventional procedural programming language, such as "C" language or similar programming language. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on the remote computer, or completely on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).
[0092] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution of this application can be achieved, and this document is not limited here.
[0093] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A statistical information management method, characterized in that: The method comprises: Obtain data operation parameters corresponding to the target structured query language; Determine the access frequency and target operation amount of each data table in the target database according to the data operation parameter; wherein the target database includes a plurality of the data tables, and the target operation amount is used to represent the ratio of the operated data in the data table to the total amount of data in the data table; For each of the data tables, if the target operation volume is greater than an operation volume threshold corresponding to the data table, the statistical information of the data table is updated.
2. The method according to claim 1, characterized in that The data operation parameters include the type of operation data, the operation object, the amount of operation data, the number of operation executions and the parameter acquisition time.
3. The method according to claim 1, characterized in that After obtaining the data operation parameters corresponding to the target structured query language, the method further includes: storing the data operation parameters corresponding to the target structured query language into an access information storage unit; The statistical information of the full amount of data in the data table is stored in a statistical information storage unit, and the access frequency and target operation amount of each data table in the target database are determined according to the data operation parameters, including: The access frequency and target operation amount of each data table in the target database are determined according to the data operation parameters in the access information storage unit and the current storage data information of the data table in the statistical information storage unit.
4. The method according to claim 3, characterized in that: If the target operation amount is greater than the operation amount threshold corresponding to the data table, before updating the statistical information of the data table, the method further includes: Determining the query frequency corresponding to the data table according to the historical access information in the access information storage unit; The operation volume threshold corresponding to the query frequency is determined according to the corresponding relationship between the preset query frequency and the operation volume threshold and the query frequency.
5. The method according to claim 1, characterized in that Before obtaining the data operation parameters corresponding to the target structured query language, the method further includes: Acquire the target structured query language; Determine a target execution operation of the target database according to the target structured query language, statistical information of the target database and a preset execution operation judgment rule; Perform an operation in the target database according to the target execution operation to obtain the target database after the operation is performed; For each of the data tables, if the target operation amount is greater than the operation amount threshold corresponding to the data table, after updating the statistical information of the data table, the method further includes: According to the updated statistical information corresponding to each data table, the statistical information corresponding to the target database after the operation is performed is determined.
6. The method according to claim 1, characterized in that The target operation volume includes a ratio of a total operation data volume to the number of rows in the data table.
7. A statistical information management device, characterized in that: The device comprises: An acquisition module, used to acquire data operation parameters corresponding to the target structured query language; A determination module, configured to determine the access frequency and target operation amount of each data table in a target database according to the data operation parameter; wherein the target database includes a plurality of the data tables, and the target operation amount is used to characterize the ratio of the operated data in the data table to the total amount of data in the data table; An updating module is used to update the statistical information of each data table if the target operation amount is greater than the operation amount threshold corresponding to the data table.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the statistical information management method as described in any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the statistical information management method as described in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the statistical information management method according to any one of claims 1 to 6.