嗨还是身份? [英] HiLo or identity?

查看:97
本文介绍了嗨还是身份?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想对主键发表一些意见-使用身份/序列号或使用HiLo策略(查询应用程序本身的高价值并增加低价值)会更好吗?

Just wanted to get some opinions on primary keys - would it be better to use identity/sequence numbers or use a HiLo strategy (query for the high value and increment the low value on the app itself)?

推荐答案

如果您的应用程序仅使用一个数据库,那么我将使用一个标识/序列.

If your application is only going to use one database, I'd go with an identity/sequence.

使用HiLo的唯一真正令人信服的理由是,当您的应用程序有两个断开连接的实例,人们可以同时处理这些实例时,您需要在某个时候调和差异

The only really compelling reason to go with HiLo that I've seen is when you could have two disconnected instances of your application that people can work on simultaneously and you need to reconcile the differences at some point

Ex .您正在一个内容管理系统上,人们可以在不同位置的两台不同的服务器上工作,但是这两者需要在某个时刻进行同步

Ex. You are working on a content management system where people could be working on two different servers at different locations but the two need to be sync'd at some point

这篇关于嗨还是身份?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