Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Article Writing
  4. High Low Guid instead of @@IDENTITY

High Low Guid instead of @@IDENTITY

Scheduled Pinned Locked Moved Article Writing
databasec++question
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Steven Campbell
    wrote on last edited by
    #1

    Would anyone be interested in an article demonstrating a component that does High-Low identifiers as an alternative to Identity columns in SQL? For those not familiar, the idea is that you assign a unique id to a row of data before it is ever saved (in code). This has several benefits, like (off the top of my head, I'm sure there are more): * Row Ids are unique, even across tables * Replication is greatly simplified * Inserts are fast (because we don't need a select query to get back the @@IDENTITY) * SELECTs are also fast, since recent SQL databases have native support for Guids. The High-Low term refers to the specific technique used to do this in a way that guarantees uniqueness.

    M 1 Reply Last reply
    0
    • S Steven Campbell

      Would anyone be interested in an article demonstrating a component that does High-Low identifiers as an alternative to Identity columns in SQL? For those not familiar, the idea is that you assign a unique id to a row of data before it is ever saved (in code). This has several benefits, like (off the top of my head, I'm sure there are more): * Row Ids are unique, even across tables * Replication is greatly simplified * Inserts are fast (because we don't need a select query to get back the @@IDENTITY) * SELECTs are also fast, since recent SQL databases have native support for Guids. The High-Low term refers to the specific technique used to do this in a way that guarantees uniqueness.

      M Offline
      M Offline
      Michael Potter
      wrote on last edited by
      #2

      I have used this method many times in the past. It has only one draw back. GUID's are not inherently sortable on SQL. This can hurt paging schemes (i.e. Give me the first 10 then the next 10) and random picking (i.e. random drug testing). Solving these issues is more informative then simply choosing a GUID for your primary key. By the way, joins & indexes are a little slower with GUIDs then with INTs. Nothing measurable until you get into large tables but, they are slower.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups