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

  • SEARCH
  • Home
  • 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 958579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:53:25+00:00 2026-05-16T00:53:25+00:00

Here’s a simplified example. UserDetails (UserID INT UserGUID UNIQUEIDENTIFIER Name VARCHAR(50) Age INT) UserRatings

  • 0

Here’s a simplified example.

UserDetails (UserID INT UserGUID UNIQUEIDENTIFIER Name VARCHAR(50) Age INT)
UserRatings (UserID INT Rating INT Date DATETIME)
UserVotes   (UserID INT Votes INT Date DATETIME)

The UserGUID only exists in the main table.

In the application layer only GUID’s are parsed around, never INTS. This is to prevent competitors from guessing at some key numbers on my site like (e.g. user count).

In the SPROCS relating to tables UserRatings and UserVotes, I have to DECLARE UserID and SET it based on the UserGUID that is getting parsed back at the start of every procedure.

This occurs not just for the Users table but for every other object that has a main table and branched tables so there are tons of these DECLARE/SET type procedures all over the place.

Is this a good design?

  • 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-16T00:53:26+00:00Added an answer on May 16, 2026 at 12:53 am

    The UserGUID only exists in the main
    table. In the application layer only
    GUID’s are parsed around, never INTS.
    This is to prevent competitors from
    guessing at some key numbers on my
    site like (e.g. user count).

    Seems quite reasonable to me.

    In the SPROCS relating to tables
    UserRatings and UserVotes, I have to
    DECLARE UserID and SET it based on the
    UserGUID that is getting parsed back
    at the start of every procedure.

    You could also define a view spanning UserDetails+UserRatings, as well as UserDetails+UserVotes (or even all three tables at once), which include the GUID from the UserDetails table. This would make querying the tables easier and you wouldn’t have to first extract the ID from the GUID and use that to query the table in question.

    Update: if you e.g. need to query UserRatings frequently, you could create a view like this:

    CREATE VIEW dbo.UserRatingsWithDetails
    AS 
        SELECT 
           ud.UserGuid, ud.Name, ud.Age,
           ur.UserID, ur.Rating, ur.Date
        FROM
           dbo.UserDetails ud
        INNER JOIN
           dbo.UserRatings ur ON ur.UserID = ud.UserID
    

    and then you can select from that view without running a separate SELECT first:

    SELECT UserID, Name, Rating, Date
      FROM dbo.UserRatingsWithDetails
     WHERE UserGuid = @SomeGuidValue
    

    With the right indices (on the foreign key field in UserRatings), this is a very highly performant JOIN – no worries here!

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

Sidebar

Related Questions

Here's an example query: DECLARE @table table (loc varchar(10)) INSERT INTO @table VALUES ('134a'),
Here is an example. foreach (var doc in documents) { var processor = this.factory.Create();
Here is an example: I write html code inside of textarea, then I swap
here is my configuration: http://domain.com (obviously fictitious name...) hosted on a server running Apache
Here is an example: I have the generic type called Account. I wish to
Here an example of my checkbox list http://jsfiddle.net/YnM2f/ Let's say I check on G
Here is my simplified data structure: Object1.h template <class T> class Object1 { private:
Here is a snippet of my xaml: <ComboBox x:Name=cbo1 Width=100 SelectedValue=200> <ComboBoxItem Name=n1>100</ComboBoxItem> <ComboBoxItem
Here is an example: I have a file 1.js, which has some functions. I
Here an example http://jsfiddle.net/EhLsT/ $(window).scroll(function () { if ($(window).scrollTop() > $(#header).offset().top) { $(#floating).show(); }

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.