[go: up one dir, main page]

CN115080567A - A method, device, equipment and medium for arranging table space of a database - Google Patents

A method, device, equipment and medium for arranging table space of a database Download PDF

Info

Publication number
CN115080567A
CN115080567A CN202210731394.2A CN202210731394A CN115080567A CN 115080567 A CN115080567 A CN 115080567A CN 202210731394 A CN202210731394 A CN 202210731394A CN 115080567 A CN115080567 A CN 115080567A
Authority
CN
China
Prior art keywords
data table
database
space
data
sorting
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210731394.2A
Other languages
Chinese (zh)
Other versions
CN115080567B (en
Inventor
姚伏霞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202210731394.2A priority Critical patent/CN115080567B/en
Publication of CN115080567A publication Critical patent/CN115080567A/en
Application granted granted Critical
Publication of CN115080567B publication Critical patent/CN115080567B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2428Query predicate definition using graphical user interfaces, including menus and forms

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a method, a device, equipment and a medium for sorting table spaces of a database, wherein the method comprises the following steps: responding to data table processing operation performed on the database, and displaying a first data table and a first table space on the graphical user interface; the first data table comprises a second data table comprising a first shard table space; determining a third data table from the second data table according to the first table space and a preset sorting requirement; predicting that the third data table is sorted, wherein the database comprises a second table space, and determining a fourth data table from the second data table according to the second table space and a preset sorting requirement; and when the preset finishing starting condition is met, finishing the third data table and the fourth data in sequence according to a preset finishing method. The database management system can help database management personnel to work more efficiently, labor cost is reduced, and database arrangement efficiency is improved.

Description

一种数据库的表空间整理方法、装置、设备及介质A method, device, equipment and medium for arranging table space of database

技术领域technical field

本申请涉及数据库技术领域,具体而言,涉及一种数据库的表空间整理方法、装置、设备及介质。The present application relates to the technical field of databases, and in particular, to a method, apparatus, device and medium for organizing table space of a database.

背景技术Background technique

数据库是“按照数据结构来组织、存储和管理数据的仓库”。是一个长期存储在计算机内的、有组织的、可共享的、统一管理的大量数据的集合。表空间是数据库的逻辑划分,一个表空间只能属于一个数据库。所有的数据库对象都存放在指定的表空间中。但主要存放的是表,所以称作表空间。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 in the computer for a long time, organized, sharable, and uniformly managed. A tablespace is a logical division of a database, and a tablespace can only belong to one database. All database objects are stored in the specified tablespace. But the main storage is the table, so called the table space.

数据库中在对数据表中的内容进行删除之后,表空间并不会自动的删除,为了保证数据库的空间能够有效的释放,需要对数据库空间进行整理,释放掉已删除的数据占用的表空间。现有技术中的整理方式为设置专门的数据库管理人员根据自身工作经验进行人工检测,然后根据检测情况进行整理,人工成本高,整理效率较低,不能满足实际业务对于数据库空间的需要。After the content in the data table is deleted in the database, the table space will not be deleted automatically. In order to ensure that the database space can be effectively released, the database space needs to be sorted out to release the table space occupied by the deleted data. The sorting method in the prior art is to set up special database administrators to perform manual detection according to their own work experience, and then sort according to the detection situation, which has high labor cost and low sorting efficiency, which cannot meet the needs of actual business for database space.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本申请的目的在于提供一种数据库的表空间整理方法、装置、设备及介质,能够体现数据库由初始数据表和初始表空间向第一数据表和第一表空间的变化过程,帮助数据库管理人员更高效的工作;还能够自动选出能够先后进行处理的第三数据表和第四数据表,并依次进行处理,降低了人工成本,提高了对于数据库的整理效率。In view of this, the purpose of this application is to provide a method, device, equipment and medium for arranging table space of a database, which 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, It helps database administrators 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, which reduces labor costs and improves the efficiency of database sorting.

第一方面,本申请实施例提供了一种数据库的表空间整理方法,通过终端设备提供一图形用户界面,所述图形用户界面显示数据库包含的初始数据表和初始表空间;所述方法包括:In a first aspect, an embodiment of the present application provides a method for organizing a table space of a database. A graphical user interface is provided through a terminal device, and the graphical user interface displays an initial data table and an initial table space contained in the database; the method includes:

响应针对所述数据库进行的数据表处理操作,在所述图形用户界面展示进行数据表处理后的所述数据库包含的第一数据表和第一表空间;所述第一数据表包括包含有第一碎片表空间的第二数据表;In response to a data table processing operation performed on the database, the graphical user interface displays a first data table and a first table space included in the database after the data table processing is performed; the first data table includes a A second data table of a fragmented tablespace;

根据所述第一表空间和预设的整理要求,从所述第二数据表中,确定出能够进行整理的第三数据表;According to the first table space and preset sorting requirements, from the second data table, determine a third data table that can be sorted;

预测对所述第三数据表进行整理后,所述数据库包含第二表空间,并根据所述第二表空间和预设的整理要求,从所述第二数据表中,确定出除所述第三数据表以外能够进行整理的第四数据表;It is predicted that after the third data table is sorted, the database includes a second table space, and according to the second table space and preset sorting requirements, it is determined from the second data table that the A fourth data table other than the third data table that can be sorted;

在满足预设的开始整理条件时,按照预设的整理方法依次对所述第三数据表和第四数据进行整理,以释放所述数据库的表空间。When the preset start sorting condition is satisfied, the third data table and the fourth data are sorted in sequence according to the preset sorting method, so as to release the table space of the database.

在本申请一些技术方案中,上述第一表空间包括:第一自由表空间、第一碎片表空间和第一已用表空间;在所述图形用户界面展示所述第一表空间包括:In some technical solutions of the present application, the above-mentioned first table space includes: a first free table space, a first fragmented table space and a first used table space; displaying the first table space on the graphical user interface includes:

在所述图形用户界面以第一展示方式展示所述第一表自由表空间;在所述图形用户界面以第二展示方式展示所述第一碎片表空间;在所述图形用户界面以第三展示方式展示所述第一已用表空间;其中,所述第一展示方式、第二展示方式和第三展示方式均不相同。The first table free table space is displayed on the GUI in a first presentation mode; the first fragmented table space is displayed in a second presentation mode in the graphical user interface; and the third table space is displayed in the graphical user interface The display mode displays the first used table space; wherein, the first display mode, the second display mode and the third display mode are all different.

在本申请一些技术方案中,上述第一数据表还包括不包含有第一碎片表空间的第五数据表;在所述图形用户界面展示所述第一数据表包括:In some technical solutions of the present application, the above-mentioned first data table further includes a fifth data table that does not include the first fragmented table space; 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 in the graphical user interface; the first-level display mode is higher than the first-level display mode. Second-level display.

在本申请一些技术方案中,上述方法在得到了所述第四数据表之后,所述方法包括:In some technical solutions of the present application, after the above method has obtained 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 in the graphical user interface; the third-level display mode is higher than the third-level display mode. Four-level display method.

在本申请一些技术方案中,上述预设的开始整理条件包括以下至少之一:In some technical solutions of the present application, the above-mentioned preset start sorting conditions include at least one of the following:

检测到针对整理控件的第一触控操作;A first touch operation for the sorting control is detected;

预设的等待时间耗尽;The preset waiting time has expired;

以及检测到针对所述第三数据表的第二触控操作。and detecting a second touch operation on the third data table.

在本申请一些技术方案中,上述按照预设的整理方法依次对所述第三数据表进行整理,包括:In some technical solutions of the present application, the third data table is sorted in sequence according to the preset sorting method, including:

在检测到针对针对整理控件的第一触控操作或预设的等待时间耗尽时,按照预设的排序方式对所述第三数据表进行排序;Sorting the third data table according to a preset sorting method when detecting that the first touch operation for the sorting controls or the preset waiting time is exhausted;

按照预设的整理方法对排序后的所述第三数据表依次进行整理;Sorting the sorted third data table in sequence according to a preset sorting 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.

在本申请一些技术方案中,上述按照预设的整理方法依次对所述第三数据表进行整理,包括:In some technical solutions of the present application, the third data table is sorted in sequence according to the preset sorting method, including:

对所述第三数据表进行复制操作,得到与所述第三数据表包含的数据内容相同的第六数据表;performing a copying operation on the third data table to obtain a sixth data table with the same data content contained in the third data table;

针对进行数据重组后的所述第六数据表进行重新命名,并替换所述第三数据表,完成整理。The sixth data table after data reorganization is renamed, and the third data table is replaced to complete the sorting.

第二方面,本申请实施例提供了一种数据库的表空间整理装置,驻留于终端设备,终端设备提供一图形用户界面,所述图形用户界面显示数据库包含的初始数据表和初始表空间;所述装置包括:In a second aspect, an embodiment of the present application provides an apparatus for organizing a table space of a database, which resides in a terminal device, and the terminal device provides a graphical user interface, and the graphical user interface displays an initial data table and an initial table space contained in the database; The device includes:

第一展示模块,用于响应针对所述数据库进行的数据表处理操作,在所述图形用户界面展示进行数据表处理后的所述数据库包含的第一数据表和第一表空间;所述第一数据表包括包含有第一碎片表空间的第二数据表;The first display module is configured to display the first data table and the first table space contained in the database after the data table processing is performed on the graphical user interface in response to the data table processing operation performed on the database; a data table including a second data table containing the first fragmented table space;

第一确定模块,用于根据所述第一表空间和预设的整理要求,从所述第二数据表中,确定出能够进行整理的第三数据表;a first determining module, configured to determine a third data table that can be sorted out from the second data table according to the first table space and preset sorting requirements;

第二确定模块,用于预测对所述第三数据表进行整理后,所述数据库包含第二表空间,并根据所述第二表空间和预设的整理要求,从所述第二数据表中,确定出除所述第三数据表以外能够进行整理的第四数据表;The second determination module is used to predict that after the third data table is sorted, the database contains a second table space, and according to the second table space and preset sorting requirements, from the second data table , determine a fourth data table that can be organized in addition to the third data table;

整理模块,用于在满足预设的开始整理条件时,按照预设的整理方法依次对所述第三数据表和第四数据进行整理,以释放所述数据库的表空间。The sorting module is used for sorting the third data table and the fourth data in sequence according to a preset sorting method when a preset sorting start condition is satisfied, so as to release the table space of the database.

第三方面,本申请实施例提供了一种电子设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述的数据库的表空间整理方法的步骤。In a third aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, when the processor executes the computer program The steps of implementing the above-mentioned method for organizing tablespaces of a database.

第四方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器运行时执行上述的数据库的表空间整理方法的步骤。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the above-mentioned method for organizing table space of a database is executed. step.

本申请的实施例提供的技术方案可以包括以下有益效果:The technical solutions provided by the embodiments of the present application may include the following beneficial effects:

本申请方法包括:响应针对所述数据库进行的数据表处理操作,在所述图形用户界面展示进行数据表处理后的所述数据库包含的第一数据表和第一表空间;所述第一数据表包括包含有第一碎片表空间的第二数据表;根据所述第一表空间和预设的整理要求,从所述第二数据表中,确定出能够进行整理的第三数据表;预测对所述第三数据表进行整理后,所述数据库包含第二表空间,并根据所述第二表空间和预设的整理要求,从所述第二数据表中,确定出除所述第三数据表以外能够进行整理的第四数据表;在满足预设的开始整理条件时,按照预设的整理方法依次对所述第三数据表和第四数据进行整理,以释放所述数据库的表空间。本申请能够体现数据库由初始数据表和初始表空间向第一数据表和第一表空间的变化过程,帮助数据库管理人员更高效的工作;还能够自动选出能够先后进行处理的第三数据表和第四数据表,并依次进行处理,降低了人工成本,提高了对于数据库的整理效率。The method of the present application includes: in response to a data table processing operation performed on the database, displaying a first data table and a first table space included in the database after the data table processing is performed on the graphical user interface; the first data The table includes a second data table that includes a first fragmented table space; according to the first table space and preset sorting requirements, a third data table that can be sorted is determined from the second data table; prediction After the third data table is sorted, the database includes a second table space, and according to the second table space and preset sorting requirements, it is determined from the second data table that the third table space is excluded. A fourth data table other than the three data tables that can be sorted; when the preset start sorting conditions are met, the third data table and the fourth data are sorted in sequence according to the preset sorting method, so as to release the data of the database. tablespace. The 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 the database administrator to work more efficiently; it can also automatically select the third data table that can be processed successively and the fourth data table, and process them in sequence, which reduces labor costs and improves the efficiency of sorting out the database.

为使本申请的上述目的、特征和优点能更明显易懂,下文特举较佳实施例,并配合所附附图,作详细说明如下。In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the preferred embodiments are exemplified below, and are described in detail as follows in conjunction with the accompanying drawings.

附图说明Description of drawings

为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本申请的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to illustrate the technical solutions of the embodiments of the present application more clearly, the following drawings will briefly introduce the drawings that need to be used in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, and therefore do not It should be regarded as a limitation of the scope, and for those of ordinary skill in the art, other related drawings can also be obtained according to these drawings without any creative effort.

图1示出了本申请实施例所提供的一种数据库的表空间整理方法的流程示意图;FIG. 1 shows a schematic flowchart of a method for arranging table space of a database provided by an embodiment of the present application;

图2示出了本申请实施例所提供的一种对第三数据表进行整理的示意图;FIG. 2 shows a schematic diagram of sorting out a third data table provided by an embodiment of the present application;

图3示出了本申请实施例所提供的一种数据库的表空间整理装置示意图;FIG. 3 shows a schematic diagram of a table space arrangement device for a database provided by an embodiment of the present application;

图4为本申请实施例提供的一种电子设备的结构示意图。FIG. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.

具体实施方式Detailed ways

为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,应当理解,本申请中附图仅起到说明和描述的目的,并不用于限定本申请的保护范围。另外,应当理解,示意性的附图并未按实物比例绘制。本申请中使用的流程图示出了根据本申请的一些实施例实现的操作。应该理解,流程图的操作可以不按顺序实现,没有逻辑的上下文关系的步骤可以反转顺序或者同时实施。此外,本领域技术人员在本申请内容的指引下,可以向流程图添加一个或多个其他操作,也可以从流程图中移除一个或多个操作。In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present application. The drawings are only for the purpose of illustration and description, and are not used to limit the protection scope 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 operations implemented in accordance with some embodiments of the application. It should be understood that the operations of the flowcharts may be performed out of order and that steps without logical context may be performed in reverse order or concurrently. In addition, those skilled in the art can add one or more other operations to the flowchart, and can also remove one or more operations from the flowchart under the guidance of the content of the present application.

另外,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。通常在此处附图中描述和示出的本申请实施例的组件可以以各种不同的配置来布置和设计。因此,以下对在附图中提供的本申请的实施例的详细描述并非旨在限制要求保护的本申请的范围,而是仅仅表示本申请的选定实施例。基于本申请的实施例,本领域技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本申请保护的范围。In addition, the described embodiments are only some of the embodiments of the present application, but not all of the embodiments. The components of the embodiments of the present application generally described and illustrated in the drawings herein may be arranged and designed in a variety of different configurations. Thus, the following detailed description of the embodiments of the application provided in the accompanying drawings is not intended to limit the scope of the application as claimed, but is merely representative of selected embodiments of the application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present application.

需要说明的是,本申请实施例中将会用到术语“包括”,用于指出其后所声明的特征的存在,但并不排除增加其它的特征。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 later, but does not exclude the addition of other features.

本申请实施例提供了一种数据库的表空间整理方法、装置、设备及介质,下面通过实施例进行描述。Embodiments of the present application provide a method, apparatus, device, and medium for sorting table space of a database, which are described below through embodiments.

数据库(例如MySQL数据库)是“按照数据结构来组织、存储和管理数据的仓库”。是一个长期存储在计算机内的、有组织的、可共享的、统一管理的大量数据的集合。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 stored in the computer for a long time, organized, sharable, and uniformly managed.

表空间是数据库的逻辑划分,一个表空间只能属于一个数据库。所有的数据库对象都存放在指定的表空间中。但主要存放的是表,所以称作表空间。A tablespace is a logical division of a database, and a tablespace can only belong to one database. All database objects are stored in the specified tablespace. But the main storage is the table, so called the table space.

当表空间中生成一个段时,将从表空间有效自由空间中为这个段的初始范围分配空间。在这些初始范围充满数据时,段会请求增加另一个范围。这样的扩展过程会一直继续下去,直到达到最大的范围值,或者在表空间中已经没有自由空间用于下一个范围。最理想的状态就是一个段的数据可被存在单一的一个范围中。这样所有的数据存储时靠近段内其它数据,并且寻找数据可少用一些指针。但是一个段包含多个范围的情况是大量存在的,没有任何措施可以保证这些范围是相邻存储的。当要满足一个空间要求时,数据库不再合并相邻的自由范围(除非别无选择),而是寻找表空间中最大的自由范围来使用。这样将逐渐形成越来越多的离散的、分隔的、较小的自由空间,即碎片。碎片的积累将会大大限制数据库的性能,占用大量的表空间,所以需要对碎片进行整理。When a segment is generated in a tablespace, space is allocated for the initial extent of the segment from the tablespace effective free space. When these initial ranges are full of data, the segment requests another range to be added. This expansion process will continue until the maximum extent value is reached, or there is no free space in the tablespace for the next extent. Ideally, the data of a segment can be stored in a single scope. In this way, all data is stored close to other data in the segment, and fewer pointers are used to find data. But there are a lot of cases where a segment contains multiple ranges, and there is no way to guarantee that these ranges are stored adjacently. When a space requirement is to be met, the database no longer merges adjacent free ranges (unless there is no choice), but instead looks for the largest free range in the tablespace to use. This will gradually form more and more discrete, separated, smaller free spaces, or fragments. The accumulation of fragments will greatly limit the performance of the database and occupy a large amount of table space, so it is necessary to defragment.

现有技术中的对于碎片整理方式为设置专门的数据库管理人员根据自身工作经验进行人工检测,然后根据检测情况进行整理,人工成本高,整理效率较低,不能满足实际业务对于数据库空间的需要。The defragmentation method in the prior art is to set up special database administrators to perform manual detection according to their own work experience, and then perform sorting according to the detection situation. The labor cost is high, the sorting efficiency is low, and cannot meet the actual business needs for database space.

基于此,图1示出了本申请实施例所提供的一种数据库的表空间整理方法的流程示意图,通过终端设备提供一图形用户界面,所述图形用户界面显示数据库包含的初始数据表和初始表空间;其中,该方法包括步骤S101-S104;具体的:Based on this, FIG. 1 shows a schematic flowchart of a method for organizing tablespaces of a database provided by an embodiment of the present application. A graphical user interface is provided through a terminal device, and the graphical user interface displays the initial data table and initial data table included in the database. Table space; wherein, the method includes steps S101-S104; specifically:

S101、响应针对所述数据库进行的数据表处理操作,在所述图形用户界面展示进行数据表处理后的所述数据库包含的第一数据表和第一表空间;所述第一数据表包括包含有第一碎片表空间的第二数据表;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 is performed on the graphical user interface; the first data table includes a A second data table with the first fragmented tablespace;

S102、根据所述第一表空间和预设的整理要求,从所述第二数据表中,确定出能够进行整理的第三数据表;S102, according to the first table space and preset sorting requirements, from the second data table, determine a third data table that can be sorted;

S103、预测对所述第三数据表进行整理后,所述数据库包含第二表空间,并根据所述第二表空间和预设的整理要求,从所述第二数据表中,确定出除所述第三数据表以外能够进行整理的第四数据表;S103. Predict that after the third data table is sorted, the database includes a second table space, and according to the second table space and preset sorting requirements, determine from the second data table, a fourth data table that can be organized in addition to the third data table;

S104、在满足预设的开始整理条件时,按照预设的整理方法依次对所述第三数据表和第四数据进行整理,以释放所述数据库的表空间。S104. When a preset start sorting condition is satisfied, sort the third data table and the fourth data in sequence according to a preset sorting method, so as to release the table space of the database.

本申请能够体现数据库由初始数据表和初始表空间向第一数据表和第一表空间的变化过程,帮助数据库管理人员更高效的工作;还能够自动选出能够先后进行处理的第三数据表和第四数据表,并依次进行处理,降低了人工成本,提高了对于数据库的整理效率。The 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 the database administrator to work more efficiently; it can also automatically select the third data table that can be processed successively and the fourth data table, and process them in sequence, which reduces labor costs and improves the efficiency of sorting out the database.

下面对本申请的一些实施方式作详细说明。在不冲突的情况下,下述的实施例及实施例中的特征可以相互组合。Some embodiments of the present application will be described in detail below. The embodiments described below and features in the embodiments may be combined with each other without conflict.

S101、响应针对所述数据库进行的数据表处理操作,在所述图形用户界面展示进行数据表处理后的所述数据库包含的第一数据表和第一表空间;所述第一数据表包括包含有第一碎片表空间的第二数据表。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 is performed on the graphical user interface; the first data table includes a There is a second data table for the first fragmented tablespace.

本申请中的方法应用与终端设备,这里的终端设备包括移动设备和固定设备,例如,手机,电脑,Pad等。本申请的终端设备提供一图形用户界面,并在该图形用户界面显示数据库包含的初始数据表和初始表空间。这里的初始数据表和初始表空间表征的是对数据库进行数据表操作之前的数据表和表空间。对数据库进行数据表操作包括对数据库写入新的数据表和对已有的数据表(或者数据表包含的数据)进行删除。在向数据库写入新的数据表的时候,需要在数据库中划分一个能够存储该新的数据表的目标空间,在分配好该目标空间之后,将新的数据表写入在该目标空间中。目标空间的容量一般等于该新的数据表。在数据库中的数据表进行删除或者数据库中数据表包含的数据进行删除的时候,为该数据表或者数据分配的空间会处于空闲状态,在向该部分空间写入新的数据表或者数据的时候,要求新写入的数据表或者数据与已删除的数据表或者数据的所需容量相同,大大限制了数据库的空间利用,针对该部分碎片空间是本申请需要进行释放的。The method in this application is applied to a terminal device, where the terminal device includes a mobile device and a fixed device, for example, a mobile phone, a computer, a Pad, and the like. 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 the data table operation is performed on the database. The data table operation on the database includes writing a new data table to the database and deleting an existing data table (or data contained in the data table). When writing a new data table to the database, a target space that can store the new data table needs to be divided in the database, and after the target space is allocated, the new data table is written in the target space. The capacity of the target space is generally equal to the new data table. When the 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 in an idle state, and when a new data table or data is written to this part of the space , the required capacity of the newly written data table or data is the same as that of the deleted data table or data, which greatly limits the space utilization of the database, and this part of the fragmented space needs to be released by the application.

为了能够体现出数据库数据表的变化过程,本申请通过图形用户界面进行了显示。在工作人员对数据库进行了数据表处理操作之后,本申请中的图形用户界面的显示内容由数据库包含的初始数据表和初始表空间过渡为了第一数据表和第一表空间。这里的第一数据表和第一表空间是工作人员对数据库进行了数据表处理之后,数据库包含的数据表和表空间。In order to be able to reflect the change process of the database data table, the present application displays it 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 the present application transitions from the initial data table and initial table space contained in the database to the first data table and the first table space. The first data table and the first table space here are the data table and table space contained in the database after the staff has processed the data table in the database.

本申请中的第一数据表包括包含有第一碎片表空间的第二数据表和不包含有第一碎片表空间的第五数据表。也就是说,工作人员对数据库进行了数据表操作之后,数据库中包含了两种数据表,一种为需要进行空间释放的数据表(第二数据表),另一种为不需要进行空间释放的数据表(第五数据表)。为了便于对于数据库的观察,本申请在对这两种数据表进行显示的时候,使用了不同的显示方式:在所述图形用户界面以第一等级展示方式展示所述第二数据表,在所述图形用户界面以第二等级展示方式展示所述第五数据表;所述第一等级展示方式高于第二等级展示方式。为了更加能够突出我们需要处理的第二数据表,本申请使用了较高等级的展示方式展示第二数据表。例如,第一等级展示方式为上半部分展示,第二等级展示方式为下半部分展示,根据观察习惯,一般为先观察到上半部分的内容。即将第二数据表展示在图形用户界面的上半部分,将第五数据表展示在图形用户界面的下半部分。或者第一等级展示方式为背景高亮,第二等级展示方式为背景无填充。一般认为高亮部分能够先被观察到,背景高亮展示第二数据表,背景无填充展示第五数据表。The first data table in this application includes a second data table that includes the first fragmented table space and a fifth data table that does not include the first fragmented table space. That is to say, after the staff operates the data table on the database, the database contains two kinds of data tables, one is the data table (second data table) that needs to be released, and the other is the data table that does not need to be released. data sheet (the fifth data sheet). In order to facilitate the observation of the database, the present application uses different display modes when displaying the two data tables: the second data table is displayed in the first-level display mode in the graphical user interface, and the second data table is displayed in the first-level display mode in the graphical user interface. The GUI displays the fifth data table in a second-level presentation manner; the first-level presentation manner is higher than the second-level presentation manner. In order to better highlight the second data table we need to process, this application uses a higher-level presentation method to display the second data table. For example, the first-level display method is the upper half of the display, and the second-level display method is the lower half of the display. According to observation habits, the content of the upper half is generally observed first. That is, the second data table is displayed on the upper half of the graphical user interface, and the fifth data table is displayed on the lower half of the graphical user interface. Or the first-level display method is background highlighting, and the second-level display method is background no fill. It is generally believed that the highlighted part can be observed first, the second data table is displayed with the background highlight, and the fifth data table is displayed without the background.

针对本申请中的第一(初始或者第二)表空间需要说明的是,本申请中的第一(初始或者第二)表空间包括:第一(初始或者第二)自由表空间、第一(初始或者第二)碎片表空间和第一(初始或者第二)已用表空间;这里的自由表空间表示数据库中的没有被碎片化(划分)的原始空间,这部分空间可以进行划分或者直接使用。碎片表空间表征的是已经进行了划分,但是之前分配的数据表或者数据表中的数据已经被删除,这部分空间可以写入与之前分配的数据表或者数据所需空间相通的数据表或者数据。已用表空间表征的是数据库中已经分配的空间,且为该部分空间分配的数据表或者数据没有被删除,还在使用该部分空间。本申请需要将对碎片表空间进行时释放,使其还原为自由表空间。For the first (initial or second) tablespace in this application, 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) tablespace The (initial or second) fragmented tablespace and the first (initial or second) used tablespace; the free tablespace here represents the original space in the database that is not fragmented (divided), and this part of the space can be divided or Use directly. Fragmented table space indicates that it 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 the data table or data that is the same as the space required for the previously allocated data table or data. . The used table space represents the space that has been allocated in the database, and the data table or data allocated for this part of the space has not been deleted, and this part of the space is still being used. In this application, the fragmented table space needs to be released in time to restore it to a free table space.

