Movatterモバイル変換


[0]ホーム

URL:


CN106168949A - Method and device for database splitting - Google Patents

Method and device for database splitting
Download PDF

Info

Publication number
CN106168949A
CN106168949ACN201610286177.1ACN201610286177ACN106168949ACN 106168949 ACN106168949 ACN 106168949ACN 201610286177 ACN201610286177 ACN 201610286177ACN 106168949 ACN106168949 ACN 106168949A
Authority
CN
China
Prior art keywords
data
tables
allocated
indications
database
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
CN201610286177.1A
Other languages
Chinese (zh)
Other versions
CN106168949B (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.)
Taikang Insurance Group Co Ltd
Taikang Online Property Insurance Co Ltd
Original Assignee
Taikang Insurance Group Co Ltd
Taikang Online Property Insurance 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 Taikang Insurance Group Co Ltd, Taikang Online Property Insurance Co LtdfiledCriticalTaikang Insurance Group Co Ltd
Priority to CN201610286177.1ApriorityCriticalpatent/CN106168949B/en
Publication of CN106168949ApublicationCriticalpatent/CN106168949A/en
Application grantedgrantedCritical
Publication of CN106168949BpublicationCriticalpatent/CN106168949B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

Translated fromChinese

本公开是关于一种数据库拆分的方法及装置,该方法包括:将数据库中待分配的数据表名称中的预设位置采用排序关系的标示符标示;将所述待分配的数据表分配到至少两个子数据库中,其中以根据数据表名称中的所述排序关系的标示符确定分配后的数据表所在的子数据库。本公开的技术方案能够预先判断数据拆分后的准确位置,能够提高数据库拆分后的查询效率。

The present disclosure relates to a method and device for splitting a database. The method includes: marking the preset position in the name of the data table to be allocated in the database with an identifier of a sorting relationship; allocating the data table to be allocated to Among the at least two sub-databases, the sub-database where the allocated data table is located is determined according to the identifier of the sorting relationship in the data table name. The technical solution of the present disclosure can pre-judge the exact location of the split data, and can improve the query efficiency after the split of the database.

Description

Translated fromChinese
数据库拆分的方法及装置Method and device for database splitting

技术领域technical field

本公开涉及数据库领域,尤其涉及一种数据库拆分的方法及装置。The present disclosure relates to the field of databases, in particular to a database splitting method and device.

背景技术Background technique

随着分布式布置与管理模式的推广,数据库的拆分与整合越来越普遍,数据库拆分的基本思想是将一个数据库拆分为多个数据部分,每个数据部分分别存储到不同的数据库上,从而缓解单一数据库的性能问题。With the promotion of distributed layout and management mode, database splitting and integration are becoming more and more common. The basic idea of database splitting is to split a database into multiple data parts, and each data part is stored in a different database on, thereby alleviating the performance problem of a single database.

对于数据量庞大的企业级数据库来说,拆分要求非常高,既要保证拆分科学,避免重复或数据丢失,又要保证后续的查询方便快捷。For enterprise-level databases with a huge amount of data, the requirements for splitting are very high. It is necessary to ensure scientific splitting to avoid duplication or data loss, and to ensure that subsequent queries are convenient and fast.

相关技术提供的方法为利用哈希值取模的方式来进行数据库拆分。但这类方法通常需要每次利用哈希值模型进行计算,较为费时且占用系统资源,而且计算后数据分配不直观,使用者无法预先判断出数据重新分配后的准确位置,必须在整套拆分程序完成后通过系统显示才得知。The method provided by the related technology is to split the database by taking modulus of the hash value. However, this kind of method usually needs to use the hash value model to calculate each time, which is time-consuming and takes up system resources. Moreover, the data distribution after calculation is not intuitive, and the user cannot pre-judge the exact location of the data after redistribution. It must be split in the whole set After the program is completed, it will be known through the system display.

基于上述,需要提供一种新的数据拆分的方法及装置。Based on the above, it is necessary to provide a new method and device for data splitting.

在所述背景技术部分公开的上述信息仅用于加强对本公开的背景的理解,因此它可以包括不构成对本领域普通技术人员已知的现有技术的信息。The above information disclosed in this Background section is only for enhancement of understanding of the background of the disclosure and therefore it may contain information that does not form the prior art that is already known in the art to a person of ordinary skill in the art.

发明内容Contents of the invention

为克服相关技术中存在的问题,本公开提供一种数据库拆的分方法及装置。In order to overcome the problems existing in the related technologies, the present disclosure provides a database splitting method and device.

