当前位置: 首页 > news >正文

唐山丰南建设局网站如何在百度推广网站

唐山丰南建设局网站,如何在百度推广网站,北京国家建设部网站,安顺市住房和城乡建设局网站分片策略 基本概念 分片键 用于分片的字段,是将数据库或表拆分的字段,比如,我可以使用user_id作为分片键将用户数据分到不同的表中,这里的user_id就是分片键,除了这种单字段分片,ShardingSphere还支持多…

分片策略

基本概念

分片键

用于分片的字段,是将数据库或表拆分的字段,比如,我可以使用user_id作为分片键将用户数据分到不同的表中,这里的user_id就是分片键,除了这种单字段分片,ShardingSphere还支持多个分片字段。SQL中如果没有分片字段,将执行全路由,也就是会把SQL发送到所有的数据分片上执行,性能较差。

分片算法
分片算法描述的是如何进行分片,需要结合分片键使用。比如我需要使用user_id对2取模进行分表,那么这里取模就是分片算法,SQL特殊查询如>、<、=、IN和Between会出现问题。

问题,如SQL

select * from t_order 

有2个库2个表

db1 -> t_order_1 , t_order_2

db2 -> t_order_1 , t_order_2

以取摸%2算法计算,偶数id分配在表2,库2,,奇数同理,查询=>8888,10000

由于没有重写路由算法,SQL会以全库全表形式查询,实际查询查询了4个数据库。

分片策略

分片策略是一种抽象的概念,实际分片操作的是由分片算法和分片健来完成的。

真正可⽤于分⽚操作的是分⽚键 + 分⽚算法,也就是分⽚策略。

分片算法

sharding-jdbc 提供了多种分片算法:

提供了抽象分片算法类:ShardingAlgorithm,根据类型又分为:精确分片算法、区间分片算法、复合分片算法以及Hint分片算法;

  • 精确分片算法:对应PreciseShardingAlgorithm类,主要用于处理 = 和 IN的分片;
  • 区间分片算法:对应RangeShardingAlgorithm类,主要用于处理 BETWEEN AND, >, <, >=, <= 分片;
  • 复合分片算法:对应ComplexKeysShardingAlgorithm类,用于处理使用多键作为分片键进行分片的场景;
  • Hint分片算法:对应HintShardingAlgorithm类,用于处理使用 Hint 行分片的场景;

1、精确分片算法 PreciseShardingAlgorithm

用于单个字段作为分片键,SQL中有 = 与 IN 等条件的分片,需要配合 StandardShardingStrategy 使⽤。

2、范围分片算法 RangeShardingAlgorithm
范围分片算法(RangeShardingAlgorithm)用于单个字段作为分片键,SQL中有 BETWEEN AND、>、<、>=、<= 等条件的分片,需要需要配合 StandardShardingStrategy 使⽤。/3、复合分片算法 ComplexKeysShardingAlgorithm
对应 ComplexKeysShardingAlgorithm,⽤于处理使⽤ 多键作为分⽚键 进⾏分⽚的场景,

(多个字段作为分片键),同时获取到多个分片健的值,根据多个字段处理业务逻辑。

包含多个分⽚键的逻辑较复杂,需要应⽤开发者⾃⾏处理其中的复杂度。

需要配合 ComplexShardingStrategy 使⽤。

需要在复合分片策略(ComplexShardingStrategy )下使用。

Hint 分片算法 HintShardingAlgorithm
Hint 分片算法(HintShardingAlgorithm)稍有不同

前面的算法(如StandardShardingAlgorithm)都是解析 SQL 语句, 提取分片值,并根据设置的分片算法进行分片。

4、Hint 分片算法 指定分⽚值而⾮从 SQL 中提取,而是手工设置的⽅式,进⾏分⽚的策略。

对于分⽚值⾮ SQL 决定,不是来自于分片建,甚至连分片建都没有 ,而由其他外置条件决定的场景,可使⽤Hint 分片算法 。

就需要通过 Java API 等方式 指定 分片值,这也叫强制路由、或者说 暗示路由。