为了便于观察数据库的表空间的使用情况,为后续对于数据表的操作打下基础,本申请在所述图形用户界面展示第一表空间时包括:以第一展示方式展示所述第一表自由表空间;在所述图形用户界面以第二展示方式展示所述第一碎片表空间;在所述图形用户界面以第三展示方式展示所述第一已用表空间;其中,所述第一展示方式、第二展示方式和第三展示方式均不相同。本申请通过不同的展示方式展示第一自由表空间、第一碎片表空间和第一已用表空间,方便了后续对数据表的操作。例如,以黄色显示第一已用表空间,以红色显示第一碎片表空间,以绿色显示第一自由表空间。In order to facilitate the observation of the usage of the table space of the database and lay a foundation for subsequent operations on the data table, the present application includes: displaying the first table free table in a first display manner when displaying the first table space in the graphical user interface. space; the first fragmented tablespace is displayed in the graphical user interface in a second presentation mode; the first used tablespace is displayed in the graphical user interface in a third presentation mode; wherein, the first presentation The method, the second display method and the third display method are all different. The present application displays the first free tablespace, the first fragmented tablespace, and the first used tablespace through different display methods, which facilitates subsequent operations on the data table. For example, the first used tablespace is displayed in yellow, the first fragmented tablespace is displayed in red, and the first free tablespace is displayed in green.

