我应该使用Oracle的sys_guid()生成Guid吗? [英] Should I use Oracle's sys_guid() to generate guids?

查看:409
本文介绍了我应该使用Oracle的sys_guid()生成Guid吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些继承的代码,每次创建实体时都会调用SELECT SYS_GUID() FROM DUAL.这意味着每次插入都会有两次对Oracle的调用,一次是获取Guid,另一次是插入数据.

I have some inherited code that calls SELECT SYS_GUID() FROM DUAL each time an entity is created. This means that for each insertion there are two calls to Oracle, one to get the Guid, and another to insert the data.

我想可能有一个很好的理由,例如-Oracle的Guid可以通过顺序进行优化以进行大容量插入,因此他们可能试图避免过多的索引树重新平衡.

I suppose that there may be a good reason for this, for example - Oracle's Guids may be optimized for high-volume insertions by being sequential and thus they maybe are trying to avoid excessive index tree re-balancing.

是否有理由使用SYS_GUID而不是在客户端上构建自己的Guid?

Is there a reason to use SYS_GUID as opposed to building your own Guid on the client?

推荐答案

我发现没有理由从Oracle生成Guid.每个Guid在Oracle和客户端之间的往返行程可能比随机值插入偶尔发生的索引重新平衡要慢.

I have found no reason to generate a Guid from Oracle. The round trip between Oracle and the client for every Guid is likely slower than the occasional index rebalancing that occurs is random value inserts.

这篇关于我应该使用Oracle的sys_guid()生成Guid吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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