A database table space arrangement method, device, equipment and medium

Automatically select and sort the database table space through the graphical user interface, solving the problem of high efficiency and low manual detection cost in the existing technology, and achieving efficient table space management.

CN115080567BActive Publication Date: 2025-08-19PING AN BANK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210731394.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-24
Publication Date
2025-08-19
Estimated Expiration
2042-06-24

AI Technical Summary

Technical Problem

In the prior art, database table space sorting relies on manual detection, which is costly and inefficient, and cannot meet actual business needs.

Method used

Display the database data tables and table space through the graphical user interface, automatically select the data tables that need to be sorted, and sort and sort them according to preset methods to free up table space.

Benefits of technology

It reduces labor costs, improves database sorting efficiency, and realizes automated tablespace management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115080567B_ABST
    Figure CN115080567B_ABST
Patent Text Reader

Abstract

The present application provides a method, apparatus, device and medium for organizing a tablespace of a database, the method comprising: in response to a data table processing operation performed on the database, displaying a first data table and a first tablespace on the graphical user interface; the first data table includes a second data table containing a first fragmented tablespace; according to the first tablespace and a preset organization requirement, determining a third data table from the second data table; predicting that after organizing the third data table, the database includes a second tablespace, and according to the second tablespace and the preset organization requirement, determining a fourth data table from the second data table; when a preset start organization condition is met, organizing the third data table and the fourth data in sequence according to a preset organization method. The present application can help database administrators work more efficiently, reduce labor costs, and improve the efficiency of organizing the database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of database technology, and in particular to a method, apparatus, device, and medium for organizing a tablespace of a database. Background Art

[0002] A database is a warehouse that organizes, stores, and manages data according to data structures. It is a collection of large amounts of data stored long-term in a computer, organized, shareable, and centrally managed. A tablespace is a logical division of a database; a tablespace can only belong to one database. All database objects are stored in a designated tablespace. However, it primarily stores tables, hence the name "tablespace."

[0003] After deleting content from a table in a database, the tablespace isn't automatically deleted. To ensure efficient database space, the database space needs to be defragmented to free up the tablespace occupied by the deleted data. Existing defragmentation methods involve assigning dedicated database administrators to perform manual checks based on their experience, and then defragmenting based on the results. This results in high labor costs and low defragmentation efficiency, and cannot meet the actual database space requirements of actual businesses. Summary of the Invention

[0004] In view of this, the purpose of this application is to provide a database table space organization method, device, equipment and medium, which can reflect the change process of the database from the initial data table and initial table space to the first data table and first table space, helping database administrators to work more efficiently; it can also automatically select the third data table and the fourth data table that can be processed successively, and process them in sequence, reducing labor costs and improving the efficiency of database organization.

[0005] In a first aspect, an embodiment of the present application provides a method for organizing a tablespace of a database, wherein a terminal device provides a graphical user interface, the graphical user interface displaying an initial data table and an initial tablespace contained in the database; the method comprises:

[0006] In response to a data table processing operation performed on the database, displaying on the graphical user interface a first data table and a first table space included in the database after the data table processing; the first data table includes a second data table including a first fragmented table space;

[0007] Determining a third data table that can be sorted from the second data table according to the first tablespace and a preset sorting requirement;

[0008] predicting that after the third data table is sorted, the database includes a second table space, and determining a fourth data table that can be sorted in addition to the third data table from the second data table based on the second table space and a preset sorting requirement;

[0009] When the preset start sorting condition is met, the third data table and the fourth data table are sorted in sequence according to a preset sorting method to release the table space of the database.

[0010] In some technical solutions of the present application, the first tablespace includes: a first free tablespace, a first fragmented tablespace, and a first used tablespace; and displaying the first tablespace in the graphical user interface includes:

[0011] The first table free table space is displayed in a first display mode on the graphical user interface; the first fragmented table space is displayed in a second display mode on the graphical user interface; and the first used table space is displayed in a third display mode on the graphical user interface; wherein the first display mode, the second display mode, and the third display mode are all different.

[0012] In some technical solutions of the present application, the first data table further includes a fifth data table that does not include the first fragment tablespace; and displaying the first data table on the graphical user interface includes:

[0013] The second data table is displayed in a first-level display mode on the graphical user interface, and the fifth data table is displayed in a second-level display mode on the graphical user interface; the first-level display mode is higher than the second-level display mode.

