Using guid or database sequence?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • muscha

    #1

    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


  • Greg Low \(MVP\)

    #2
    Re: Using guid or database sequence?

    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" <muscha@no.spam .net> wrote in message
    news:O$VdeKjjDH A.2512@TK2MSFTN GP09.phx.gbl...[color=blue]
    > 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?[/color]
    Does[color=blue]
    > anyone know?
    >
    > thanks,
    >
    > /m
    >
    >[/color]


    Comment

    • muscha

      #3
      Re: Using guid or database sequence?

      > Unbelievably low - in fact low enough to basically be ignored. It is hard
      to[color=blue]
      > comprehend how large 128 bit integers actually are.[/color]

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

      thanks,

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


      Comment

      • Robert Jeppesen

        #4
        Re: Using guid or database sequence?

        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" <muscha@no.spam .net> wrote in message news:O1mgy2jjDH A.2200@TK2MSFTN GP12.phx.gbl...[color=blue][color=green]
        > > Unbelievably low - in fact low enough to basically be ignored. It is hard[/color]
        > to[color=green]
        > > comprehend how large 128 bit integers actually are.[/color]
        >
        > So is this a good practice? To use Guid as my ID generator?
        >
        > thanks,
        >
        > /m
        >[color=green]
        > >
        > > HTH,
        > >
        > >
        > > --
        > > Greg Low (MVP)
        > > MSDE Manager SQL Tools
        > > www.whitebearconsulting.com
        > >
        > > "muscha" <muscha@no.spam .net> wrote in message
        > > news:O$VdeKjjDH A.2512@TK2MSFTN GP09.phx.gbl...[color=darkred]
        > > > Hi,
        > > >
        > > > I'm trying to decide whether I should use Guid.NewGuid() to generate an[/color][/color]
        > ID[color=green][color=darkred]
        > > > or using database sequence. Is Guid.NewGuid() will return a unique[/color][/color]
        > number?[color=green][color=darkred]
        > > > The MSDN said that the probability of duplication is low, but how low?[/color]
        > > Does[color=darkred]
        > > > anyone know?
        > > >
        > > > thanks,
        > > >
        > > > /m
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • muscha

          #5
          Re: Using guid or database sequence?

          "Robert Jeppesen" <robert.jeppese n(#)durius.se> wrote in message
          news:uLsay8jjDH A.1284@TK2MSFTN GP09.phx.gbl...[color=blue]
          > I believe that duplications are not even possible, as long as you have a[/color]
          network card on the computer.[color=blue]
          > From what I understand, Guid's are generated based on the network card mac[/color]
          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[color=blue]
          >
          >
          > --------------
          > Robert Jeppesen
          > robert.jeppesen %at%durius-dot-se
          >
          > "muscha" <muscha@no.spam .net> wrote in message[/color]
          news:O1mgy2jjDH A.2200@TK2MSFTN GP12.phx.gbl...[color=blue][color=green][color=darkred]
          > > > Unbelievably low - in fact low enough to basically be ignored. It is[/color][/color][/color]
          hard[color=blue][color=green]
          > > to[color=darkred]
          > > > comprehend how large 128 bit integers actually are.[/color]
          > >
          > > So is this a good practice? To use Guid as my ID generator?
          > >
          > > thanks,
          > >
          > > /m
          > >[color=darkred]
          > > >
          > > > HTH,
          > > >
          > > >
          > > > --
          > > > Greg Low (MVP)
          > > > MSDE Manager SQL Tools
          > > > www.whitebearconsulting.com
          > > >
          > > > "muscha" <muscha@no.spam .net> wrote in message
          > > > news:O$VdeKjjDH A.2512@TK2MSFTN GP09.phx.gbl...
          > > > > Hi,
          > > > >
          > > > > I'm trying to decide whether I should use Guid.NewGuid() to generate[/color][/color][/color]
          an[color=blue][color=green]
          > > ID[color=darkred]
          > > > > or using database sequence. Is Guid.NewGuid() will return a unique[/color]
          > > number?[color=darkred]
          > > > > The MSDN said that the probability of duplication is low, but how[/color][/color][/color]
          low?[color=blue][color=green][color=darkred]
          > > > Does
          > > > > anyone know?
          > > > >
          > > > > thanks,
          > > > >
          > > > > /m
          > > > >
          > > > >
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Womble One

            #6
            Re: Using guid or database sequence?

            Globally Unique IDentifier says it all to me. Use GUIDs.

            "muscha" <muscha@no.spam .net> wrote in message
            news:eL7cqPujDH A.3688@TK2MSFTN GP11.phx.gbl...[color=blue]
            > "Robert Jeppesen" <robert.jeppese n(#)durius.se> wrote in message
            > news:uLsay8jjDH A.1284@TK2MSFTN GP09.phx.gbl...[color=green]
            > > I believe that duplications are not even possible, as long as you have a[/color]
            > network card on the computer.[color=green]
            > > From what I understand, Guid's are generated based on the network card[/color][/color]
            mac[color=blue]
            > 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[color=green]
            > >
            > >
            > > --------------
            > > Robert Jeppesen
            > > robert.jeppesen %at%durius-dot-se
            > >
            > > "muscha" <muscha@no.spam .net> wrote in message[/color]
            > news:O1mgy2jjDH A.2200@TK2MSFTN GP12.phx.gbl...[color=green][color=darkred]
            > > > > Unbelievably low - in fact low enough to basically be ignored. It is[/color][/color]
            > hard[color=green][color=darkred]
            > > > 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" <muscha@no.spam .net> wrote in message
            > > > > news:O$VdeKjjDH A.2512@TK2MSFTN GP09.phx.gbl...
            > > > > > Hi,
            > > > > >
            > > > > > I'm trying to decide whether I should use Guid.NewGuid() to[/color][/color][/color]
            generate[color=blue]
            > an[color=green][color=darkred]
            > > > 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[/color][/color]
            > low?[color=green][color=darkred]
            > > > > Does
            > > > > > anyone know?
            > > > > >
            > > > > > thanks,
            > > > > >
            > > > > > /m
            > > > > >
            > > > > >
            > > > >
            > > > >
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            Working...