根据本公开实施例的第一方面,提供一种数据库拆分的方法,包括:According to a first aspect of an embodiment of the present disclosure, a method for database splitting is provided, including:

将数据库中待分配的数据表名称中的预设位置采用排序关系的标示符标示;Marking the preset position in the name of the data table to be allocated in the database with the identifier of the sorting relationship;

将所述待分配的数据表分配到至少两个子数据库中,其中以根据数据表名称中的所述排序关系的标示符确定分配后的数据表所在的子数据库。The data table to be allocated is allocated to at least two sub-databases, wherein the sub-database where the allocated data table is located is determined according to the identifier of the sorting relationship in the data table name.

于一实施例中,将所述待分配的数据表分配到至少两个子数据库中的操作包括:In one embodiment, the operation of allocating the data tables to be allocated to at least two sub-databases includes:

将所述待分配的数据表名称中的所述排序关系的标示符与所述子数据库建立对应关系;Establishing a corresponding relationship between the identifier of the sorting relationship in the name of the data table to be allocated and the sub-database;

根据所述对应关系将所述待分配的数据表分配到所对应的子数据库中。The data table to be allocated is allocated to the corresponding sub-database according to the corresponding relationship.

于一实施例中,将所述待分配的数据表名称中的所述排序关系的标示符与所述子数据库建立对应关系的操作包括:In one embodiment, the operation of establishing a corresponding relationship between the identifier of the sorting relationship in the name of the data table to be allocated and the sub-database includes:

获取所述至少两个子数据库的数目,以及获取所述待分配的数据表名称中的所述排序关系的标示符的数目,将所述标示符的数目与所述子数据库的数目求模获取各子数据库待容纳的数据表数目,根据所述待分配的数据表名称中的所述标示符和所述数据表数目,顺次将所述待分配的数据表的标示符与所述子数据库建立对应关系。Acquiring the number of the at least two sub-databases, and obtaining the number of identifiers of the sorting relationship in the name of the data table to be allocated, and obtaining the number of identifiers modulo the number of sub-databases to obtain each The number of data tables to be accommodated in the sub-database, according to the identifier in the name of the data table to be allocated and the number of data tables, sequentially establish the identifier of the data table to be allocated with the sub-database Correspondence.

于一实施例中,所述排序关系的标示符包括顺次的数字、或顺次的大写字母、或顺次的小写字母、或顺次的数字、大写字母以及小写字母中至少两者的组合。In one embodiment, the identifier of the sorting relationship includes sequential numbers, or sequential uppercase letters, or sequential lowercase letters, or a combination of at least two of sequential numbers, uppercase letters, and lowercase letters .

于一实施例中,所述方法还包括,根据分配后的数据表与所在的子数据库之间的对应关系,生成拆分分配信息用于查询数据表的分配位置。In an embodiment, the method further includes, according to the corresponding relationship between the allocated data tables and the sub-databases, generating split allocation information for querying the allocation locations of the data tables.

根据本公开实施例的第二方面,提供一种数据库拆分的装置,包括:According to a second aspect of an embodiment of the present disclosure, a database splitting device is provided, including:

名称标识单元,用于将数据库中待分配的数据表名称中的预设位置采用排序关系的标示符标示;The name identification unit is used to mark the preset position in the name of the data table to be allocated in the database with the identifier of the sorting relationship;

数据表分配单元,用于将所述待分配的数据表分配到至少两个子数据库中,其中以根据数据表名称中的所述排序关系的标示符确定分配后的数据表所在的子数据库。The data table allocation unit is configured to allocate the data table to be allocated to at least two sub-databases, wherein the sub-database where the allocated data table is located is determined according to the identifier of the ordering relationship in the data table name.

于一实施例中,所述数据表分配单元包括名称对应子单元以及分配子单元;In one embodiment, the data table allocation unit includes a name correspondence subunit and an allocation subunit;

所述名称对应子单元,用于将所述待分配的数据表名称中的所述排序关系的标示符与所述子数据库建立对应关系;The name corresponds to a subunit, which is used to establish a corresponding relationship between the identifier of the sorting relationship in the name of the data table to be allocated and the sub-database;

所述分配子单元,用于根据所述对应关系将所述待分配的数据表分配到所对应的子数据库中。The allocating subunit is configured to allocate the data table to be allocated to the corresponding sub-database according to the corresponding relationship.

于一实施例中,所述名称对应子单元用于,获取所述至少两个子数据库的数目,以及获取所述待分配的数据表名称中的所述排序关系的标示符的数目,将所述标示符的数目与所述子数据库的数目求模获取各子数据库待容纳的数据表数目,根据所述待分配的数据表名称中的所述标示符和所述数据表数目,顺次将所述待分配的数据表的标示符与所述子数据库建立对应关系。In one embodiment, the name corresponding subunit is used to obtain the number of the at least two sub-databases, and obtain the number of identifiers of the sorting relationship in the name of the data table to be allocated, and convert the The number of identifiers and the number of sub-databases are moduloed to obtain the number of data tables to be accommodated in each sub-database, and according to the identifiers and the number of data tables in the names of the data tables to be allocated, sequentially divide the The identifiers of the data tables to be allocated are associated with the sub-databases.

于一实施例中,所述排序关系的标示符包括顺次的数字、或顺次的大写字母、或顺次的小写字母、或顺次的数字、大写字母以及小写字母中至少两者的组合。In one embodiment, the identifier of the sorting relationship includes sequential numbers, or sequential uppercase letters, or sequential lowercase letters, or a combination of at least two of sequential numbers, uppercase letters, and lowercase letters .

于一实施例中,所述装置还包括分配信息生成单元,用于根据分配后的数据表与所在的子数据库之间的对应关系,生成拆分分配信息用于查询数据表的分配位置。In one embodiment, the device further includes an allocation information generation unit, configured to generate split allocation information for querying the allocation location of the data table according to the correspondence between the allocated data table and the sub-database where it is located.

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

本公开的技术方案能够预先判断数据拆分后的准确位置,能够提高数据库拆分后的查询效率。The technical solution of the present disclosure can pre-judge the exact position of the split data, and can improve the query efficiency after the split of the database.

应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本公开。It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure.

附图说明Description of drawings

此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本发明的实施例,并与说明书一起用于解释本发明的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description serve to explain the principles of the invention.

图1是根据一示例性实施例示出的一种数据库拆分的方法的流程图;Fig. 1 is a flow chart of a method for database splitting shown according to an exemplary embodiment;

图2是根据一示例性实施例示出的一种数据库拆分的方法的流程图;Fig. 2 is a flow chart showing a method for database splitting according to an exemplary embodiment;

图3是是根据一示例性实施例示出的方法中步骤S220的流程图;Fig. 3 is a flow chart of step S220 in the method shown according to an exemplary embodiment;

图4是根据一示例性实施例示出的一种数据库拆分的装置的示意图;Fig. 4 is a schematic diagram of a database splitting device according to an exemplary embodiment;

图5是根据一示例性实施例示出的一种数据库拆分的装置的示意图。Fig. 5 is a schematic diagram of an apparatus for database splitting according to an exemplary embodiment.

具体实施方式detailed description

这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本发明相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本发明的一些方面相一致的装置和方法的例子。Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the present invention. Rather, they are merely examples of apparatuses and methods consistent with aspects of the invention as recited in the appended claims.

实施例一Embodiment one

图1是根据一示例性实施例示出的一种数据库拆分的方法的流程图,本实施例可适用于将数据库中的数据表拆分到至少两个数据库的情况,如图1所示,本实施例所述的数据库拆分的方法包括:Fig. 1 is a flow chart of a method for splitting a database according to an exemplary embodiment. This embodiment is applicable to splitting a data table in a database into at least two databases, as shown in Fig. 1 , The method for database splitting described in this embodiment includes:

在步骤S110中,将数据库中待分配的数据表名称中的预设位置采用排序关系的标示符标示。In step S110, the preset position in the name of the data table to be allocated in the database is marked with an identifier of a sort relationship.

在步骤S120中,将待分配的数据表分配到至少两个子数据库中,其中以根据数据表名称中的排序关系的标示符确定分配后的数据表所在的子数据库。In step S120, the data table to be allocated is allocated to at least two sub-databases, wherein the sub-database where the allocated data table is located is determined according to the identifier of the sort relationship in the data table name.

基于上述,本公开的技术方案能够预先判断数据拆分后的准确位置,提高数据库拆分后的查询效率。Based on the above, the technical solution of the present disclosure can pre-judge the exact location of the split data, and improve the query efficiency after the split of the database.

实施例二Embodiment two

图2是根据一示例性实施例示出的一种数据库拆分的方法的流程图,如图2所示,本实施例所述的数据库拆分的方法包括:Fig. 2 is a flowchart of a method for splitting a database according to an exemplary embodiment. As shown in Fig. 2, the method for splitting a database according to this embodiment includes:

在步骤S210中,将数据库中待分配的数据表名称中的预设位置采用排序关系的标示符标示。其中“预设位置”可以根据需要进行设定,例如对于数据表名称“ABC**”,就可以将“**”设定为标示符的预设位置,例如“ABC45”、“ABC64”等均为数据表名称。本实施例中的预设位置不仅仅是指数据表名称的倒数第一位和倒数第二位的阿拉伯数字,如果数据表的数量较大,还可能用三位甚至更多位的排序数字表示,而且排序数字也可以在数据表名称的其他位置,例如前两位或前三位甚至前几位。In step S210, the preset position in the name of the data table to be allocated in the database is marked with an identifier of a sorting relationship. Among them, the "preset position" can be set according to the needs. For example, for the data table name "ABC**", you can set "**" as the default position of the identifier, such as "ABC45", "ABC64", etc. Both are data table names. The preset position in this embodiment not only refers to the Arabic numerals in the penultimate and penultimate digits of the data table name, if the number of data tables is large, it may also be represented by three or more sorting numbers , and the sorting number can also be in other positions of the data table name, such as the first two or the first three or even the first few.

其中排序关系的标示符可以为顺次的数字、顺次的大写字母或顺次的小写字母,也可以为顺次的数字、大写字母以及小写字母中至少两者的组合。例如,标示符可以为1,2,3……,还可以为A,B,C……,还可以为a,b,c……,还可以为A1,A2,A3……,还可以为aB1,aB2,aB3……等等,此处不再一一列举。另外,本实施例中的数字不仅可以是阿拉伯数字,还可以是罗马数字,无论数字与字母,只要是具有默认顺序或人为约定顺序的标示符均可用于数据库拆分的依据,在本本实施例中不作具体限定。The identifier of the sorting relationship may be sequential numbers, sequential uppercase letters or sequential lowercase letters, or a combination of at least two of sequential numbers, uppercase letters, and lowercase letters. For example, the identifier can be 1, 2, 3..., it can also be A, B, C..., it can also be a, b, c..., it can also be A1, A2, A3..., it can also be aB1, aB2, aB3...etc., they will not be listed here. In addition, the numbers in this embodiment can be not only Arabic numerals, but also Roman numerals. Regardless of numbers and letters, as long as they are identifiers with a default order or an artificially agreed order, they can be used as the basis for database splitting. In this embodiment is not specifically limited.

在步骤S220中,将待分配的数据表名称中的排序关系的标示符与子数据库建立对应关系。例如,在本实施例中可以按照至少两个子数据库的数目建立待分配的数据表名称中的标示符与子数据库之间的对应关系,以下对步骤S220进行说明。In step S220, a corresponding relationship is established between the identifier of the sorting relationship in the name of the data table to be allocated and the sub-database. For example, in this embodiment, the corresponding relationship between the identifier in the name of the data table to be allocated and the sub-database can be established according to the number of at least two sub-databases, and step S220 will be described below.

图3是根据一示例性实施例示出的方法中步骤S220的流程图,如图3所示,本实施例将待分配的数据表名称中的排序关系的标示符与子数据库建立对应关系的步骤包括:Fig. 3 is a flow chart of step S220 in the method shown according to an exemplary embodiment. As shown in Fig. 3 , this embodiment establishes a corresponding relationship between the identifier of the sorting relationship in the name of the data table to be assigned and the sub-database include:

如图3所示,在步骤S221中,获取至少两个子数据库的数目。As shown in FIG. 3, in step S221, the numbers of at least two sub-databases are acquired.

在步骤S222中,获取待分配的数据表名称中的排序关系的标示符的数目。In step S222, the number of identifiers of sorting relationships in the name of the data table to be allocated is acquired.

在步骤S223中,将标示符的数目与子数据库的数目求模获取各子数据库待容纳的数据表数目。In step S223, the number of identifiers and the number of sub-databases are calculated modulo to obtain the number of data tables to be accommodated in each sub-database.

在步骤S224中,根据步骤S222中得到的待分配的数据表名称中的标示符和步骤S223中得到数据表数目,顺次将待分配的数据表的标示符与子数据库建立对应关系。In step S224, according to the identifier in the name of the data table to be allocated obtained in step S222 and the number of data tables obtained in step S223, the identifiers of the data table to be allocated are correspondingly established with the sub-databases in sequence.

