Method and device for determining slow query statements
Through filtering, grouping and sorting structured query statements, the query statement with the preset ratio from the back to the front is determined as a slow query statement, which solves the problem of low accuracy of slow query statements in the existing technology, and improves system stability and user satisfaction Spend.
Patent Information
- Application Number
- CN202210614313.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-31
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2042-05-31
AI Technical Summary
In the prior art, the accuracy of slow query statements is low, resulting in production accidents such as cluster resources shortage, service lapse and system paralysis, and the user satisfaction is reduced.
By obtaining a set of structured query statements, filtering and grouping according to preset rules, obtaining the response time of each query statement, and sorting it from small to large according to the response time, and finally, the query statement with the preset ratio from the back to the front is determined as a slow query statement. .
It improves the accuracy of determining slow query statements, reduces the risk of cluster resource shortage and service lapse, and improves user satisfaction.
Smart Images

Figure CN114817302B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to a method and device for determining a slow query statement. Background Art
[0002] The prior art refers to structured query statements whose response time exceeds a specified time as slow query statements. Slow query statements are likely to cause production accidents such as cluster resource shortage, service downtime, and system paralysis, which greatly reduces user satisfaction. In response to the above problems, it is first necessary to determine which structured query statements are slow query statements, and then analyze the causes of slow query statements, thereby avoiding production accidents such as cluster resource shortage, service downtime, and system paralysis, and improving user satisfaction. However, currently, the method of determining slow query statements is often to set a time, and determine structured query statements whose response time exceeds the set time as slow query statements. Because the set time is fixed, this method is not accurate for all structured query statement sets or groups.
[0003] In the process of implementing the concept of the present disclosure, the inventors discovered that there are at least the following technical problems in the related art: the problem of low accuracy in determining slow query statements. Summary of the invention
[0004] In view of this, the embodiments of the present disclosure provide a method, device, electronic device and computer-readable storage medium for determining a slow query statement to solve the problem of low accuracy in determining a slow query statement in the prior art.
[0005] According to a first aspect of an embodiment of the present disclosure, a method for determining a slow query statement is provided, comprising: obtaining a first query statement set, wherein the first query statement set includes multiple structured query statements; filtering the first query statement set according to a first preset rule to obtain a second query statement set; grouping the structured query statements in the second query statement set according to preset elements to obtain a third query statement set, wherein the third query statement set includes multiple groups, each group including one or more structured query statements; obtaining a response time corresponding to each structured query statement in each group in the third query statement set, and sorting the structured query statements in each group in the third query statement set in ascending order according to the response time corresponding to each structured query statement; and determining a preset proportion of structured query statements from back to front in each group in the sorted third query statement set as slow query statements.
[0006] According to a second aspect of an embodiment of the present disclosure, a device for determining a slow query statement is provided, comprising: an acquisition module, configured to acquire a first query statement set, wherein the first query statement set includes multiple structured query statements; a screening module, configured to screen the first query statement set according to a first preset rule to obtain a second query statement set; a grouping module, configured to group the structured query statements in the second query statement set according to preset elements to obtain a third query statement set, wherein the third query statement set includes multiple groups, each group including one or more structured query statements; a sorting module, configured to acquire a response time corresponding to each structured query statement in each group in the third query statement set, and sort the structured query statements in each group in the third query statement set in ascending order according to the response time corresponding to each structured query statement; a determination module, configured to determine a preset proportion of structured query statements from back to front in each group in the sorted third query statement set as slow query statements.
[0007] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0008] According to a fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0009] Compared with the prior art, the disclosed embodiment has the following beneficial effects: obtaining a first query statement set, wherein the first query statement set includes multiple structured query statements; filtering the first query statement set according to a first preset rule to obtain a second query statement set; grouping the structured query statements in the second query statement set according to preset elements to obtain a third query statement set, wherein the third query statement set includes multiple groups, each group including one or more structured query statements; obtaining the response time corresponding to each structured query statement in each group in the third query statement set, and sorting the structured query statements in each group in the third query statement set in order from small to large according to the response time corresponding to each structured query statement; determining a preset proportion of structured query statements from back to front in each group in the sorted third query statement set as slow query statements. The above technical means can solve the problem of low accuracy in determining slow query statements in the prior art, thereby improving the accuracy of determining slow query statements. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0011] Figure 1 is a schematic diagram of an application scenario of an embodiment of the present disclosure;
[0012] Figure 2 It is a flowchart of a method for determining a slow query statement provided by an embodiment of the present disclosure;
[0013] Figure 3 It is a structural schematic diagram of a device for determining a slow query statement provided by an embodiment of the present disclosure;
[0014] Figure 4 It is a structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0015] In the following description, specific details such as specific system structures and technologies are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present disclosure. However, it should be clear to those skilled in the art that the present disclosure may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obstructing the description of the present disclosure with unnecessary details.
[0016] An air-conditioning passage control method and device according to an embodiment of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0017] Figure 1 1 is a schematic diagram of an application scenario of an embodiment of the present disclosure. The application scenario may include terminal devices 101, 102 and 103, a server 104 and a network 105.
[0018] The terminal devices 101, 102 and 103 can be hardware or software. When the terminal devices 101, 102 and 103 are hardware, they can be various electronic devices with display screens and supporting communication with the server 104, including but not limited to smart phones, tablet computers, laptop portable computers and desktop computers; when the terminal devices 101, 102 and 103 are software, they can be installed in the above electronic devices. The terminal devices 101, 102 and 103 can be implemented as multiple software or software modules, or as a single software or software module, and the embodiments of the present disclosure are not limited to this. Furthermore, various applications can be installed on the terminal devices 101, 102 and 103, such as data processing applications, instant messaging tools, social platform software, search applications, shopping applications, etc.
[0019] The server 104 may be a server that provides various services, for example, a background server that receives a request sent by a terminal device that establishes a communication connection with the server, and the background server may receive and analyze the request sent by the terminal device, and generate a processing result. The server 104 may be a single server, a server cluster consisting of several servers, or a cloud computing service center, which is not limited in the embodiments of the present disclosure.
[0020] It should be noted that the server 104 can be hardware or software. When the server 104 is hardware, it can be various electronic devices that provide various services for the terminal devices 101, 102, and 103. When the server 104 is software, it can be multiple software or software modules that provide various services for the terminal devices 101, 102, and 103, or it can be a single software or software module that provides various services for the terminal devices 101, 102, and 103, and the embodiments of the present disclosure are not limited to this.
[0021] The network 105 may be a wired network connected by coaxial cables, twisted pairs, and optical fibers, or a wireless network that can interconnect various communication devices without wiring, such as Bluetooth, Near Field Communication (NFC), infrared, etc., which is not limited in the embodiments of the present disclosure.
[0022] The user can establish a communication connection with the server 104 via the network 105 through the terminal devices 101, 102 and 103 to receive or send information, etc. It should be noted that the specific types, quantities and combinations of the terminal devices 101, 102 and 103, the server 104 and the network 105 can be adjusted according to the actual needs of the application scenario, and the embodiments of the present disclosure are not limited to this.
[0023] Figure 2It is a flowchart of a method for determining a slow query statement provided by an embodiment of the present disclosure. Figure 2 The method for determining the slow query statement can be Figure 1 The terminal device or server executes. Figure 2 As shown, the method for determining the slow query statement includes:
[0024] S201, obtaining a first query statement set, wherein the first query statement set includes a plurality of structured query statements;
[0025] The disclosed embodiment is applied to a search engine to determine which structured query statements in the search engine are slow query statements. The first query statement set may be multiple structured query statements obtained within a specific time period, such as all structured query statements on March 3, 2021. Structured query statements are SQL query statements, and structured query statements are often used in various search engines, so the disclosed embodiment is targeted at structured query statements.
[0026] S202, filtering the first query statement set according to the first preset rule to obtain a second query statement set;
[0027] S203, grouping the structured query statements in the second query statement set according to preset elements to obtain a third query statement set, wherein the third query statement set includes a plurality of groups, each of which includes one or more structured query statements;
[0028] It should be noted that no matter which step in the embodiment of the present disclosure, the identification number and user name of the user to which each structured query statement belongs, the identification number and business domain name of the business domain to which each structured query statement belongs; the time period to which each structured query statement belongs; the statement content and execution count of each structured query statement and other information can be provided as needed.
[0029] S204, obtaining the response time corresponding to each structured query statement in each group in the third query statement set, and sorting the structured query statements in each group in the third query statement set in ascending order according to the response time corresponding to each structured query statement;
[0030] For example, a group has three structured query statements. The response time for the first structured query statement is 0.001s, the response time for the second structured query statement is 0.002s, and the response time for the third structured query statement is 0.0005s. After the group is sorted, it will be the third structured query statement, the first structured query statement, and the second structured query statement.
[0031] S205: Determine a preset proportion of structured query statements from the back to the front in each group of the sorted third query statement set as slow query statements.
[0032] For example, if the preset ratio is 5%, and a group has 100 structured query statements, then the slow query statements of the group are the last five structured query statements of the group after sorting.
[0033] According to the technical solution provided by the embodiment of the present disclosure: obtain a first query statement set, wherein the first query statement set includes multiple structured query statements; filter the first query statement set according to a first preset rule to obtain a second query statement set; group the structured query statements in the second query statement set according to preset elements to obtain a third query statement set, wherein the third query statement set includes multiple groups, each group includes one or more structured query statements; obtain the response time corresponding to each structured query statement in each group in the third query statement set, and sort the structured query statements in each group in the third query statement set in order from small to large according to the response time corresponding to each structured query statement; determine the structured query statements of a preset proportion from back to front in each group in the sorted third query statement set as slow query statements. The above technical means can solve the problem of low accuracy in determining slow query statements in the prior art, thereby improving the accuracy of determining slow query statements.
[0034] The first preset rule includes: the identification number of the user to which each structured query statement belongs is within the first preset range; the query time corresponding to each structured query statement cannot be a null value; the numerical length of the query time corresponding to each structured query statement is a preset length; and the query time corresponding to each structured query statement is within the second preset range.
[0035] Filtering the first query statement set according to the first preset rule can be understood as deleting unqualified structured query statements in the first query statement set. The disclosed embodiment assumes that the identification number of the user to whom the qualified structured query statement belongs is within the first preset range, for example, the last 19 digits of the user's identification number are within a certain range; the corresponding query time cannot be a null value; the digital length of the corresponding query time is a preset length, and if the query time has other digits, then the digital length must be greater than the preset length; the corresponding query time is within the second preset range, such as the year 2021 that we have counted, then structured query statements with query times of other years cannot be used.
[0036] The structured query statements in the second query statement set may be grouped according to the following preset elements: the identification number and user name of the user to which each structured query statement belongs; the identification number and business domain name of the business domain to which each structured query statement belongs; the time period to which each structured query statement belongs; and the statement content and execution count of each structured query statement.
[0037] For example, a group may provide a structured query statement for a certain business of a certain tenant within a certain period of time.
[0038] After executing step 203, that is, grouping the structured query statements in the second query statement set according to preset elements to obtain a third query statement set, wherein the third query statement set includes multiple groups, and each group includes one or more structured query statements, the method also includes: determining a fourth query statement set corresponding to the third query statement set according to the date to which the third query statement set belongs and the first preset time duration, wherein the groups in the third query statement set and the fourth query statement set correspond to each other; obtaining the response time corresponding to each structured query statement in each group in the fourth query statement set, and sorting the structured query statements in each group in the fourth query statement set in ascending order according to the response time corresponding to each structured query statement; and determining a preset proportion of structured query statements from back to front in each group in the sorted fourth query statement set as slow query statements.
[0039] For example, the date to which the structured query statements in the third query statement set belong is May 25, 2022, and the embodiment of the present disclosure needs to count the structured query statements within a week corresponding to May 25, 2022. At this time, it is necessary to expand the fourth query statement set corresponding to the third query statement set. At this time, the first preset time length is one week, and the fourth query statement set is the structured query statements from May 23, 2022 to May 29, 2022. The fourth query statement set is an extension of the third query statement set, and the groups in the third query statement set and the fourth query statement set correspond to each other. For example, if the third query statement set has 10 groups, then the fourth query statement set also has 10 groups. The first group of the third query statement set corresponds to the first group of the fourth query statement set, but the number of structured query statements in each group in the fourth query statement set is greater than that in each group in the third query statement set.
[0040] In step 205, a preset proportion of structured query statements from back to front in each group in the sorted third query statement set are determined as slow query statements, including: determining the response time corresponding to the preset proportion of structured query statements from back to front in each group in the sorted third query statement set as a slow query response threshold; determining the structured query statements in each group in the third query statement set whose corresponding response time is greater than or equal to the slow query response threshold as slow query statements.
[0041] For example, the preset ratio is 5%, and a group in the third query statement set has 100 structured query statements. After sorting, the response time corresponding to the 5th structured query statement from the back to the front in the group is determined as the slow query response threshold, and the structured query statements in each group in the third query statement set whose corresponding response time is greater than or equal to the slow query response threshold are determined as slow query statements.
[0042] After executing step 205, that is, after determining a preset proportion of structured query statements from back to front in each group in the sorted third query statement set as slow query statements, the method further includes: filtering the determined multiple slow query statements according to the second preset rule to obtain a slow query statement table; wherein the second preset rule includes: the response time corresponding to each slow query statement is greater than the second preset time length; the date within the first preset time length corresponding to each slow query statement cannot be a null value.
[0043] For example, if the second preset duration is 0.005s, the default response time for slow query statements must be greater than 0.005s. If the response time for a slow query statement is less than 0.005s, then the slow query statement should be deemed not to be a slow query statement. The date within the first preset duration corresponding to each slow query statement cannot be a null value, mainly for the need to expand the third query statement set, or the query statement set that needs to be judged includes multiple dates. For example, if the first preset duration is one week, the fourth query statement set needs to be judged, and the date in the fourth query statement set cannot be a null value, or the third query statement set is a structured query statement within a week, and the date in the third query statement set cannot be a null value.
[0044] After executing step 203, that is, after determining a preset proportion of structured query statements from back to front in each group in the sorted third query statement set as slow query statements, the method also includes: generating execution priorities corresponding to the determined multiple slow query statements according to the third preset rule; generating a task sequence based on the execution priority corresponding to each slow query statement; and executing the multiple slow query statements according to the task sequence.
[0045] Among the slow query statements, some slow query statements are urgent and need to be executed as soon as possible, while some slow query statements do not need to be executed as soon as possible. The embodiments of the present disclosure are proposed in response to this situation. Through the technical means of the embodiments of the present disclosure, the efficiency of executing slow query statements can be improved. For example, the third preset rule can be to determine the execution priority corresponding to the slow query statement according to the business field to which the slow query statement belongs. For example, the execution priority corresponding to the slow query statement of the front-end query such as page query is higher, and the execution priority corresponding to the slow query statement of the back-end query such as data query is lower.
[0046] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.
[0047] The following are embodiments of the device disclosed herein, which can be used to execute the method embodiments disclosed herein. For details not disclosed in the device embodiments disclosed herein, please refer to the method embodiments disclosed herein.
[0048] Figure 3 Schematic diagram of a device for determining a slow query statement provided by an embodiment of the present disclosure. Figure 3 As shown, the slow query statement determination device includes:
[0049] The acquisition module 301 is configured to acquire a first query statement set, wherein the first query statement set includes a plurality of structured query statements;
[0050] A screening module 302 is configured to screen the first query statement set according to a first preset rule to obtain a second query statement set;
[0051] The grouping module 303 is configured to group the structured query statements in the second query statement set according to preset elements to obtain a third query statement set, wherein the third query statement set includes a plurality of groups, each of which includes one or more structured query statements;
[0052] The sorting module 304 is configured to obtain the response time corresponding to each structured query statement in each group in the third query statement set, and sort the structured query statements in each group in the third query statement set in ascending order according to the response time corresponding to each structured query statement;
[0053] The determination module 305 is configured to determine a preset proportion of structured query statements from the back to the front in each group of the sorted third query statement set as slow query statements.
[0054] According to the technical solution provided by the embodiment of the present disclosure: obtain a first query statement set, wherein the first query statement set includes multiple structured query statements; filter the first query statement set according to a first preset rule to obtain a second query statement set; group the structured query statements in the second query statement set according to preset elements to obtain a third query statement set, wherein the third query statement set includes multiple groups, each group includes one or more structured query statements; obtain the response time corresponding to each structured query statement in each group in the third query statement set, and sort the structured query statements in each group in the third query statement set in order from small to large according to the response time corresponding to each structured query statement; determine the structured query statements of a preset proportion from back to front in each group in the sorted third query statement set as slow query statements. The above technical means can solve the problem of low accuracy in determining slow query statements in the prior art, thereby improving the accuracy of determining slow query statements.
[0055] The first preset rule includes: the identification number of the user to which each structured query statement belongs is within the first preset range; the query time corresponding to each structured query statement cannot be a null value; the numerical length of the query time corresponding to each structured query statement is a preset length; and the query time corresponding to each structured query statement is within the second preset range.
[0056] Filtering the first query statement set according to the first preset rule can be understood as deleting unqualified structured query statements in the first query statement set. The disclosed embodiment assumes that the identification number of the user to whom the qualified structured query statement belongs is within the first preset range, for example, the last 19 digits of the user's identification number are within a certain range; the corresponding query time cannot be a null value; the digital length of the corresponding query time is a preset length, and if the query time has other digits, then the digital length must be greater than the preset length; the corresponding query time is within the second preset range, such as the year 2021 that we have counted, then structured query statements with query times of other years cannot be used.
[0057] The structured query statements in the second query statement set may be grouped according to the following preset elements: the identification number and user name of the user to which each structured query statement belongs; the identification number and business domain name of the business domain to which each structured query statement belongs; the time period to which each structured query statement belongs; and the statement content and execution count of each structured query statement.
[0058] For example, a group may provide a structured query statement for a certain business of a certain tenant within a certain period of time.
[0059] Optionally, the sorting module 304 is also configured to determine a fourth query statement set corresponding to the third query statement set based on the date to which the third query statement set belongs and the first preset time duration, wherein the groups in the third query statement set and the fourth query statement set correspond to each other; obtain the response time corresponding to each structured query statement in each group in the fourth query statement set, and sort the structured query statements in each group in the fourth query statement set in ascending order according to the response time corresponding to each structured query statement; and determine a preset proportion of structured query statements from back to front in each group in the sorted fourth query statement set as slow query statements.
[0060] For example, the date to which the structured query statements in the third query statement set belong is May 25, 2022, and the embodiment of the present disclosure needs to count the structured query statements within a week corresponding to May 25, 2022. At this time, it is necessary to expand the fourth query statement set corresponding to the third query statement set. At this time, the first preset time length is one week, and the fourth query statement set is the structured query statements from May 23, 2022 to May 29, 2022. The fourth query statement set is an extension of the third query statement set, and the groups in the third query statement set and the fourth query statement set correspond to each other. For example, if the third query statement set has 10 groups, then the fourth query statement set also has 10 groups. The first group of the third query statement set corresponds to the first group of the fourth query statement set, but the number of structured query statements in each group in the fourth query statement set is greater than that in each group in the third query statement set.
[0061] Optionally, the determination module 305 is also configured to determine the response time corresponding to a preset proportion of structured query statements from the back to the front in each small group in the sorted third query statement set as a slow query response threshold; and determine the structured query statements in each small group in the third query statement set whose corresponding response time is greater than or equal to the slow query response threshold as slow query statements.
[0062] For example, the preset ratio is 5%, and a group in the third query statement set has 100 structured query statements. After sorting, the response time corresponding to the 5th structured query statement from the back to the front in the group is determined as the slow query response threshold, and the structured query statements in each group in the third query statement set whose corresponding response time is greater than or equal to the slow query response threshold are determined as slow query statements.
[0063] Optionally, the determination module 305 is also configured to filter the multiple slow query statements determined according to the second preset rule to obtain a slow query statement table; wherein the second preset rule includes: the response time corresponding to each slow query statement is greater than the second preset time length; the date within the first preset time length corresponding to each slow query statement cannot be a null value.
[0064] For example, if the second preset duration is 0.005s, the default response time for slow query statements must be greater than 0.005s. If the response time for a slow query statement is less than 0.005s, then the slow query statement should be deemed not to be a slow query statement. The date within the first preset duration corresponding to each slow query statement cannot be a null value, mainly for the need to expand the third query statement set, or the query statement set that needs to be judged includes multiple dates. For example, if the first preset duration is one week, the fourth query statement set needs to be judged, and the date in the fourth query statement set cannot be a null value, or the third query statement set is a structured query statement within a week, and the date in the third query statement set cannot be a null value.
[0065] Optionally, the determination module 305 is further configured to generate execution priorities corresponding to the determined multiple slow query statements according to a third preset rule; generate a task sequence based on the execution priority corresponding to each slow query statement; and execute the multiple slow query statements according to the task sequence.
[0066] Among the slow query statements, some slow query statements are urgent and need to be executed as soon as possible, while some slow query statements do not need to be executed as soon as possible. The embodiments of the present disclosure are proposed in response to this situation. Through the technical means of the embodiments of the present disclosure, the efficiency of executing slow query statements can be improved. For example, the third preset rule can be to determine the execution priority corresponding to the slow query statement according to the business field to which the slow query statement belongs. For example, the execution priority corresponding to the slow query statement of the front-end query such as page query is higher, and the execution priority corresponding to the slow query statement of the back-end query such as data query is lower.
[0067] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present disclosure.
[0068] Figure 4 Schematic diagram of an electronic device 4 provided in an embodiment of the present disclosure. Figure 4 As shown, the electronic device 4 of this embodiment includes: a processor 401, a memory 402, and a computer program 403 stored in the memory 402 and executable on the processor 401. When the processor 401 executes the computer program 403, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 401 executes the computer program 403, the functions of the modules / units in the above-mentioned device embodiments are implemented.
[0069] Exemplarily, the computer program 403 may be divided into one or more modules / units, which are stored in the memory 402 and executed by the processor 401 to complete the present disclosure. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 403 in the electronic device 4.
[0070] The electronic device 4 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 4 may include, but is not limited to, a processor 401 and a memory 402. Those skilled in the art will appreciate that Figure 4 It is only an example of the electronic device 4 and does not constitute a limitation of the electronic device 4. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.
[0071] The processor 401 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0072] The memory 402 may be an internal storage unit of the electronic device 4, for example, a hard disk or memory of the electronic device 4. The memory 402 may also be an external storage device of the electronic device 4, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 4. Further, the memory 402 may also include both an internal storage unit and an external storage device of the electronic device 4. The memory 402 is used to store computer programs and other programs and data required by the electronic device. The memory 402 may also be used to temporarily store data that has been output or is to be output.
[0073] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0074] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0075] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this disclosure.
[0076] In the embodiments provided in the present disclosure, it should be understood that the disclosed devices / electronic devices and methods can be implemented in other ways. For example, the device / electronic device embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. Multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection of devices or units, which may be electrical, mechanical or other forms.
[0077] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0078] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0079] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present disclosure implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, and the computer program code may be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electric carrier signals and telecommunication signals.
[0080] The above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should all be included in the protection scope of the present disclosure.
Claims
1. A method for determining a slow query statement, characterized in that: include: Obtaining a first query statement set, wherein the first query statement set includes a plurality of structured query statements; Filter the first query statement set according to a first preset rule to obtain a second query statement set; Grouping the structured query statements in the second query statement set according to preset elements to obtain a third query statement set, wherein the third query statement set includes a plurality of groups, each of which includes one or more structured query statements; Obtaining the response time corresponding to each structured query statement in each group in the third query statement set, and sorting the structured query statements in each group in the third query statement set in ascending order according to the response time corresponding to each structured query statement; A preset proportion of structured query statements from the back to the front in each group in the sorted third query statement set is determined as slow query statements.
2. The method according to claim 1, characterized in that: The first preset rule includes: The identification number of the user to which each structured query statement belongs is within a first preset range; The query time corresponding to each structured query statement cannot be empty; The numerical length of the query time corresponding to each structured query statement is the preset length; The query time corresponding to each structured query statement is within a second preset range.
3. The method according to claim 1, characterized in that The preset elements include: The identification number and user name of the user to which each structured query statement belongs; The identification number and business domain name of the business domain to which each structured query statement belongs; The time period to which each structured query statement belongs; The statement content and execution times of each structured query statement.
4. The method according to claim 1, characterized in that: After grouping the structured query statements in the second query statement set according to preset elements to obtain a third query statement set, wherein the third query statement set includes a plurality of groups, each group including one or more structured query statements, the method further includes: Expanding the subgroups in the third query statement set by using structured query statements within a first preset time period of the date to which the third query statement set belongs, to obtain a fourth query statement set, wherein the subgroups in the third query statement set and the fourth query statement set correspond to each other; Obtaining the response time corresponding to each structured query statement in each group in the fourth query statement set, and sorting the structured query statements in each group in the fourth query statement set in ascending order according to the response time corresponding to each structured query statement; A preset proportion of structured query statements from the back to the front in each group in the sorted fourth query statement set is determined as slow query statements.
5. The method according to claim 1, characterized in that The step of determining a preset proportion of structured query statements from the back to the front in each group of the sorted third query statement set as slow query statements includes: Determine the response time corresponding to the preset proportion of structured query statements from the back to the front in each group of the sorted third query statement set as the slow query response threshold; The structured query statements whose corresponding response time in each group in the third query statement set is greater than or equal to the slow query response threshold are determined as the slow query statements.
6. The method according to claim 4, characterized in that After determining the structured query statements with a preset proportion from the back to the front in each group in the sorted third query statement set as slow query statements, the method further includes: Filter the determined multiple slow query statements according to the second preset rule to obtain a slow query statement table; The second preset rule includes: The response time corresponding to each slow query statement is greater than the second preset time length; The date within the first preset time period corresponding to each slow query statement cannot be a null value.
7. The method according to claim 1, characterized in that After determining the structured query statements with a preset proportion from the back to the front in each group in the sorted third query statement set as slow query statements, the method further includes: Generate execution priorities corresponding to the determined plurality of slow query statements according to a third preset rule; Generate a task sequence based on the execution priority of each slow query statement; According to the task sequence, multiple slow query statements are executed.
8. A device for determining a slow query statement, characterized in that: include: An acquisition module is configured to acquire a first query statement set, wherein the first query statement set includes a plurality of structured query statements; A screening module, configured to screen the first query statement set according to a first preset rule to obtain a second query statement set; a grouping module, configured to group the structured query statements in the second query statement set according to preset elements to obtain a third query statement set, wherein the third query statement set includes a plurality of groups, each of which includes one or more structured query statements; A sorting module is configured to obtain a response time corresponding to each structured query statement in each group in the third query statement set, and sort the structured query statements in each group in the third query statement set in ascending order according to the response time corresponding to each structured query statement; The determination module is configured to determine a preset proportion of structured query statements from the back to the front in each group of the sorted third query statement set as slow query statements.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Data query method and device
CN103559300A
Information processing method and system, and server
CN107133367A