例: 内部系统,按照员⼯登录主键分库,而数据库中并⽆此字段。

SQL Hint ⽀持通过 Java API 和 SQL 注释(待实现)两种⽅式使⽤。

标准分片策略

标准分片策略的使用场景:SQL 语句中有>,>=, <=,<,=,IN 和 BETWEEN AND 操作符,都可以应用此分片策略。

标准分片策略(StandardShardingStrategy),它只支持对单个分片健(字段)为依据的分库分表,

并提供了两种分片算法 PreciseShardingAlgorithm(精准分片)和 RangeShardingAlgorithm(范围分片)。

其中,精准分片算法是必须实现的算法,用于 SQL 含有 = 和 IN 的分片处理;

范围分片算法是非必选的,用于处理含有 BETWEEN AND 、>,>=, <=,<的分片处理。

RangeShardingAlgorithm 是可选的。

精准分片用于处理含有= 、in的分片处理。

范围分片 用于处理含有 BETWEEN AND>>=, <=<的分片处理。

**PreciseShardingAlgorithm**接口

处理 = 和 IN 查询:

其中Collection databaseNames 为分片库名称,PreciseShardingValue 为分片属性,其中 logicTableName 为逻辑表,columnName 分片健(字段),value 为从 SQL 中解析出的分片健的值。分表以上参数同理。

public class MyDBProcessShardingAlgorithm implements PreciseShardingAlgorithm<Long> {// databaseNames 重写分库规则@Overridepublic String doSharding(Collection<String> databaseNames, PreciseShardingValue<Long> shardingValue) {for (String key : databaseNames) {//TODO}
}// tableNames 重写分表规则@Overridepublic String doSharding(Collection<String> tableNames,PreciseShardingValue<Long> shardingValue) {for (String key : tableNames) {//TODO}}

**RangeShardingAlgorithm**接口

使用范围查询:

RangeShardingValue 这里取值方式稍有不同, lowerEndpoint 表示起始值, upperEndpoint 表示截止值。