按照上述步骤将待分配的数据表按照数据表名称中的预设位置的标示符分配到标示符所对应的子数据库中。According to the above steps, the data table to be allocated is allocated to the sub-database corresponding to the identifier according to the identifier at the preset position in the data table name.

如图2所示,在步骤S230中,根据分配后的数据表与所在的子数据库之间的对应关系,生成拆分分配信息用于查询数据表的分配位置。As shown in FIG. 2 , in step S230 , according to the corresponding relationship between the allocated data tables and the sub-databases, split allocation information is generated for querying the allocation positions of the data tables.

以数据表名称中倒数第一位和倒数第二位的数字作为标示符为例,进行数据拆分的方法流程大致如下:Taking the penultimate and penultimate numbers in the data table name as identifiers as an example, the method flow for data splitting is roughly as follows:

1)将数据库中待分配的数据表名称中以倒数第一位和倒数第二位的数字定义为具有排序关系的标示符,例如其中的两个数据表的名称为ABC45和ABC64。1) Define the first-to-last and second-to-last numbers in the names of the data tables to be allocated in the database as identifiers with a sorting relationship, for example, the names of the two data tables are ABC45 and ABC64.

2)当数据库进行一次拆分时,例如将数据库整体分为2个子数据库,则可定义将数据表ABC00-ABC50分配至第一子数据库,而将数据表ABC51-ABC99分配至第二子数据库。2) When the database is split once, for example, the whole database is divided into two sub-databases, it can be defined that data tables ABC00-ABC50 are assigned to the first sub-database, and data tables ABC51-ABC99 are assigned to the second sub-database.

3)用户可根据预先约定的排序关系,直接判断出数据表ABC45存储于第一子数据库中,ABC64被存储于第二子数据库中,依据为按照数字排列顺序,数字45位于00-50之间,因此数据表ABC45位于第一子数据库中,而数字64位于51-99之间,因此数据表ABC64位于第二子数据库中。3) The user can directly determine that the data table ABC45 is stored in the first sub-database and ABC64 is stored in the second sub-database according to the pre-agreed sorting relationship, based on the fact that the number 45 is between 00-50 according to the sequence of numbers , so the data table ABC45 is in the first sub-database, and the number 64 is between 51-99, so the data table ABC64 is in the second sub-database.

4)当数据库进行二次拆分时,例如将整个数据库分为10个子数据库,则可定义将数据表ABC00-10分配至第一子数据库,将数据表ABC11-20分配至第二子数据库中,以下依次类推。4) When the database is split twice, for example, the entire database is divided into 10 sub-databases, it can be defined to assign the data table ABC00-10 to the first sub-database, and assign the data table ABC11-20 to the second sub-database , and so on.

5)继上述步骤之后,用户可直接预先约定的排序关系,判断出数据表ABC45存储于第五子数据库中,数据表ABC64被存储于第七子数据库中。5) After the above steps, the user can directly pre-agreed on the sorting relationship, and determine that the data table ABC45 is stored in the fifth sub-database, and the data table ABC64 is stored in the seventh sub-database.

还需要说明的是,其中本公开所提供的数据库的拆分方法并不以此为局限,数据表名称可以使用数字、大小写字母等具有排列关系的标示符。另外,数据库拆分定义以及数据表分配可以通过数据库命令(例如sql脚本)来实现。It should also be noted that the method for splitting the database provided in the present disclosure is not limited thereto, and the names of the data tables may use numbers, uppercase and lowercase letters, and other identifiers with an arrangement relationship. In addition, database split definition and data table allocation can be realized through database commands (such as sql script).

基于上述,可以按照本实施例提供的方法完成数据库的拆分,这种方法简单易行,避免了冗长的逻辑运算,同时也可使使用者预先了解数据拆分后的分配布置情况,且通过数据库脚本命令即可实现。Based on the above, the splitting of the database can be completed according to the method provided in this embodiment. This method is simple and easy, and avoids lengthy logical operations. Database script commands can be implemented.

实施例三Embodiment Three

图4是根据一示例性实施例示出的一种数据库拆分的装置的示意图,如图4所示,该装置1000包括名称标识单元310以及数据表分配单元320。FIG. 4 is a schematic diagram of an apparatus for splitting a database according to an exemplary embodiment. As shown in FIG. 4 , the apparatus 1000 includes a name identification unit 310 and a data table allocation unit 320 .