S102、根据所述第一表空间和预设的整理要求,从所述第二数据表中,确定出能够进行整理的第三数据表。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.

本申请在得到了对数据库进行数据表处理后的第一数据表和第一表空间之后,由于在对数据表进行空间释放的时候,对于数据库有一定的要求,所以要从需要进行空间释放的第二数据表中,挑选出满足整理要求的第三数据表,也就是说,根据数据库的当前情况,从需要进行空间释放的第二数据表中选择出能够进行空间释放的第三数据表。After the application has obtained the first data table and the first table space after data table processing on the database, since there are certain requirements for the database when releasing the space for the data table, it is necessary to remove the space that needs to be released. In the second data table, a third data table that meets the sorting requirements is selected, that is, according to the current situation of the database, a third data table that can perform space release is selected from the second data table that needs to be released.

在具体实施时,整理要求包括业务支持要求、业务时间要求和业务空间要求。例如,第一步需要校验目前表空间是否支撑进行DDL任务,因为gh-ost操作DDL是通过表拷贝的方式,所以空间至少要有现有表的2倍以上才行。第二步,通过判断当前是否是业务的高峰期,可以通过获取业务当前的QPS、TPS进行判断。第三步,需要校验执行过程中的风险,我们可以通过获取当前是否含有大事务或者当前表的大查询,防止DML锁导致生产故障。In the specific implementation, the sorting requirements include business support requirements, business time requirements and business space requirements. For example, the first step is to verify whether the current table space supports DDL tasks. Because gh-ost operates DDL through table copying, the space must be at least twice the size of the existing table. In the second step, by judging whether the current is the peak period of the service, the judgment can be made by obtaining the current QPS and TPS of the service. The third step is to verify the risks in the execution process. We can prevent DML locks from causing production failures by obtaining whether there are currently large transactions or large queries of the current table.