[0014] In some technical solutions of the present application, after obtaining the fourth data table, the method includes:

[0015] The third data table is displayed in a third level display mode on the graphical user interface, and the fourth data table is displayed in a fourth level display mode on the graphical user interface; the third level display mode is higher than the fourth level display mode.

[0016] In some technical solutions of the present application, the preset start sorting condition includes at least one of the following:

[0017] Detecting a first touch operation on an arrangement control;

[0018] The preset waiting time has expired;

[0019] And detecting a second touch operation on the third data table.

[0020] In some technical solutions of the present application, the third data table is sorted in sequence according to a preset sorting method, including:

[0021] When a first touch operation on the sorting control is detected or a preset waiting time is expired, sorting the third data table according to a preset sorting method;

[0022] Arranging the sorted third data table in sequence according to a preset arrangement method;

[0023] When a second touch operation on the third data table is detected, the third data table is sorted in sequence according to a touch sequence corresponding to the second touch operation according to a preset sorting method.

[0024] In some technical solutions of the present application, the third data table is sorted in sequence according to a preset sorting method, including:

[0025] performing a copy operation on the third data table to obtain a sixth data table having the same data content as the third data table;

[0026] The sixth data table after data reorganization is renamed and replaces the third data table to complete the arrangement.

[0027] In a second aspect, an embodiment of the present application provides a database tablespace organization device, which resides on a terminal device and provides a graphical user interface that displays initial data tables and initial tablespaces included in the database; the device includes:

[0028] a first display module, configured to respond to a data table processing operation performed on the database and display, on the graphical user interface, a first data table and a first tablespace included in the database after the data table processing; the first data table including a second data table including a first fragmented tablespace;

[0029] A first determining module is configured to determine a third data table that can be sorted from the second data table according to the first table space and a preset sorting requirement;

[0030] a second determining module, configured to predict that after the third data table is sorted, the database includes a second tablespace, and determine, from the second data table based on the second tablespace and a preset sorting requirement, a fourth data table that can be sorted in addition to the third data table;

[0031] The arranging module is used to arrange the third data table and the fourth data in sequence according to a preset arranging method when a preset start arranging condition is met, so as to release the table space of the database.

[0032] In a third aspect, an embodiment of 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 the processor implements the steps of the above-mentioned database table space organization method when executing the computer program.

[0033] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the computer program executes the steps of the above-mentioned database table space organization method.

[0034] The technical solutions provided by the embodiments of the present application may have the following beneficial effects:

[0035] The method of the present application includes: in response to a data table processing operation performed on the database, displaying on the graphical user interface a first data table and a first tablespace contained in the database after the data table processing; the first data table includes a second data table containing a first fragmented tablespace; according to the first tablespace and a preset sorting requirement, determining a third data table that can be sorted from the second data table; predicting that after sorting the third data table, the database contains a second tablespace, and according to the second tablespace and the preset sorting requirement, determining a fourth data table that can be sorted in addition to the third data table from the second data table; when a preset start sorting condition is met, sorting the third data table and the fourth data in sequence according to a preset sorting method to release the tablespace of the database. The present application can reflect the change process of the database from the initial data table and the initial tablespace to the first data table and the first tablespace, helping database administrators to work more efficiently; it can also automatically select the third data table and the fourth data table that can be processed in sequence and process them in sequence, reducing labor costs and improving the efficiency of database sorting.

[0036] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. 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 relevant drawings can be obtained based on these drawings without creative work.

[0038] Figure 1 A schematic diagram illustrating a flow chart of a method for organizing a database table space provided in an embodiment of the present application is shown;

[0039] Figure 2 A schematic diagram of arranging a third data table provided in an embodiment of the present application is shown;

[0040] Figure 3 A schematic diagram of a database table space arrangement device provided in an embodiment of the present application is shown;

[0041] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions 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. It should be understood that the drawings in the present application only serve the purpose of illustration and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowcharts can be implemented out of sequence, and steps without logical context can be reversed or implemented simultaneously. In addition, those skilled in the art, under the guidance of the contents of this application, can add one or more other operations to the flowchart, or remove one or more operations from the flowchart.

[0043] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application generally described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.

[0044] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.

[0045] The embodiments of the present application provide a method, apparatus, device, and medium for organizing a tablespace of a database, which are described below through embodiments.

