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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:55:12+00:00 2026-06-13T03:55:12+00:00

I have a question regarding primary keys in Relational Databases. Let’s assume that I

  • 0

I have a question regarding primary keys in Relational Databases. Let’s assume that I have the following tables:

Box

  • id
  • box_name

BoxItems

  • id
  • item_name
  • belongs_to_box_id (foreign key)

Let’s also assume that I intend to store millions of items per day. I would probably use bigint or a guid for the BoxItems.Id.

What I was thinking, and I need your advice on that, is instead of Bigint Id for the BoxItems, use a sequencial TinyInt number and what identified each item is the combination of the belongs_to_box_id plus the tinyint row (e.g. item_numner).

So now instead of the above we get:

BoxItems

  • belongs_to_box_id
  • item_sequence_number [TINYINT]
  • item_name

Example:

Items.Insert(1,1, "my item 1");
Items.Insert(1,2, "my item 2");

So instead of using bigint or GUID for that matter, I can use tinyint and save a lot of disk space.

I want to know what the cons and pros of such approach. I am developing my app using MySQL and ASP.NET 4.5

  • 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-13T03:55:13+00:00Added an answer on June 13, 2026 at 3:55 am

    When you think about it, there’s really not much difference between the “box/contents” problem and the “order/line item” problem.

    create table boxes (
      box_id integer primary key,
      box_name varchar(35) not null
    );
    
    create table boxed_items (
      box_id integer not null references boxes (box_id),
      box_item_num tinyint not null,
      item_name varchar(35) not null
    );
    

    For MySQL, you’d probably use unsigned integer and unsigned tinyint. There’s no compelling reason for a database to avoid negative numbers, but developers should lean on the Principle of Least Surprise.

    Make sure 256 values are enough. Getting that wrong can be expensive to correct in a table that gets millions of rows each day.

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

Sidebar

Related Questions

I have a question regarding a race condition scenario. The question: Consider the following
I have a question regarding locking in TSQL. Suppose I have a the following
I have a question regarding a unified insert query against tables with different data
I have a quick question regarding a database that I am designing and making
I have a question regarding Foreign Keys in an InnoDB Table. I have 4
I have a general question regarding table indices on foreign keys in database modeling.
I have a quick question regarding candidate keys and superkeys. Say you have two
I have a question regarding the Bootstrap collapse feature. I'm pretty sure that I'm
I have question regarding the SQLAlchemy. How can I add into my mapped class
I have question regarding the use of function parameters. In the past I have

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.