473,796 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using guid or database sequence?

Hi,

I'm trying to decide whether I should use Guid.NewGuid() to generate an ID
or using database sequence. Is Guid.NewGuid() will return a unique number?
The MSDN said that the probability of duplication is low, but how low? Does
anyone know?

thanks,

/m
Nov 15 '05 #1
5 5179
Hi muscha,

Unbelievably low - in fact low enough to basically be ignored. It is hard to
comprehend how large 128 bit integers actually are.

HTH,
--
Greg Low (MVP)
MSDE Manager SQL Tools
www.whitebearconsulting.com

"muscha" <mu****@no.spam .net> wrote in message
news:O$******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

I'm trying to decide whether I should use Guid.NewGuid() to generate an ID
or using database sequence. Is Guid.NewGuid() will return a unique number?
The MSDN said that the probability of duplication is low, but how low? Does anyone know?

thanks,

/m

Nov 15 '05 #2
> Unbelievably low - in fact low enough to basically be ignored. It is hard
to
comprehend how large 128 bit integers actually are.
So is this a good practice? To use Guid as my ID generator?

thanks,

/m

HTH,
--
Greg Low (MVP)
MSDE Manager SQL Tools
www.whitebearconsulting.com

"muscha" <mu****@no.spam .net> wrote in message
news:O$******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

I'm trying to decide whether I should use Guid.NewGuid() to generate an ID or using database sequence. Is Guid.NewGuid() will return a unique number? The MSDN said that the probability of duplication is low, but how low?

Does
anyone know?

thanks,

/m


Nov 15 '05 #3
I believe that duplications are not even possible, as long as you have a network card on the computer.
From what I understand, Guid's are generated based on the network card mac address as well as System ticks..
--------------
Robert Jeppesen
robert.jeppesen %at%durius-dot-se

"muscha" <mu****@no.spam .net> wrote in message news:O1******** ******@TK2MSFTN GP12.phx.gbl...
Unbelievably low - in fact low enough to basically be ignored. It is hard

to
comprehend how large 128 bit integers actually are.


So is this a good practice? To use Guid as my ID generator?

thanks,

/m

HTH,
--
Greg Low (MVP)
MSDE Manager SQL Tools
www.whitebearconsulting.com

"muscha" <mu****@no.spam .net> wrote in message
news:O$******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

I'm trying to decide whether I should use Guid.NewGuid() to generate an ID or using database sequence. Is Guid.NewGuid() will return a unique number? The MSDN said that the probability of duplication is low, but how low?

Does
anyone know?

thanks,

/m



Nov 15 '05 #4
"Robert Jeppesen" <robert.jeppese n(#)durius.se> wrote in message
news:uL******** ******@TK2MSFTN GP09.phx.gbl...
I believe that duplications are not even possible, as long as you have a network card on the computer. From what I understand, Guid's are generated based on the network card mac address as well as System ticks..

So .. no two computer should ever generate the same Guid yes? I am working
in multiple box setup and the uniqueness of the Guid is critical. This is
why we are thinking of using database sequence for the guarantee.

thanks,

/m

--------------
Robert Jeppesen
robert.jeppesen %at%durius-dot-se

"muscha" <mu****@no.spam .net> wrote in message

news:O1******** ******@TK2MSFTN GP12.phx.gbl...
Unbelievably low - in fact low enough to basically be ignored. It is hard
to
comprehend how large 128 bit integers actually are.


So is this a good practice? To use Guid as my ID generator?

thanks,

/m

HTH,
--
Greg Low (MVP)
MSDE Manager SQL Tools
www.whitebearconsulting.com

"muscha" <mu****@no.spam .net> wrote in message
news:O$******** ******@TK2MSFTN GP09.phx.gbl...
> Hi,
>
> I'm trying to decide whether I should use Guid.NewGuid() to generate
an ID
> or using database sequence. Is Guid.NewGuid() will return a unique

number?
> The MSDN said that the probability of duplication is low, but how

low? Does
> anyone know?
>
> thanks,
>
> /m
>
>



Nov 15 '05 #5
Globally Unique IDentifier says it all to me. Use GUIDs.

"muscha" <mu****@no.spam .net> wrote in message
news:eL******** ******@TK2MSFTN GP11.phx.gbl...
"Robert Jeppesen" <robert.jeppese n(#)durius.se> wrote in message
news:uL******** ******@TK2MSFTN GP09.phx.gbl...
I believe that duplications are not even possible, as long as you have a network card on the computer.
From what I understand, Guid's are generated based on the network card mac address as well as System ticks..

So .. no two computer should ever generate the same Guid yes? I am working
in multiple box setup and the uniqueness of the Guid is critical. This is
why we are thinking of using database sequence for the guarantee.

thanks,

/m


--------------
Robert Jeppesen
robert.jeppesen %at%durius-dot-se

"muscha" <mu****@no.spam .net> wrote in message news:O1******** ******@TK2MSFTN GP12.phx.gbl... > Unbelievably low - in fact low enough to basically be ignored. It is hard to
> comprehend how large 128 bit integers actually are.

So is this a good practice? To use Guid as my ID generator?

thanks,

/m

>
> HTH,
>
>
> --
> Greg Low (MVP)
> MSDE Manager SQL Tools
> www.whitebearconsulting.com
>
> "muscha" <mu****@no.spam .net> wrote in message
> news:O$******** ******@TK2MSFTN GP09.phx.gbl...
> > Hi,
> >
> > I'm trying to decide whether I should use Guid.NewGuid() to
generate an ID
> > or using database sequence. Is Guid.NewGuid() will return a unique
number?
> > The MSDN said that the probability of duplication is low, but how low? > Does
> > anyone know?
> >
> > thanks,
> >
> > /m
> >
> >
>
>



Nov 15 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2751
by: BigDadyWeaver | last post by:
I am using the following code in asp to define a unique and unpredictable record ID in Access. <% 'GENERATE UNIQUE ID Function genguid() Dim Guid guid = server.createobject("scriptlet.typelib").guid guid=Left(guid,instr(guid,"}")) genguid=guid
4
15656
by: Louis Frolio | last post by:
Greetings All, I have read many upon many articles here regarding GUID data types and uniqueness. There have been many opinions regarding the effectiveness of GUID's and when they should/should not be used. However, every article strongly implies, if it does not state it outright, that GUID's are always unique. My question is this, what happens if you have a database that uses GUID's and the NIC is changed out on the box? From what I...
32
3923
by: David Garamond | last post by:
Are there any drawbacks of using BYTEA for PK compared to using a primitive/atomic data types like INT/SERIAL? (like significant performance hit, peculiar FK behaviour, etc). I plan to use BYTEA for GUID (of course, temporarily I hope, until PostgreSQL officially supports GUID data type), since it seems to be the most convenient+compact compared to other data types currently available. I use GUIDs for most PK columns. --
6
2284
by: Bernd Koehler | last post by:
Hi: I am a EE prof currently teaching an IT course. One the assignments students recently completed was designing a small MS Access Database. I have two submissions that are remarkably similiar..<sigh> the structure (number of tables, field names, table names) is virtually identical. Some of the data in each table is different.
2
406
by: Jim Heavey | last post by:
I have a DataTable in which one of the columns is a GUID. When I go to add a new DataRow, how do I generate a GUID? I see that there is a datatype of Guid, but it appears to me that I must define the guid value that I am wanting. Is there some way to generate this automatically? After I generate and place this value in the DataTable, should I use the generated value or should I just let my database generate the Guid, as I have my...
26
11571
by: John Grandy | last post by:
Is it possible to generate a 20 byte integer from a GUID that is "unique enough" ( just like a GUID is not truly unique , but is "unique enough" ). We identify transactions with GUIDs , but a partner web service has a 20 byte limit on transaction ID passed.
1
2001
by: Nils N | last post by:
Hi all, Does anyone have a best practice for performring querystring authentication. I am now sending an email with a url to which the user clicks to confirm his or her registration. The url contains a Guid in the querystring, and this is validated agains the user's uniqueidenfier in the sql server database. How secure is the uniqueidentifer, and should I use a md5 encryption with a seed, or DES encryption instead?
9
6940
by: twang090 | last post by:
Trying to create a 12 digit "guid", but have no idea on how to, anyone please have any thought? Thanks in advance.
5
3506
by: stjulian | last post by:
IN IIS 6.0, classic .asp I have been creating new GUID's through this block of code set typ = server.createobject("Scriptlet.TypeLib") guid = TRIM(MID(cstr(typ.GUID),2,36)) Response.Cookies("guid") = guid Response.Cookies("guid").path = "/" Response.Cookies("guid").expires = now() + 1 set typ = nothing
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9525
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10169
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.