在判断业务空间要求的时候,需要根据数据库当前的第一表空间进行判断。具体的,需要确定第一表空间中的第一自由表空间的容量能否满足整理第二数据表所需要的容量。将当前的第一自由表空间能够满足容量对应的第二数据表作为第三数据表。When judging the business space requirements, it is necessary to judge according to the current first table space of the database. Specifically, it is necessary to determine whether the capacity of the first free table space in the first table space can meet the capacity required for sorting out the second data table. The second data table corresponding to the capacity of the current first free table space can be used as the third data table.

S103、预测对所述第三数据表进行整理后,所述数据库包含第二表空间,并根据所述第二表空间和预设的整理要求,从所述第二数据表中,确定出除所述第三数据表以外能够进行整理的第四数据表。S103. Predict that after the third data table is sorted, the database includes a second table space, and according to the second table space and preset sorting requirements, determine from the second data table, A fourth data table that can be organized in addition to the third data table.

在得到了第三数据表之后,本申请对这些第三数据表进行空间释放之后数据库进行预测,得到对第三数据表进行整理之后,数据库包含的第二表空间。然后同上述确定第二数据表的方式,从第二数据表中确定出除所述第三数据表以外能够进行整理的第四数据表。After the third data table is obtained, the present application performs prediction on the database after the space release of the third data table, and obtains the second table space included in the database after the third data table is sorted. Then, in the same manner as the above-mentioned method for determining the second data table, a fourth data table that can be sorted out in addition to the third data table is determined from the second data table.