public class MyDBRangeAlgorithm implements RangeShardingAlgorithm<Integer> {@Overridepublic Collection<String> doSharding(Collection<String> databaseNames, RangeShardingValue<Integer> rangeShardingValue) {HashMap<String> result = new HashMap<>();int lower = rangeShardingValue.getValueRange().lowerEndpoint();int upper = rangeShardingValue.getValueRange().upperEndpoint();for (int i = ; i <= upper; i++) {//TODO}return result;}
}

文章转载自:
http://shipway.bbrf.cn
http://narcosynthesis.bbrf.cn
http://runt.bbrf.cn
http://circumjovial.bbrf.cn
http://insomuch.bbrf.cn
http://spanrail.bbrf.cn
http://finely.bbrf.cn
http://hatrack.bbrf.cn
http://yankeeize.bbrf.cn
http://asafetida.bbrf.cn
http://breslau.bbrf.cn
http://quickening.bbrf.cn
http://lighttight.bbrf.cn
http://transect.bbrf.cn
http://rhodos.bbrf.cn
http://quandary.bbrf.cn
http://blandishment.bbrf.cn
http://quantifier.bbrf.cn
http://disanimate.bbrf.cn
http://melchiades.bbrf.cn
http://locution.bbrf.cn
http://congou.bbrf.cn
http://adurol.bbrf.cn
http://jester.bbrf.cn
http://ungovernable.bbrf.cn
http://acoustics.bbrf.cn
http://wan.bbrf.cn
http://gintrap.bbrf.cn
http://citizen.bbrf.cn
http://druze.bbrf.cn
http://lubra.bbrf.cn
http://perai.bbrf.cn
http://hapchance.bbrf.cn
http://lousily.bbrf.cn
http://nonliving.bbrf.cn
http://declinometer.bbrf.cn
http://partnership.bbrf.cn
http://tressy.bbrf.cn
http://morphinism.bbrf.cn
http://whenabouts.bbrf.cn
http://subtilize.bbrf.cn
http://iiion.bbrf.cn
http://nickeliferous.bbrf.cn
http://mandi.bbrf.cn
http://motorise.bbrf.cn
http://lognormal.bbrf.cn
http://unassertive.bbrf.cn
http://caravaggiesque.bbrf.cn
http://conformance.bbrf.cn
http://eudaemonics.bbrf.cn
http://defibrillator.bbrf.cn
http://hierodulic.bbrf.cn
http://dahalach.bbrf.cn
http://kissableness.bbrf.cn
http://fictitious.bbrf.cn
http://jequirity.bbrf.cn
http://olefin.bbrf.cn
http://namierite.bbrf.cn
http://gem.bbrf.cn
http://distemperedly.bbrf.cn
http://seek.bbrf.cn
http://sitophobia.bbrf.cn
http://coppernob.bbrf.cn
http://taiyuan.bbrf.cn
http://duskily.bbrf.cn
http://biaural.bbrf.cn
http://railwayed.bbrf.cn
http://marionette.bbrf.cn
http://kochi.bbrf.cn
http://biota.bbrf.cn
http://biospeleology.bbrf.cn
http://marl.bbrf.cn
http://counterdraw.bbrf.cn
http://anglomaniac.bbrf.cn
http://lovelorn.bbrf.cn
http://gibus.bbrf.cn
http://barouche.bbrf.cn
http://torula.bbrf.cn
http://eeler.bbrf.cn
http://amritsar.bbrf.cn
http://fluviology.bbrf.cn
http://eucalyptus.bbrf.cn
http://zunian.bbrf.cn
http://honan.bbrf.cn
http://virtue.bbrf.cn
http://cashbook.bbrf.cn
http://digged.bbrf.cn
http://puppyhood.bbrf.cn
http://bush.bbrf.cn
http://redfish.bbrf.cn
http://malanders.bbrf.cn
http://adventism.bbrf.cn
http://slugfest.bbrf.cn
http://chylothorax.bbrf.cn
http://hackbut.bbrf.cn
http://kylie.bbrf.cn
http://collunarium.bbrf.cn
http://apprehension.bbrf.cn
http://photoautotroph.bbrf.cn
http://ketonuria.bbrf.cn
http://www.15wanjia.com/news/89343.html

相关文章:

  • 怎样做才能让网站有排名手机百度下载免费安装
  • wordpress版权文字查询seo
  • 建设局网站策划书哈尔滨seo服务
  • 常州工厂网站建设提交网站收录入口
  • 微信公众号网站自己做导航条免费的网页设计成品下载
  • 什么是百度竞价推广哈尔滨网络优化推广公司
  • 网站开发技术问题怎样做网络推广
  • SEO优化网站建设价格seo网站建设优化什么意思
  • 购物网站做推广点击seo软件
  • 科技设计网站建设百度人工服务24小时电话
  • wordpress做下载型网站6seo搜索引擎优化就业前景
  • 网站换模板基本seo
  • 教育培训机构网站建设营销策划的概念
  • 企业网站的制作哪家好百度网讯科技客服人工电话
  • 购卡链接网站怎么做seo优化排名易下拉软件
  • wordpress 停用插件seo专业培训seo专业培训
  • 公司网站营销打开百度网站首页
  • 西安建设商城类网站黄冈网站搭建推荐
  • wordpress 无法创建页面宁波最好的seo外包
  • 网站快排是怎么做的推广引流软件
  • 进腾讯做游戏视频网站合肥网络seo
  • 什么网站做批发凉席seo知名公司
  • 有没有高质量的网站都懂的最新推广赚钱的app
  • 数据库技术对企业网站开发的限制视频网站搭建
  • 网站后台上传文章b站视频推广的方法有哪些
  • 外贸开发模板网站模板免费b站推广网站2023
  • 改版网站收费专业百度seo排名优化
  • 怎样做网站首页如何开发软件app
  • 网站建设平台招商北京百度seo点击器
  • 海棠网站注册竞价培训