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 8950249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:24:45+00:00 2026-06-15T13:24:45+00:00

I need some best-practice and performance advice. Let’s say I have three tables: Employees,

  • 0

I need some best-practice and performance advice.

Let’s say I have three tables: Employees, Jobs and Ranks.
Every employee has a job and a rank, so obviously I should reference those tables in my Employees table.

My question is, which of these options is best:

1) Each job and rank are stored with a unique ID paired a descriptive name. The Employees table should reference the unique ID in the other table, thus saving memory (the descriptive name is only saved once in the Jobs/Ranks table), but to see the descriptive names I’ll need to do JOINs:

SELECT Employees.EMPL_ID, Ranks.R_NAME, Jobs.J_NAME
FROM Jobs
JOIN Ranks ON Ranks.R_ID=Employees.RANK
JOIN Jobs ON Jobs.J_ID=Employees.JOB

2) Just unique descriptive names. It can be a waste of memory, because i repeatedly save the descriptive name of each rank / job, but I save time on my SELECT statements

<EDIT:>

Just to clarify, my main concern is the performance I’ll have to deal with if I’ll need to perform SELECTs with multiple JOINs instead of one SELECT statement.

I want to be able to deal with lots of traffic – specifically, Employees requests to see their Job and Rank.

<EDIT>

Examples:

Option 1 (IDs and names):

Employees:
 __________________________
/ EMPL_ID  |  RANK  | JOB  \
|    1     |    2   |  3   |
|    1     |    1   |  3   |
|    1     |    1   |  1   |
\__________|________|______/

Ranks:
 __________________
/  R_ID  |  R_NAME \
|    1   |   GRUNT |
|    2   |   BOSS  |
\________|_________/

Jobs:
 ____________________
/  J_ID  |  J_NAME   \
|   1    | JANITOR   |
|   3    | PRESIDENT |
\________|___________/

Option 2 (unique names):

Employees:
 _______________________________
/ EMPL_ID  |  RANK  | JOB       \
|    1     |  BOSS  | PRESIDENT |
|    1     |  GRUNT | PRESIDENT |
|    1     |  GRUNT | JANITOR   |
\__________|________|___________/

Ranks:
 __________
/   R_NAME \
|    GRUNT |
|    BOSS  |
\__________/

Jobs:
 ___________
/  J_NAME   \
| JANITOR   |
| PRESIDENT |
\___________/
  • 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-06-15T13:24:47+00:00Added an answer on June 15, 2026 at 1:24 pm

    Yes always give each row a unique id.

    Best Practice it to always have this for each table.
    Usually called ‘id’ or the-table-name_id’

    It should have no business value.

    Many ‘guaranteed unique’ records later find the need or presence or duplicate records and always having a unique primary key helps hugely when this is met / discovered.

    One example of ‘unique’… that isn’t…. if a system has people’s Social Security Numbers they should be unique. However one could be mistyped. Then when the person with the ‘mistyped’ value presents and their number is tied typed in… In allowing / resolving this is will be really helpful for all rows to have their own id that is not the ssn and has no business value at all other than identifying the row.

    Unique records is a very well known problem. Having a unique ID for all records is part of the solutions that address it.

    The exception to all of the above is performance. I am not too concerned about the join speed for a few thousand records as SQL databases are well designed for speed in doing that. I have found the advantage of unique identification out-weighs disadvantages. There may be cases where you change the above practice due to performance requirements. For instance if there are millions of records that have to be loaded into memory, the overhead of unique ID’s space may become an issue. Often if these cases though folks start to look at no-sql solutions like Redis, MongoDB, etc.

    Here are some additional references on SO and other sites:

    What's the best practice for primary keys in tables?

    in general, should every table in a database have an identity field to use as a PK?

    http://www.sql-server-performance.com/forum/threads/do-i-need-a-unique-identifier-or-identity-column.16910/

    is an ID column really needed in SQL?

    As well commented in one answer “use of natural vs. surrogate keys in kind of a religious debate in the community’. Also there’s a comment about how the answerer got their ‘rules’… tee-hee…

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

Sidebar

Related Questions

Need some best practice advice here... Navigation based application. Root view is a UITableView
I need some advice on what is the best practice to build an online
I need an advice on best practices for DRYing view code. I have three
I have some large MySQL production tables that I need to dump so that
This is an efficiency/best practice question. Hoping to receive some feed back on performance.
I need some advice please on the best way to achieve a particular outcome...
for a data warehouse project I need to know about some best practices regarding
I need some feedback on what is the best way to do what I
Need some regular expressions help. So far I have my code working to allow
Need some help... I have jasperserver 4.1 installed on my ubuntu. It runs via

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.