[0046] A database (such as a MySQL database) is a warehouse that organizes, stores, and manages data according to data structures. It is a collection of large amounts of data that is stored in a computer for a long time, organized, shareable, and uniformly managed.

[0047] A tablespace is a logical division of a database. A tablespace can belong to only one database. All database objects are stored in a designated tablespace. However, it primarily stores tables, hence the name "tablespace."

[0048] When a segment is created in a tablespace, space is allocated for the segment's initial extents from the tablespace's available free space. As these initial extents fill with data, the segment requests the addition of another extent. This expansion process continues until the maximum extent size is reached or there is no free space in the tablespace for the next extent. Ideally, a segment's data would be stored in a single extent. This way, all data is stored close to other data within the segment, and fewer pointers are needed to find data. However, it is common for a segment to contain multiple extents, and there is no way to guarantee that these extents are stored adjacently. When a space requirement is met, the database no longer merges adjacent free extents (unless there is no other choice) but instead seeks to use the largest free extent in the tablespace. This results in a growing number of discrete, separate, and smaller free spaces, known as fragmentation. The accumulation of fragmentation can significantly limit database performance and consume significant tablespace space, necessitating defragmentation.

[0049] The existing method for defragmentation is to set up special database managers to perform manual detection based on their own work experience, and then defragment according to the detection results. The labor cost is high and the defragmentation efficiency is low, which cannot meet the actual business needs for database space.

[0050] Based on this, Figure 1 A flowchart of a method for organizing a tablespace of a database provided in an embodiment of the present application is shown. A graphical user interface is provided through a terminal device, and the graphical user interface displays an initial data table and an initial tablespace contained in the database. The method includes steps S101-S104. Specifically:

[0051] S101: In response to a data table processing operation performed on the database, displaying on the graphical user interface a first data table and a first tablespace included in the database after the data table processing; the first data table includes a second data table including a first fragmented tablespace;

[0052] S102: Determine a third data table that can be sorted from the second data table according to the first tablespace and a preset sorting requirement;

[0053] S103: predicting that after the third data table is sorted, the database includes a second tablespace, and determining a fourth data table that can be sorted in addition to the third data table from the second data table based on the second tablespace and a preset sorting requirement;

[0054] S104: When a preset start sorting condition is met, sort the third data table and the fourth data table in sequence according to a preset sorting method to release table space of the database.

[0055] This application can reflect the change process of the database from the initial data table and the initial table space to the first data table and the first table space, helping database administrators to work more efficiently; it can also automatically select the third data table and the fourth data table that can be processed successively, and process them in sequence, reducing labor costs and improving the efficiency of database organization.

[0056] The following describes some embodiments of the present application in detail. In the absence of conflict, the following embodiments and features in the embodiments may be combined with each other.

[0057] S101. In response to a data table processing operation performed on the database, display a first data table and a first table space included in the database after the data table processing on the graphical user interface; the first data table includes a second data table including a first fragmented table space.

[0058] The method of the present application is applied to a terminal device, which includes mobile devices and fixed devices, such as mobile phones, computers, and tablets. The terminal device of the present application provides a graphical user interface, and displays the initial data table and initial table space contained in the database on the graphical user interface. The initial data table and initial table space here represent the data table and table space before performing data table operations on the database. Performing data table operations on the database includes writing new data tables to the database and deleting existing data tables (or data contained in the data tables). When writing a new data table to the database, it is necessary to allocate a target space in the database that can store the new data table. After allocating the target space, the new data table is written to the target space. The capacity of the target space is generally equal to that of the new data table. When a data table in the database is deleted or the data contained in the data table in the database is deleted, the space allocated for the data table or data will be idle. When writing a new data table or data to this part of the space, the capacity required for the newly written data table or data is required to be the same as the capacity required for the deleted data table or data, which greatly limits the space utilization of the database. This fragmented space is what the present application needs to release.

[0059] To reflect the changes in the database data tables, this application displays them through a graphical user interface. After the staff performs data table processing operations on the database, the display content of the graphical user interface in this application transitions from the initial data table and initial tablespace contained in the database to the first data table and first tablespace. The first data table and first tablespace here are the data tables and tablespaces contained in the database after the staff performs data table processing on the database.

[0060] The first data table in this application includes a second data table that includes the first fragmented tablespace and a fifth data table that does not include the first fragmented tablespace. That is, after the staff performs data table operations on the database, the database contains two data tables: one data table (the second data table) that requires space freeing, and the other data table (the fifth data table) that does not require space freeing. To facilitate observation of the database, this application uses different display methods when displaying these two data tables: the second data table is displayed in the graphical user interface using a first-level display method, and the fifth data table is displayed in the graphical user interface using a second-level display method; the first-level display method is higher than the second-level display method. To better highlight the second data table that needs to be processed, this application uses a higher-level display method to display the second data table. For example, the first-level display method displays the upper half, and the second-level display method displays the lower half. Based on observation habits, the content in the upper half is generally observed first. That is, the second data table is displayed in the upper half of the graphical user interface, and the fifth data table is displayed in the lower half of the graphical user interface. Alternatively, the first-level display method has a highlighted background, and the second-level display method has a background without fill. It is generally believed that the highlighted part can be observed first, the background is highlighted to display the second data table, and the background is unfilled to display the fifth data table.

[0061] It should be noted that the first (initial or second) tablespace in this application includes: the first (initial or second) free tablespace, the first (initial or second) fragmented tablespace and the first (initial or second) used tablespace; the free tablespace here refers to the original space in the database that has not been fragmented (divided), and this part of the space can be divided or used directly. The fragmented tablespace represents a data table that has been divided, but the previously allocated data table or data in the data table has been deleted. This part of the space can be written to a data table or data that is connected to the space required by the previously allocated data table or data. The used tablespace represents the space that has been allocated in the database, and the data table or data allocated to this part of the space has not been deleted, and this part of the space is still in use. This application needs to release the fragmented tablespace when it is being processed to restore it to a free tablespace.

[0062] In order to facilitate the observation of the usage of the database table space and lay the foundation for subsequent operations on the data table, the present application includes, when displaying the first table space in the graphical user interface: displaying the first table free table space in a first display method; displaying the first fragmented table space in a second display method in the graphical user interface; displaying the first used table space in a third display method in the graphical user interface; wherein the first display method, the second display method and the third display method are all different. The present application displays the first free table space, the first fragmented table space and the first used table space in different display methods, which facilitates subsequent operations on the data table. For example, the first used table space is displayed in yellow, the first fragmented table space is displayed in red, and the first free table space is displayed in green.

[0063] S102: Determine a third data table that can be sorted from the second data table according to the first table space and a preset sorting requirement.

[0064] After obtaining the first data table and the first table space after data table processing of the database, the present application has certain requirements for the database when releasing space on the data table. Therefore, a third data table that meets the sorting requirements must be selected from the second data table that needs to have space released. That is, based on the current situation of the database, the third data table that can have space released is selected from the second data table that needs to have space released.

[0065] During implementation, requirements should include business support, business time, and business space. For example, the first step is to verify whether the current tablespace supports DDL tasks. Because gh-ost DDL operations use table copies, the available space must be at least twice the size of the existing table. The second step is to determine whether the current business is peak. This can be determined by obtaining the current QPS and TPS of the business. The third step is to verify risks during execution. We can determine whether there are currently large transactions or large queries on the current table to prevent DML locks from causing production failures.

[0066] When determining business space requirements, you need to base your decision on the database's current first tablespace. Specifically, you need to determine whether the capacity of the first free tablespace within the first tablespace can meet the capacity required to organize the second data table. The second data table that can meet the capacity of the current first free tablespace is used as the third data table.

[0067] S103: predict that after the third data table is sorted, the database includes a second table space, and determine a fourth data table that can be sorted in addition to the third data table from the second data table based on the second table space and preset sorting requirements.

[0068] After obtaining the third data table, the present application releases space in the third data table and then performs a database prediction to obtain the second table space contained in the database after the third data table is organized. Then, using the same method as above for determining the second data table, a fourth data table that can be organized in addition to the third data table is determined from the second data table.

[0069] After obtaining the fourth data table, the method further includes: predicting that after the fourth data table is sorted, the database contains a third table space, and according to the third table space and the preset sorting requirements, determining from the second data table a seventh data table that can be sorted in addition to the third data table and the fourth data table, until the second data table is traversed. In other words, the present application can release space for all second data tables, but due to the space requirements for the second data tables, the present application first selects the data tables that can meet the space requirements and releases space first, providing space for subsequent data tables with larger space requirements. When the sorted space can meet the required space of the data table, the space of the data table is released, until the space of all second data tables is released.

[0070] After obtaining the fourth data table, the method of the present application includes: displaying the third data table in a third-level display mode on the graphical user interface, and displaying the fourth data table in a fourth-level display mode on the graphical user interface; the third-level display mode is higher than the fourth-level display mode.

[0071] If the present application predicts the seventh data table, the eighth data table, etc. after traversing the second data table, they are displayed in descending order.

[0072] S104: When a preset start sorting condition is met, sort the third data table and the fourth data table in sequence according to a preset sorting method to release table space of the database.

[0073] After obtaining the third and fourth data tables that need to be organized and can be organized, and if necessary, the seventh and eighth data tables, etc., these tables need to be organized. Before starting to organize these tables, the present application also sets start-organization conditions. Only when these start-organization conditions are met will the organizing of these tables begin.

[0074] The preset start sorting conditions in this application include at least one of the following: detecting a first touch operation on the sorting control; expiration of a preset waiting time; and detecting a second touch operation on the third data table. During implementation, the above start sorting conditions can be selected and set, either one setting or multiple settings.

[0075] In response to detecting a first touch operation on the organizing space to initiate organizing, the present application displays an organizing control in addition to displaying the third and fourth data tables, and if necessary, the seventh and eighth data tables, etc., on the graphical user interface. The database administrator generates a start organizing signal by clicking the organizing control, and organizes the third and fourth data tables, and if necessary, the seventh and eighth data tables, etc., in sequence.

[0076] The condition for starting sorting after a preset waiting time has expired is applicable to databases that require automated processing. After obtaining the data tables that require and can be processed, sorting will automatically begin on the third and fourth data tables, and if necessary, the seventh, eighth, and so on, tables, after the set waiting time has expired. After sorting these tables, the waiting time is reset, and sorting will resume after the next waiting time has expired. In other words, by setting a waiting time, periodic automated sorting of the database can be achieved.

[0077] The above two methods of starting sorting conditions to trigger sorting, when sorting the third data table and the fourth data table, and if necessary, the seventh data table, the eighth data table..., etc., the multiple third data tables (the fourth data table, the seventh data table, the eighth data table...) are sorted according to the preset sorting method. The preset sorting method includes arranging in ascending order of required space, or arranging in descending order of required space, etc. For example, the third data tables that can be sorted include: Data Table A requires 11G of space, Data Table B requires 12G of space, and Data Table C requires 13G of space; if arranged in ascending order of required space, the order of sorting the three third data tables is Data Table A, Data Table B, and Data Table C.

[0078] Regarding the conditions for starting to organize the data after detecting a second touch operation on the third data table, the above method states that after obtaining the third data table, the fourth data table, and if necessary, the seventh data table, the eighth data table, etc., the present application displays them on the graphical user interface. After displaying the above content, the database administrator can organize the data by performing a second touch operation on the third data table. Specifically, the database administrator can start organizing the selected third data table by clicking on the third data table in the designated area. That is, the database administrator selects the third data table to be organized based on the third data table he or she clicks on first. If the database administrator accidentally touches the fourth data table (the seventh data table, the eighth data table, etc.) before the third data table is organized, a false touch prompt will be displayed on the graphical user interface. When all third data tables are organized, the graphical user interface will display a message indicating that the fourth data table can be organized, and the fourth data table will continue to be selected. This cycle will continue until all second data tables have been organized, and the organization of the database is completed.

[0079] like Figure 2 As shown, the process of arranging the third data table in this application includes:

[0080] S201, copying the third data table to obtain a sixth data table with the same data content as the third data table;

[0081] S202 : renaming the sixth data table after data reorganization and replacing the third data table to complete the arrangement.

[0082] Specifically, this application replaces the data table that needs to be organized with another new data table. Here, the new data table is obtained by copying the data table that needs to be organized. By copying the original third data table, a sixth data table containing the same data content as the third data table is obtained. The space in the sixth data table is then released. That is, the data in the sixth data table is reorganized, the fragmented table space in the sixth data table is removed, and the sixth data table is renamed and replaced with the third data table to complete the organization. If the fragmented table space is left after deleting the data table, the fragmented table space can be directly released.