其中名称标识单元310用于将数据库中待分配的数据表名称中的预设位置采用排序关系的标示符标示。其中本实施例中排序关系的标示符包括顺次的数字、或顺次的大写字母、或顺次的小写字母、或顺次的数字、大写字母以及小写字母中至少两者的组合。该数据表分配单元320用于将待分配的数据表分配到至少两个子数据库中,其中以根据数据表名称中的排序关系的标示符确定分配后的数据表所在的子数据库。The name identifying unit 310 is used to mark the preset position in the name of the data table to be allocated in the database with an identifier of sorting relationship. The identifiers of the sorting relationship in this embodiment include sequential numbers, or sequential uppercase letters, or sequential lowercase letters, or a combination of at least two of sequential numbers, uppercase letters, and lowercase letters. The data table allocating unit 320 is used for allocating the data table to be allocated to at least two sub-databases, wherein the sub-database where the allocated data table is located is determined according to the identifier of the sort relationship in the data table name.

其中数据表分配单元320按照上述图3所示的步骤将待分配的数据表按照数据表名称中的预设位置的标示符分配到标示符所对应的子数据库中,本实施例中不再赘述。Wherein the data table allocation unit 320 allocates the data table to be allocated to the sub-database corresponding to the identifier according to the identifier of the preset position in the data table name according to the steps shown in the above-mentioned FIG. .

仍以数据表名称中倒数第一位和倒数第二位的数字作为标示符为例,进行数据拆分的方法流程大致如下:Still taking the penultimate and penultimate numbers in the data table name as identifiers as an example, the method flow for data splitting is roughly as follows:

名称标识单元310将数据库中待分配的数据表名称中以倒数第一位和倒数第二位的数字定义为具有排序关系的标示符,例如其中的两个数据表的名称为ABC45和ABC64。当数据库进行一次拆分时,数据表分配单元320将数据库整体分为2个子数据库,则可定义将数据表ABC00-ABC50分配至第一子数据库,而将数据表ABC51-ABC99分配至第二子数据库。用户可根据预先约定的排序关系,直接判断出数据表ABC45存储于第一子数据库中,ABC64被存储于第二子数据库中,依据为按照数字排列顺序,数字45位于00-50之间,因此数据表ABC45位于第一子数据库中,而数字64位于51-99之间,因此数据表ABC64位于第二子数据库中。当数据库进行二次拆分时,数据表分配单元320将整个数据库分为10个子数据库,则可定义将数据表ABC00-10分配至第一子数据库,将数据表ABC11-20分配至第二子数据库中,以下依次类推。最后,数据表分配单元320可直接预先约定的排序关系,判断出数据表ABC45存储于第五子数据库中,数据表ABC64被存储于第七子数据库中。The name identification unit 310 defines the first-to-last and second-to-last digits in the names of the data tables to be allocated in the database as identifiers with a sorting relationship, for example, the names of the two data tables are ABC45 and ABC64. When the database is split once, the data table allocation unit 320 divides the entire database into two sub-databases, then it can be defined that data tables ABC00-ABC50 are allocated to the first sub-database, and data tables ABC51-ABC99 are allocated to the second sub-database. database. The user can directly determine that the data table ABC45 is stored in the first sub-database and ABC64 is stored in the second sub-database according to the pre-agreed sorting relationship, based on the fact that the number 45 is between 00-50 according to the sequence of numbers, so The data table ABC45 is in the first sub-database, and the number 64 is in the range 51-99, so the data table ABC64 is in the second sub-database. When the database is split twice, the data table allocation unit 320 divides the entire database into 10 sub-databases, then it can be defined that the data table ABC00-10 is allocated to the first sub-database, and the data table ABC11-20 is allocated to the second sub-database. database, and so on. Finally, the data table allocating unit 320 can directly determine that the data table ABC45 is stored in the fifth sub-database and the data table ABC64 is stored in the seventh sub-database according to the pre-agreed sorting relationship.

如图4所示,该装置1000中还包括分配信息生成单元330,用于根据分配后的数据表与所在的子数据库之间的对应关系,生成拆分分配信息用于查询数据表的分配位置。As shown in FIG. 4, the apparatus 1000 also includes an allocation information generation unit 330, which is used to generate split allocation information for querying the allocation position of the data table according to the corresponding relationship between the allocated data table and the sub-database where it is located. .

关于上述实施例中的装置,其中各个单元执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。Regarding the apparatus in the above embodiments, the specific manner in which each unit performs operations has been described in detail in the embodiments related to the method, and will not be described in detail here.