在得到第四数据表之后,所述方法还包括:预测对所述第四数据表进行整理后,所述数据库包含第三表空间,并根据所述第三表空间和预设的整理要求,从所述第二数据表中,确定出除所述第三数据表和第四数据表以外能够进行整理的第七数据表,直至遍历第二数据表。也就是说,本申请能够对所有的第二数据表均进行空间释放,但是由于在对第二数据表对于空间的要求,本申请先筛选了能够满足空间需要的数据表先进行空间释放,为后续空间需求较大的数据表提供空间,当整理出来的空间能够满足该数据表的需求空间的时候,即对该数据表进行空间释放,直至所有的第二数据表的都被释放了空间。After the fourth data table is obtained, the method further includes: predicting that after sorting the fourth data table, the database includes a third table space, and according to the third table space and preset sorting requirements, From the second data table, determine a seventh data table that can be sorted except the third data table and the fourth data table, until the second data table is traversed. That is to say, the application can release space for all the second data tables, but due to the space requirements for the second data tables, the application first selects the data tables that can meet the space requirements and releases the space first, so as to Subsequent data tables with larger space requirements provide space. When the sorted space can meet the required space of the data table, the space of the data table is released until all the second data tables are released.

本申请在得到了所述第四数据表之后,所述方法包括:在所述图形用户界面以第三等级展示方式展示所述第三数据表,在所述图形用户界面以第四等级展示方式展示所述第四数据表;所述第三等级展示方式高于第四等级展示方式。After the fourth data table is obtained in the present application, the method includes: displaying the third data table in a third-level presentation manner on the graphical user interface, and displaying the third data table in a fourth-level presentation manner in the graphical user interface The fourth data table is displayed; the third-level display method is higher than the fourth-level display method.

如果本申请直到遍历第二数据表还预测得到了第七数据表、第八数据表……的话,依次使用降序等级的展示方式进行展示。If the application still predicts to obtain the seventh data table, the eighth data table .

S104、在满足预设的开始整理条件时,按照预设的整理方法依次对所述第三数据表和第四数据进行整理,以释放所述数据库的表空间。S104. When a preset start sorting condition is satisfied, sort the third data table and the fourth data in sequence according to a preset sorting method, so as to release the table space of the database.

在得到了需要整理且可以进行整理的第三数据表和第四数据表,如果需要还包括有第七数据表、第八数据表……之后,需要对这些数据表进行整理。在对这些数据表开始整理之前,本申请还设置了开始整理条件,只要满足了这些开始整理条件的时候,才开始对这些数据表进行整理。After obtaining the third data table and the fourth data table that need to be sorted out and can be sorted out, and if necessary, also include the seventh data table, the eighth data table..., these data tables need to be sorted out. Before starting to organize these data tables, the present application also sets conditions for starting to organize, and only when these conditions for starting to organize are satisfied, will these data tables begin to be organized.

本申请中预设的开始整理条件包括以下至少之一:检测到针对整理控件的第一触控操作;预设的等待时间耗尽;以及检测到针对所述第三数据表的第二触控操作。在具体实施的时候,可以对上述的开始整理条件选择设置,可以选择其中一个设置,也可以是选择多个配合设置。The preset start sorting conditions in this application include at least one of the following: detecting a first touch operation for sorting controls; expiring a preset waiting time; and detecting a second touch for the third data table operate. During specific implementation, settings may be selected for the above-mentioned start sorting conditions, one of the settings may be selected, or multiple matching settings may be selected.

针对检测到针对整理空间的第一触控操作的开始整理条件,本申请在图形用户界面显示第三数据表和第四数据表,如果需要的话还包括第七数据表、第八数据表……之外,还显示了整理控件。数据库管理员通过点击该整理控件产生开始整理信号,并依次开始对第三数据表和第四数据表,如果需要的话还包括第七数据表、第八数据表……进行整理。In response to the detection of the start sorting condition of the first touch operation for the sorting space, the present application displays the third data table and the fourth data table on the graphical user interface, and also includes the seventh data table, the eighth data table if necessary... In addition, organizer controls are displayed. The database administrator generates a start sorting signal by clicking on the sorting control, and starts sorting the third data table, the fourth data table, and if necessary, the seventh data table, the eighth data table . . .

针对预设的等待时间耗尽的开始整理条件,适用于需要自动化处理的数据库。在得到了上述了需要处理且可以进行处理的数据表之后,在设置的等待时间耗尽之后,自动依次开始对第三数据表和第四数据表,如果需要的话还包括第七数据表、第八数据表……进行整理。在对这些数据表进行整理之后,等待时间重新计时,直到下次耗尽之后,再次进行整理。也就是说,通过设置等待时间,能够实现对数据库进行周期性自动化的整理。The start sorting condition for the preset waiting time is exhausted, which is suitable for databases that need to be automated. After the above-mentioned data tables that need to be processed and can be processed are obtained, after the set waiting time is exhausted, the third data table and the fourth data table, including the seventh data table, the fourth data table, the seventh data table, the fourth data table, Eight data sheets... to organize. After tidying up these data sheets, the waiting time is reset until the next time it runs out, tidying up again. That is to say, by setting the waiting time, the periodic automatic sorting of the database can be realized.

上述两种开始整理条件触发整理的方式,在依次对第三数据表和第四数据表,如果需要的话还包括第七数据表、第八数据表……进行整理的时候,多个第三数据表(第四数据表、第七数据表、第八数据表……)之间是按照预设的排序方式进行整理的。预设的排序方式包括按照所需空间的升序排列、或者按照所需空间的降序排列等。例如,能够进行整理的第三数据表包括:数据表A所需空间为11G,数据表B所需空间为12G,数据表C所需空间为13G;如果按照所需空间的升序排列的话,在对这三个第三数据表进行整理的顺序就是数据表A、数据表B和数据表C。In the above two ways of triggering the sorting by the start sorting conditions, when sorting the third data table, the fourth data table, and if necessary, the seventh data table, the eighth data table... The tables (the fourth data table, the seventh data table, the eighth data table...) are arranged according to a preset sorting method. The preset sorting method includes an ascending order of the required space, or a descending order of the required space, and the like. For example, the third data table that can be sorted includes: the space required for data table A is 11G, the space required for data table B is 12G, and the space required for data table C is 13G; if arranged in ascending order of required space, in The order in which the three third data tables are sorted is data table A, data table B, and data table C.

针对检测到针对所述第三数据表的第二触控操作的开始整理条件,上述方法中有说到,本申请在得到了第三数据表、第四数据表,如果需要的话包括第七数据表、第八数据表……之后,在图形用户界面上进行显示。在显示上述内容之后,数据库管理员可以通过对第三数据表进行第二触控操作进行整理。具体的,数据库管理员通过将第三数据表点选至指定区域即可开始对该选定的第三数据表进行整理。即数据库管理员先点选了哪个第三数据表就选对哪个第三数据表进行整理。如果在第三数据表还未整理完成的时候,数据库管理员误触了第四数据表(第七数据表、第八数据表……)的时候,在图形用户界面显示误触提示。在所有第三数据表都整理完成的时候,在图形用户界面显示可以进行第四数据表的整理操作,并继续点选第四数据表,如此循环直至所有的第二数据表都进行了整理,对该数据库的整理工作完成。Regarding the start sorting condition for detecting the second touch operation on the third data table, it is mentioned in the above method that the present application obtains the third data table, the fourth data table, and if necessary, the seventh data table The table, the eighth data table... Then, it is displayed on the graphical user interface. After the above content is displayed, the database administrator can organize the third data table by performing a second touch operation. Specifically, the database administrator can start sorting the selected third data table by clicking the third data table to the designated area. That is, which third data table is selected by the database administrator first, then which third data table is selected for sorting. If the database administrator touches the fourth data table (the seventh data table, the eighth data table...) by mistake when the third data table has not been sorted out, a false touch prompt will be displayed on the graphical user interface. When all the third data tables are sorted, the GUI displays that the sorting operation of the fourth data table can be performed, and continues to click on the fourth data table, and so on until all the second data tables are sorted, The collation of the database is complete.

如图2所示,本申请中对所述第三数据表进行整理的过程,包括:As shown in Figure 2, the process of sorting out the third data table in this application includes:

S201、对所述第三数据表进行复制操作,得到与所述第三数据表包含的数据内容相同的第六数据表;S201, performing a copy operation on the third data table to obtain a sixth data table with the same data content contained in the third data table;

S202、针对进行数据重组后的所述第六数据表进行重新命名,并替换所述第三数据表,完成整理。S202. Rename the sixth data table after data reorganization, and replace the third data table to complete the sorting.

具体的,本申请将需要进行整理的数据表使用另外一个新的数据表替换,这里新的数据表是通过对需要进行整理的数据表复制得到。通过对原第三数据表进行复制,得到了与第三数据表数据包含的数据内容相同的第六数据表,并对第六数据表进行空间释放,即对第六数据表进行数据重组,将第六数据表中的碎片表空间进行去除,然后对第六数据表进行重命名,替换第三数据表即可完成整理。如果是删除数据表后留下的碎片表空间的话,直接对该碎片表空间进行释放即可。Specifically, this application replaces the data table that needs to be sorted out with another new data table, where the new data table is obtained by duplicating the data table that needs to be sorted out. By duplicating the original third data table, a sixth data table with the same data content as the data contained in the third data table is obtained, and space is released for the sixth data table, that is, data reorganization is performed on the sixth data table, and the The fragmented table space in the sixth data table is removed, then the sixth data table is renamed, and the third data table is replaced to complete the sorting. If it is the fragmented table space left after deleting the data table, you can directly release the fragmented table space.

图3示出了本申请实施例所提供的一种数据库的表空间整理装置的结构示意图,驻留于终端设备,终端设备提供一图形用户界面,所述图形用户界面显示数据库包含的初始数据表和初始表空间;所述装置包括:FIG. 3 shows a schematic structural diagram of a table space arrangement device for a database provided by an embodiment of the present application, which resides in a terminal device, and the terminal device provides a graphical user interface, and the graphical user interface displays the initial data table included in the database. and the initial tablespace; the means include:

第一展示模块,用于响应针对所述数据库进行的数据表处理操作,在所述图形用户界面展示进行数据表处理后的所述数据库包含的第一数据表和第一表空间;所述第一数据表包括包含有第一碎片表空间的第二数据表;The first display module is configured to display the first data table and the first table space contained in the database after the data table processing is performed on the graphical user interface in response to the data table processing operation performed on the database; a data table including a second data table containing the first fragmented table space;

第一确定模块,用于根据所述第一表空间和预设的整理要求,从所述第二数据表中,确定出能够进行整理的第三数据表;a first determining module, configured to determine a third data table that can be sorted out from the second data table according to the first table space and preset sorting requirements;

第二确定模块,用于预测对所述第三数据表进行整理后,所述数据库包含第二表空间,并根据所述第二表空间和预设的整理要求,从所述第二数据表中,确定出除所述第三数据表以外能够进行整理的第四数据表;The second determination module is used to predict that after the third data table is sorted, the database contains a second table space, and according to the second table space and preset sorting requirements, from the second data table , determine a fourth data table that can be organized in addition to the third data table;

整理模块,用于在满足预设的开始整理条件时,按照预设的整理方法依次对所述第三数据表和第四数据进行整理,以释放所述数据库的表空间。The sorting module is used for sorting the third data table and the fourth data in sequence according to a preset sorting method when a preset sorting start condition is satisfied, so as to release the table space of the database.

所述第一表空间包括:第一自由表空间、第一碎片表空间和第一已用表空间;在所述图形用户界面展示所述第一表空间包括:The first table space includes: a first free table space, a first fragmented table space and a first used table space; displaying the first table space on the graphical user interface includes:

在所述图形用户界面以第一展示方式展示所述第一表自由表空间;在所述图形用户界面以第二展示方式展示所述第一碎片表空间;在所述图形用户界面以第三展示方式展示所述第一已用表空间;其中,所述第一展示方式、第二展示方式和第三展示方式均不相同。The first table free table space is displayed on the GUI in a first presentation mode; the first fragmented table space is displayed in a second presentation mode in the graphical user interface; and the third table space is displayed in the graphical user interface The display mode displays the first used table space; wherein, the first display mode, the second display mode and the third display mode are all different.

所述第一数据表还包括不包含有第一碎片表空间的第五数据表;在所述图形用户界面展示所述第一数据表包括:The first data table further includes a fifth data table that does not contain the first fragmented table space; 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 in the graphical user interface; the first-level display mode is higher than the first-level display mode. Second-level display.

在得到了所述第四数据表之后,所述装置包括:After obtaining the fourth data table, the apparatus includes:

第二展示模块,用于在所述图形用户界面以第三等级展示方式展示所述第三数据表,在所述图形用户界面以第四等级展示方式展示所述第四数据表;所述第三等级展示方式高于第四等级展示方式。The second display module is configured to display the third data table in a third-level display mode on the graphical user interface, and display the fourth data table in a fourth-level display mode on the graphical user interface; The third-level display method is higher than the fourth-level display method.

所述预设的开始整理条件包括以下至少之一:The preset start sorting conditions include at least one of the following:

检测到针对整理控件的第一触控操作;A first touch operation for the sorting control is detected;

预设的等待时间耗尽;The preset waiting time has expired;

以及检测到针对所述第三数据表的第二触控操作。and detecting a second touch operation on the third data table.

所述按照预设的整理方法依次对所述第三数据表进行整理,包括:The third data table is sorted in sequence according to a preset sorting method, including:

在检测到针对针对整理控件的第一触控操作或预设的等待时间耗尽时,按照预设的排序方式对所述第三数据表进行排序;Sorting the third data table according to a preset sorting method when detecting that the first touch operation for the sorting controls or the preset waiting time is exhausted;

按照预设的整理方法对排序后的所述第三数据表依次进行整理;Sorting the sorted third data table in sequence according to a preset sorting 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.

所述按照预设的整理方法依次对所述第三数据表进行整理,包括:The third data table is sorted in sequence according to a preset sorting method, including:

对所述第三数据表进行复制操作,得到与所述第三数据表内容相同的第六数据表;performing a copying operation on the third data table to obtain a sixth data table with the same content as the third data table;

针对进行数据重组后的所述第六数据表进行重新命名,并替换所述第三数据表,完成整理。The sixth data table after data reorganization is renamed, and the third data table is replaced to complete the sorting.

如图4所示,本申请实施例提供了一种电子设备,用于执行本申请中的数据库的表空间整理方法,该设备包括存储器、处理器、总线及存储在该存储器上并可在该处理器上运行的计算机程序,其中,上述处理器执行上述计算机程序时实现上述的数据库的表空间整理方法的步骤。As shown in FIG. 4 , an embodiment of the present application provides an electronic device for executing the method for organizing the table space of the database in the present application. The device includes a memory, a processor, a bus, and an electronic device stored in the memory and available in the A computer program running on a processor, wherein, when the processor executes the computer program, the steps of the above-mentioned method for organizing table space of a database are implemented.

具体地,上述存储器和处理器可以为通用的存储器和处理器,这里不做具体限定,当处理器运行存储器存储的计算机程序时,能够执行上述的数据库的表空间整理方法。Specifically, the above-mentioned memory and processor may be a general-purpose memory and processor, which is not specifically limited here. When the processor runs the computer program stored in the memory, the above-mentioned method for organizing table space of a database can be executed.

对应于本申请中的数据库的表空间整理方法,本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,该计算机程序被处理器运行时执行上述的数据库的表空间整理方法的步骤。Corresponding to the table space sorting method of the database in the present application, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and the computer program is executed by a processor when the above-mentioned program is executed. The steps of the table space defragmentation method of the database.

具体地,该存储介质能够为通用的存储介质,如移动磁盘、硬盘等,该存储介质上的计算机程序被运行时,能够执行上述的数据库的表空间整理方法。Specifically, the storage medium can be a general storage medium, such as a removable disk, a hard disk, etc., when the computer program on the storage medium is run, the above-mentioned method for organizing table space of a database can be executed.

在本申请所提供的实施例中,应该理解到,所揭露系统和方法,可以通过其它的方式实现。以上所描述的系统实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,又例如,多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些通信接口,系统或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the embodiments provided in this application, it should be understood that the disclosed system and method may be implemented in other manners. The system embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces, indirect coupling or communication connection of systems or units, and may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本申请提供的实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in the embodiments provided in this application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.

所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The functions, if implemented in the form of software functional units and sold or used as independent products, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence, or the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program codes .

应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释,此外,术语“第一”、“第二”、“第三”等仅用于区分描述,而不能理解为指示或暗示相对重要性。It should be noted that like numerals and letters refer to like items in the following figures, so that once an item is defined in one figure, it does not require further definition and explanation in subsequent figures, Furthermore, the terms "first", "second", "third", etc. are only used to differentiate the description and should not be construed as indicating or implying relative importance.

最后应说明的是:以上所述实施例,仅为本申请的具体实施方式,用以说明本申请的技术方案,而非对其限制,本申请的保护范围并不局限于此,尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,其依然可以对前述实施例所记载的技术方案进行修改或可轻易想到变化,或者对其中部分技术特征进行等同替换;而这些修改、变化或者替换,并不使相应技术方案的本质脱离本申请实施例技术方案的精神和范围。都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应所述以权利要求的保护范围为准。Finally, it should be noted that the above-mentioned embodiments are only specific implementations of the present application, and are used to illustrate the technical solutions of the present application, rather than limit them. The embodiments describe the application in detail, and those of ordinary skill in the art should understand that: any person skilled in the art can still modify the technical solutions described in the foregoing embodiments within the technical scope disclosed in the application. Changes can be easily conceived, or equivalent replacements are made to some of the technical features; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions in the embodiments of the present application. All should be covered within the scope of protection of this application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims (10)

1. A tablespace arrangement method of a database is characterized in that a graphical user interface is provided through terminal equipment, and the graphical user interface displays an initial data table and an initial tablespace contained in the database; the method comprises the following steps:
responding to the data table processing operation performed on the database, and displaying a first data table and a first table space contained in the database subjected to data table processing on the graphical user interface; the first data table comprises a second data table comprising a first shard table space;
according to the first table space and a preset sorting requirement, determining a third data table capable of being sorted from the second data table;
predicting that the database comprises a second tablespace after the third data table is sorted, and determining a fourth data table which can be sorted except the third data table from the second data table according to the second tablespace and a preset sorting requirement;
and when a preset finishing starting condition is met, sequentially finishing the third data and the fourth data according to a preset finishing method so as to release the table space of the database.
2. The method of claim 1, wherein the first tablespace comprises: a first free table space, a first fragmented table space, and a first used table space; presenting the first tablespace at the graphical user interface comprises:
displaying the first table free list space in a first display mode on the graphical user interface; displaying the first fragment table space in a second display mode on the graphical user interface; displaying the first used table space in a third display mode on the graphical user interface; the first display mode, the second display mode and the third display mode are different.
3. The method of claim 1, wherein the first data table further comprises a fifth data table that does not contain the first shard table space; displaying the first data table on the graphical user interface comprises:
displaying the second data table in a first-level display mode on the graphical user interface, and displaying the fifth data table in a second-level display mode on the graphical user interface; the first level display mode is higher than the second level display mode.
4. The method of claim 1, wherein after obtaining the fourth data table, the method comprises:
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.
5. The method according to claim 1, wherein the preset finishing start condition comprises at least one of:
detecting a first touch operation aiming at the sorting control;
the preset waiting time is exhausted;
and detecting a second touch operation for the third data table.
6. The method according to claim 5, wherein the sorting the third data tables in sequence according to a preset sorting method comprises:
when detecting that the first touch operation aiming at the sorting control or the preset waiting time is exhausted, sorting the third data table according to a preset sorting mode;
sorting the sorted third data tables in sequence according to a preset sorting method;
when a second touch operation for the third data table is detected, sorting the third data table in sequence according to a preset sorting method and a touch sequence corresponding to the second touch operation.
7. The method according to claim 1, wherein the sorting the third data tables in sequence according to a preset sorting method comprises:
copying the third data table to obtain a sixth data table with the same data content as the third data table;
and renaming the sixth data table subjected to data reorganization, replacing the third data table, and finishing the arrangement.
8. A tablespace arrangement device of a database is characterized by residing in a terminal device, wherein the terminal device provides a graphical user interface, and the graphical user interface displays an initial data table and an initial tablespace contained in the database; the device comprises:
the first display module is used for responding to the data table processing operation carried out on the database and displaying a first data table and a first table space contained in the database subjected to data table processing on the graphical user interface; the first data table comprises a second data table comprising a first shard table space;
the first determining module is used for determining a third data table capable of being sorted from the second data table according to the first table space and a preset sorting requirement;
the second determining module is used for predicting that the third data table is sorted, the database comprises a second tablespace, and according to the second tablespace and preset sorting requirements, a fourth data table which can be sorted except the third data table is determined from the second data table;
and the sorting module is used for sequentially sorting the third data and the fourth data according to a preset sorting method when a preset sorting starting condition is met so as to release the table space of the database.
9. An electronic device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating via the bus when the electronic device is operating, the machine-readable instructions when executed by the processor performing the steps of the tablespace arrangement method of a database according to any one of claims 1 to 7.
10. A computer-readable storage medium, having stored thereon a computer program for performing, when being executed by a processor, the steps of the method for tablespace arrangement of a database according to any one of claims 1 to 7.
CN202210731394.2A 2022-06-24 2022-06-24 Table space arrangement method, device, equipment and medium of database Active CN115080567B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210731394.2A CN115080567B (en) 2022-06-24 2022-06-24 Table space arrangement method, device, equipment and medium of database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210731394.2A CN115080567B (en) 2022-06-24 2022-06-24 Table space arrangement method, device, equipment and medium of database

Publications (2)

Publication Number Publication Date
CN115080567A true CN115080567A (en) 2022-09-20
CN115080567B CN115080567B (en) 2025-08-19

Family

ID=83255575

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210731394.2A Active CN115080567B (en) 2022-06-24 2022-06-24 Table space arrangement method, device, equipment and medium of database

Country Status (1)

Country Link
CN (1) CN115080567B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116594984A (en) * 2023-05-23 2023-08-15 平安科技(深圳)有限公司 Database management method, device, equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090089662A1 (en) * 2007-10-02 2009-04-02 Michael Wulkan System and method for providing a multi-row capable table
US20170011466A1 (en) * 2015-07-10 2017-01-12 The Travelers Indemnity Company Systems and methods for modular data processing
CN113434492A (en) * 2021-06-21 2021-09-24 青岛海尔科技有限公司 Data detection method and device, storage medium and electronic device
US20220019565A1 (en) * 2020-07-20 2022-01-20 Salesforce.Com, Inc. Autonomous database defragmentation

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090089662A1 (en) * 2007-10-02 2009-04-02 Michael Wulkan System and method for providing a multi-row capable table
US20170011466A1 (en) * 2015-07-10 2017-01-12 The Travelers Indemnity Company Systems and methods for modular data processing
US20220019565A1 (en) * 2020-07-20 2022-01-20 Salesforce.Com, Inc. Autonomous database defragmentation
CN113434492A (en) * 2021-06-21 2021-09-24 青岛海尔科技有限公司 Data detection method and device, storage medium and electronic device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116594984A (en) * 2023-05-23 2023-08-15 平安科技(深圳)有限公司 Database management method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN115080567B (en) 2025-08-19

Similar Documents

Publication Publication Date Title
US10592532B2 (en) Database sharding
US10783115B2 (en) Dividing a dataset into sub-datasets having a subset of values of an attribute of the dataset
US7721288B2 (en) Organizing transmission of repository data
JP4739786B2 (en) Data relocation method
CN109726042A (en) File backup device and method
EP2216710A2 (en) Methods and apparatus for performing efficient data deduplication by metadata grouping
JP2004164370A (en) Method and apparatus for allocating storage area of virtual volume
JP4733461B2 (en) Computer system, management computer, and logical storage area management method
JP2009080671A (en) Computer system, management computer, and file management method
JP4503647B2 (en) Binary search tree with hooked duplicate values for memory allocation
US20130227085A1 (en) Terminal and method for using cloud services
CN103077197A (en) Data storing method and device
CN115525631A (en) Database data migration method, device, equipment and storage medium
CN115080567A (en) A method, device, equipment and medium for arranging table space of a database
JP6111337B2 (en) Database management system and database management method
JP5448412B2 (en) Information processing apparatus and method, program, and recording medium
CN116319839A (en) Barrel cross-pool access method and device in distributed storage system
CN107256130A (en) Data store optimization method and system based on Cuckoo Hash calculations
CN109947730A (en) Metadata restoration methods, device, distributed file system and readable storage medium storing program for executing
CN116166755B (en) Search engine database management method, device and search engine database
CN107315840A (en) The management method and device of memory space in database
CN116466966A (en) Application data migration method and device, electronic equipment and storage medium
US12253974B2 (en) Metadata processing method and apparatus, and a computer-readable storage medium
US7984144B2 (en) Computer system and a method for managing logical volumes
CN112506877B (en) Data deduplication method, device and system based on deduplication domain and storage equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant