Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 792261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:57:52+00:00 2026-05-14T21:57:52+00:00

For a database I’m building, I’ve decided to use natural numbers as the primary

  • 0

For a database I’m building, I’ve decided to use natural numbers as the primary key. I’m aware of the advantages that GUID’s allow, but looking at the data, the bulk of row’s data were GUID keys.

I want to generate XML records from the database data, and one problem with natural numbers is that I don’t want to expose my database key’s to the outside world, and allow users to guess “keys.” I believe GUID’s solve this problem.

So, I think the solution is to generate a sparse, unique iD derived from the natural ID (hopefully it would be 2-way), or just add an extra column in the database and store a guid (or some other multibyte id)

The derived value is nicer because there is no storage penalty, but it would be easier to reverse and guess compared to a GUID.

I’m (buy) curious as to what others on SO have done, and what insights they have.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:57:53+00:00Added an answer on May 14, 2026 at 9:57 pm

    What you can do to compute a “GUID” is to calculate a MD5 hash of the ID with some salt (table name for instance), load this into a GUID and set a few bits so that it is a valid version 3 (MD5) GUID.

    This is almost 2-way since you can have a SQL computed column (which can also be indexed in certain cases) holding the GUID without persisting it in the table, and you can always re-compute a GUID with the correct ID and salt, which should be harder for users since they don’t know the salt nor the actual ID.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A database application that I'm currently working on, stores all sorts of settings in
What database should a beginner use in the C language? Can I use MySQL?
The Database Tuning Advisor is recommending that I create a bunch of statistics in
Many database systems don't allow comments or descriptions of tables and fields, so how
This database will store a list of children. But the problem is, they will
Database? Page variables? Enum? I'm looking for opinions here.
Which Database table Schema is more efficient and why? Users (UserID, UserName, CompamyId) Companies
My database contains three tables called Object_Table , Data_Table and Link_Table . The link
The database type is PostGres 8.3. If I wrote: SELECT field1, field2, field3, count(*)
Our database server is a SQL 2008 server. My colleagues all have XP service

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.