本实施例提供的数据库拆分装置可执行本发明实施例一和实施例二所提供的数据库拆分的方法,具备执行方法相应的功能模块和有益效果。The database splitting device provided in this embodiment can execute the database splitting method provided in Embodiment 1 and Embodiment 2 of the present invention, and has corresponding functional modules and beneficial effects for executing the method.

实施例四Embodiment four

图5是根据一示例性实施例示出的一种数据库拆分装置的示意图,如图5所示,该装置2000包括:名称标识单元410、数据表分配单元420以及分配信息生成单元430。FIG. 5 is a schematic diagram of a database splitting device according to an exemplary embodiment. As shown in FIG. 5 , the device 2000 includes: a name identification unit 410 , a data table allocation unit 420 and an allocation information generation unit 430 .

名称标识单元410用于将数据库中待分配的数据表名称中的预设位置采用排序关系的标示符标示。数据表分配单元420用于将待分配的数据表分配到至少两个子数据库中,其中以根据数据表名称中的排序关系的标示符确定分配后的数据表所在的子数据库。The name identifying unit 410 is used for marking the preset position in the name of the data table to be allocated in the database with an identifier of sorting relationship. The data table allocating unit 420 is used for allocating the data table to be allocated to at least two sub-databases, wherein the sub-database where the allocated data table is located is determined according to the identifier of the sort relationship in the data table name.

进一步地,如图5所示,本实施例中的数据表分配单元420包括:名称对应子单元421以及分配子单元422,其中名称对应子单元421用于将待分配的数据表名称中的排序关系的标示符与子数据库建立对应关系。分配子单元422用于根据上述对应关系将待分配的数据表分配到所对应的子数据库中。Further, as shown in FIG. 5, the data table allocation unit 420 in this embodiment includes: a name corresponding subunit 421 and an allocation subunit 422, wherein the name corresponding subunit 421 is used to sort the name of the data table to be allocated The identifier of the relationship establishes a corresponding relationship with the sub-database. The assigning subunit 422 is configured to assign the data table to be assigned to the corresponding sub-database according to the above correspondence.

其中名称对应子单元421用于获取至少两个子数据库的数目,以及获取待分配的数据表名称中的排序关系的标示符的数目,将标示符的数目与子数据库的数目求模获取各子数据库待容纳的数据表数目,根据待分配的数据表名称中的标示符和数据表数目,顺次将待分配的数据表的标示符与子数据库建立对应关系。Wherein the name correspondence subunit 421 is used to obtain the number of at least two sub-databases, and obtain the number of identifiers of the sorting relationship in the name of the data table to be allocated, and obtain each sub-database by moduloing the number of identifiers and the number of sub-databases For the number of data tables to be accommodated, according to the identifiers in the names of the data tables to be allocated and the number of data tables, the identifiers of the data tables to be allocated are correspondingly established with the sub-databases in sequence.

如图5所示,该装置2000还包括分配信息生成单元430,用于根据分配后的数据表与所在的子数据库之间的对应关系,生成拆分分配信息用于查询数据表的分配位置。As shown in FIG. 5 , the apparatus 2000 further includes an allocation information generation unit 430 for generating split allocation information for querying the allocation location of the data table according to the corresponding relationship between the allocated data table and the sub-database.

关于上述实施例中的装置,其中各个单元执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。Regarding the apparatus in the above embodiments, the specific manner in which each unit performs operations has been described in detail in the embodiments related to the method, and will not be described in detail here.

本实施例提供的数据库拆分装置可执行本发明实施例一和实施例二所提供的数据库拆分的方法,具备执行方法相应的功能模块和有益效果。The database splitting device provided in this embodiment can execute the database splitting method provided in Embodiment 1 and Embodiment 2 of the present invention, and has corresponding functional modules and beneficial effects for executing the method.

本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本发明的其它实施方案。本申请旨在涵盖本发明的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本发明的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本发明的真正范围和精神由下面的权利要求指出。Other embodiments of the invention will be readily apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present invention, these modifications, uses or adaptations follow the general principles of the present invention and include common knowledge or conventional technical means in the technical field not disclosed in this disclosure . The specification and examples are to be considered exemplary only, with a true scope and spirit of the invention being indicated by the following claims.

应当理解的是,本发明并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本发明的范围仅由所附的权利要求来限制。It should be understood that the present invention is not limited to the precise constructions which have been described above and shown in the accompanying drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.

Claims (10)

