博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
what is partitioning the database tables
阅读量:6408 次
发布时间:2019-06-23

本文共 3203 字,大约阅读时间需要 10 分钟。

hot3.png

一、what is partitioning the database tables?什么是数据库表分区呢?

就是对数据库表里面的数据,按照一定的方式,进行逻辑上或者物理上分开。

This section discusses how to partition a database to maximize throughput, using the flight reservation casestudy as an example. To partition a table, you choose a column of the table that VoltDB can use to uniquely identify and distribute the rows into partitions.

The goal of partitioning a database table is to ensure that the most frequent transactions on the table execute in the same partition as the data accessed.

总结:

通过对上面文字的理解,知道分区不一定是分在主键上面,但是确实是经常被使用的列上面。分区个人理解就像是一个类一样,将一批有独特的行数据,分配到一片区域上面,而不只是一行数据。分区的目的是每一个数据库执行事务都在同一片区域上面进行。

We call this a single-partitioned transaction. Thus the stored procedure must uniquely identify a row by the partitioning column value. This is particularly important for queries that modify the data, such as INSERT, UPDATE,and DELETE statements.

 

二、分表的原则

4.4.3. Design Rules for Partitioning Tables

The following are the rules to keep in mind when choosing a column by which to partition table rows:

• There can be only one partition column per table. If you need to partition a table on two columns(for example first and last name), add an additional column (fullname) that combines the values of the two columns and use this new column to partition the table.

每一张表只有一个分区并且只分在一列上面。

• If the table has a primary key, the partitioning column must be included in the primary key.

如果一张表有主键,那么分区列一定要分在主键上面。

• Any integer or string column can identify the partition. VoltDB can partition rows on any column that is an integer (TINYINT, SMALLINT, INTEGER, or BIGINT) or string (VARCHAR) datatype.
(See also Table A.1, “Supported SQL Datatypes”.)

不过表的字段类型是什么类型,都可以作为分区。

• Partition column values cannot be null. The partition columns do not need to have unique values, but you must specify NOT NULL in the schema for the partition column. Numeric fields can be zero and string or character fields can be empty, but the column cannot contain a null value.

分区的列不能为空。

其它的一些建议。

The following are some additional recommendations:
• Choose a column with a reasonable distribution of values so that rows of data will be evenly partitioned.

• Choose a column that maximizes use of single-partitioned stored procedures. If one procedure uses column A to lookup data and two procedures use column B to lookup data, partition on column B. The goal of partitioning is to make the most frequent transactions single-partitioned.

• If you partition more than one table on the same column attribute, VoltDB will partition them together.

2.1关于是否复制表

对于一些常用的 read次数 比较多的表,最好让其在每个节点都能够复制一份。在VoltDB里面,不显示分区,就会默认复制。

Specifying Replicated Tables

In VoltDB, you do not explicitly state that a table is replicated. If you do not specify a partitioning column in the database schema, the table will by default be replicated.
So, in our flight reservation example, there is no explicit action required to replicate the Flight table.

However, it is very important to specify partitioning information for tables that you want to partition.

If not, they will be replicated by default, significantly changing the performance characteristics of your application.

转载于:https://my.oschina.net/u/2308739/blog/689391

你可能感兴趣的文章
Linux VFS
查看>>
ext不能选中复制属性_如何实现Extjs的grid单元格只让选择(即可以复制单元格内容)但是不让修改?...
查看>>
python中print的作用*8、不能+8_在 Python 3.x 中语句 print(*[1,2,3]) 不能正确执行。 (1.0分)_学小易找答案...
查看>>
python 生成html代码_使用Python Markdown 生成 html
查看>>
axure如何导出原件_Axure 教程:轻松导出图标字体所有图标
查看>>
laravel input值必须不等于0_框架不提供,动手造一个:Laravel表单验证自定义用法...
查看>>
cad填充图案乱理石_太快了吧!原来大神是这样用CAD图案填充的
查看>>
activator.createinstance 需要垃圾回收么_在垃圾回收器中有哪几种判断是否需要被回收的方法...
查看>>
rocketmq 消息指定_RocketMQ入坑系列(一)角色介绍及基本使用
查看>>
redis zset转set 反序列化失败_掌握好Redis的数据类型,面试心里有底了
查看>>
p图软件pⅰc_娱乐圈最塑料的夫妻,P图永远只P自己,太精彩了吧!
查看>>
jenkins 手动执行_Jenkins 入门
查看>>
怎么判断冠词用a还是an_葡语干货 | 葡萄牙语冠词用法整理大全
查看>>
js传参不是数字_JS的Reflect学习和应用
查看>>
三个不等_数学一轮复习05,从函数观点看方程与不等式,记住口诀与联系
查看>>
卡尺测量的最小范围_汽车维修工具-测量用具
查看>>
网优5g前景_5G网络优化师前景怎么样?
查看>>
竞态条件的赋值_[译] part25: golang Mutex互斥锁
查看>>
delmatch oracle_完美完全卸载(清除)oracle数据库的方式(方法)
查看>>
pyqt 滚动条 美化_Pyqt5 关于流式布局和滚动条的综合使用示例代码
查看>>