[0083] Figure 3 A schematic diagram of the structure of a database tablespace organization device provided in an embodiment of the present application is shown. The device resides on a terminal device, and the terminal device provides a graphical user interface that displays the initial data table and initial tablespace contained in the database. The device includes:

[0084] a first display module, configured to respond to a data table processing operation performed on the database and display, on the graphical user interface, a first data table and a first tablespace included in the database after the data table processing; the first data table including a second data table including a first fragmented tablespace;

[0085] A first determining module is configured to determine a third data table that can be sorted from the second data table according to the first table space and a preset sorting requirement;

[0086] a second determining module, configured to predict that after the third data table is sorted, the database includes a second tablespace, and determine, from the second data table based on the second tablespace and a preset sorting requirement, a fourth data table that can be sorted in addition to the third data table;

[0087] The arranging module is used to arrange the third data table and the fourth data in sequence according to a preset arranging method when a preset start arranging condition is met, so as to release the table space of the database.

[0088] The first tablespace includes: a first free tablespace, a first fragmented tablespace, and a first used tablespace; and displaying the first tablespace on the graphical user interface includes:

[0089] The first table free table space is displayed in a first display mode on the graphical user interface; the first fragmented table space is displayed in a second display mode on the graphical user interface; and the first used table space is displayed in a third display mode on the graphical user interface; wherein the first display mode, the second display mode, and the third display mode are all different.

[0090] The first data table further includes a fifth data table that does not include the first fragmented tablespace; and displaying the first data table on the graphical user interface includes:

[0091] The second data table is displayed in a first-level display mode on the graphical user interface, and the fifth data table is displayed in a second-level display mode on the graphical user interface; the first-level display mode is higher than the second-level display mode.

[0092] After obtaining the fourth data table, the apparatus includes:

[0093] The second display module is used to display the third data table in the graphical user interface in a third-level display mode, and to display the fourth data table in a fourth-level display mode in the graphical user interface; the third-level display mode is higher than the fourth-level display mode.

[0094] The preset start sorting condition includes at least one of the following:

[0095] Detecting a first touch operation on an arrangement control;

[0096] The preset waiting time has expired;

[0097] And detecting a second touch operation on the third data table.

[0098] The step of sequentially arranging the third data table according to a preset arranging method includes:

[0099] When a first touch operation on the sorting control is detected or a preset waiting time is expired, sorting the third data table according to a preset sorting method;

[0100] Arranging the sorted third data table in sequence according to a preset arrangement method;

[0101] When a second touch operation on the third data table is detected, the third data table is sorted in sequence according to a touch sequence corresponding to the second touch operation according to a preset sorting method.

[0102] The step of sequentially arranging the third data table according to a preset arranging method includes:

[0103] performing a copy operation on the third data table to obtain a sixth data table having the same content as the third data table;

[0104] The sixth data table after data reorganization is renamed and replaces the third data table to complete the arrangement.

[0105] like Figure 4 As shown, an embodiment of the present application provides an electronic device for executing the table space organization method of the database in the present application, the device includes a memory, a processor, a bus and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the table space organization method of the database when executing the computer program.

[0106] Specifically, the above-mentioned memory and processor may be general-purpose memory and processor, which are not specifically limited here. When the processor runs the computer program stored in the memory, the above-mentioned database table space organization method can be executed.

[0107] Corresponding to the database table space organization method in the present application, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, the steps of the above-mentioned database table space organization method are executed.

[0108] Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, etc. When the computer program on the storage medium is run, the above-mentioned database table space arrangement method can be executed.

[0109] In the embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. The system embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. There may be other division methods in actual implementation. For example, 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 communication interface, indirect coupling or communication connection of the system or unit, which may be electrical, mechanical or other forms.

[0110] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0111] In addition, each functional unit in the embodiments provided in the present application 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.

[0112] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0113] It should be noted that similar numbers and letters represent similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description and are not to be understood as indicating or implying relative importance.

[0114] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The scope of protection of the present application is not limited thereto. Although the present application has been described in detail with reference to the above-described embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above-described embodiments within the technical scope disclosed in the present application, or perform equivalent replacements for some of the technical features thereof. However, these modifications, changes, or replacements do not deviate from the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application. They should all be included in the scope of protection of the present application. Therefore, the scope of protection of the present application shall be subject to the scope of protection of the claims.

Claims

1. A method for organizing a table space of a database, characterized in that: Providing a graphical user interface through a terminal device, wherein the graphical user interface displays an initial data table and an initial table space included in a database; the method includes: In response to a data table processing operation performed on the database, displaying on the graphical user interface a first data table and a first table space included in the database after the data table processing; the first data table includes a second data table including a first fragmented table space; Determining a third data table that can be sorted from the second data table according to the first tablespace and a preset sorting requirement; predicting that after the third data table is sorted, the database includes a second table space, and determining a fourth data table that can be sorted in addition to the third data table from the second data table based on the second table space and a preset sorting requirement; When a preset start sorting condition is met, sorting the third data table and the fourth data in sequence according to a preset sorting method to release table space of the database; The preset start sorting condition includes at least one of the following: Detecting a first touch operation on an arrangement control; The preset waiting time has expired; and detecting a second touch operation on the third data table; The first tablespace includes: a first free tablespace, a first fragmented tablespace, and a first used tablespace; and displaying the first tablespace on the graphical user interface includes: The first table free table space is displayed in a first display mode on the graphical user interface; the first fragmented table space is displayed in a second display mode on the graphical user interface; and the first used table space is displayed in a third display mode on the graphical user interface; wherein the first display mode, the second display mode, and the third display mode are all different.

2. The method according to claim 1, characterized in that The first data table further includes a fifth data table that does not include the first fragmented tablespace; and displaying the first data table on the graphical user interface includes: The second data table is displayed in a first-level display mode on the graphical user interface, and the fifth data table is displayed in a second-level display mode on the graphical user interface; the first-level display mode is higher than the second-level display mode.

3. The method according to claim 1, characterized in that After obtaining the fourth data table, the method includes: The third data table is displayed in a third level display mode on the graphical user interface, and the fourth data table is displayed in a fourth level display mode on the graphical user interface; the third level display mode is higher than the fourth level display mode.

4. The method according to claim 1, wherein The step of sequentially arranging the third data table according to a preset arranging method includes: When a first touch operation on the sorting control is detected or a preset waiting time is expired, sorting the third data table according to a preset sorting method; Arranging the sorted third data table in sequence according to a preset arrangement method; When a second touch operation on the third data table is detected, the third data table is sorted in sequence according to a touch sequence corresponding to the second touch operation according to a preset sorting method.

5. The method according to claim 1, wherein The step of sequentially arranging the third data table according to a preset arranging method includes: performing a copy operation on the third data table to obtain a sixth data table having the same data content as the third data table; The sixth data table after data reorganization is renamed and replaces the third data table to complete the arrangement.

6. A database table space arrangement device, characterized in that: The device resides on a terminal device, and the terminal device provides a graphical user interface, wherein the graphical user interface displays the initial data table and initial table space contained in the database; the device includes: a first display module, configured to respond to a data table processing operation performed on the database and display, on the graphical user interface, a first data table and a first tablespace included in the database after the data table processing; the first data table including a second data table including a first fragmented tablespace; A first determining module is configured to determine a third data table that can be sorted from the second data table according to the first table space and a preset sorting requirement; a second determining module, configured to predict that after the third data table is sorted, the database includes a second tablespace, and determine, from the second data table based on the second tablespace and a preset sorting requirement, a fourth data table that can be sorted in addition to the third data table; a sorting module, configured to sort the third data table and the fourth data in sequence according to a preset sorting method when a preset start sorting condition is met, so as to release table space of the database; The preset start sorting condition includes at least one of the following: Detecting a first touch operation on an arrangement control; The preset waiting time has expired; and detecting a second touch operation on the third data table; The first tablespace includes: a first free tablespace, a first fragmented tablespace, and a first used tablespace; and displaying the first tablespace on the graphical user interface includes: The first table free table space is displayed in a first display mode on the graphical user interface; the first fragmented table space is displayed in a second display mode on the graphical user interface; and the first used table space is displayed in a third display mode on the graphical user interface; wherein the first display mode, the second display mode, and the third display mode are all different.

7. An electronic device, characterized in that: include: A processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the memory communicate via the bus. When the machine-readable instructions are executed by the processor, the steps of the database table space organization method according to any one of claims 1 to 5 are performed.

8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, executes the steps of the database table space arrangement method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Data detection method and device, storage medium and electronic device

    CN113434492A

  • Autonomous database defragmentation

    US20220019565A1