CN201610286177.1A2016-05-032016-05-03 Method and device for database splittingActiveCN106168949B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201610286177.1ACN106168949B (en)2016-05-032016-05-03 Method and device for database splitting

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201610286177.1ACN106168949B (en)2016-05-032016-05-03 Method and device for database splitting

Publications (2)

Publication NumberPublication Date
CN106168949Atrue CN106168949A (en)2016-11-30
CN106168949B CN106168949B (en)2018-11-16

Family

ID=57358926

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201610286177.1AActiveCN106168949B (en)2016-05-032016-05-03 Method and device for database splitting

Country Status (1)

CountryLink
CN (1)CN106168949B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN107798030A (en)*2017-02-172018-03-13平安科技(深圳)有限公司The method for splitting and device of tables of data
CN108256091A (en)*2018-01-252018-07-06郑州云海信息技术有限公司A kind of vertical method for splitting based on SQLite databases
CN108399175A (en)*2017-02-072018-08-14阿里巴巴集团控股有限公司A kind of storage of data, querying method and its device
CN117633059A (en)*2024-01-252024-03-01广东广宇科技发展有限公司Data query method based on distributed database

Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101562664A (en)*2009-05-202009-10-21中兴通讯股份有限公司Ticket processing method and system
CN102053982A (en)*2009-11-022011-05-11阿里巴巴集团控股有限公司Method and equipment for managing database information
CN102541997A (en)*2011-11-232012-07-04苏州阔地网络科技有限公司Database execution method and system for automatic database partitioning
CN103136315A (en)*2011-11-222013-06-05中兴通讯股份有限公司Storage processing method and storage processing device for call detail record (CDR) data

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101562664A (en)*2009-05-202009-10-21中兴通讯股份有限公司Ticket processing method and system
CN102053982A (en)*2009-11-022011-05-11阿里巴巴集团控股有限公司Method and equipment for managing database information
CN103136315A (en)*2011-11-222013-06-05中兴通讯股份有限公司Storage processing method and storage processing device for call detail record (CDR) data
CN102541997A (en)*2011-11-232012-07-04苏州阔地网络科技有限公司Database execution method and system for automatic database partitioning

Cited By (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN108399175A (en)*2017-02-072018-08-14阿里巴巴集团控股有限公司A kind of storage of data, querying method and its device
CN108399175B (en)*2017-02-072022-04-12阿里巴巴集团控股有限公司Data storage and query method and device
CN107798030A (en)*2017-02-172018-03-13平安科技(深圳)有限公司The method for splitting and device of tables of data
CN108256091A (en)*2018-01-252018-07-06郑州云海信息技术有限公司A kind of vertical method for splitting based on SQLite databases
CN117633059A (en)*2024-01-252024-03-01广东广宇科技发展有限公司Data query method based on distributed database
CN117633059B (en)*2024-01-252024-04-09广东广宇科技发展有限公司Data query method based on distributed database

Also Published As

Publication numberPublication date
CN106168949B (en)2018-11-16

Similar Documents

PublicationPublication DateTitle
CN105354255B (en) Data query method and device
CN106168949B (en) Method and device for database splitting
CN103020158A (en)Report form creation method, device and system
CN111090803B (en) Data processing method, device, electronic device and storage medium
CN103577483B (en)The method and system of date storage method and system and data access
WO2018201887A1 (en)Data response method, apparatus, terminal device, and medium
CN104021219B (en)Data template generation method and device
CN100489860C (en)Method and apparatus for updating object local attribute to related database
CN112507020A (en)Data synchronization method and device, computer equipment and storage medium
CN113434482A (en)Data migration method and device, computer equipment and storage medium
CN110399368B (en)Method for customizing data table, data operation method and device
CN108228690A (en) A catalog management system and its management method
CN110888878A (en)Service-oriented main data management method and system
JP6268435B2 (en) Database reconstruction method, database reconstruction program, and database reconstruction device
CN116521921B (en) A configuration and query method for data models in three-dimensional visualization scenarios
CN106776622A (en)The querying method and device of access log
CN103870939A (en)Object name generating method and system
CN101013426A (en)Information management system using connection relation
CN109150964A (en)A kind of transportable data managing method and services migrating method
CN115905628A (en)Dynamic resource directory construction method, device, equipment and storage medium
CN107562858A (en)A kind of method and apparatus of menu manager
CN105930354B (en)Storage model conversion method and device
CN105912723A (en)Storage method of custom field
CN107239568B (en)Distributed index implementation method and device
CN106331000A (en) A method and device for determining a service plan

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
C10Entry into substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp