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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:14:15+00:00 2026-05-20T17:14:15+00:00

I wonder if any better practice or any principle when come to design a

  • 0

I wonder if any better practice or any principle when come to design a lookup table.

I intend to design an abstract lookup table which can serve many different situations.

For instance, I call my lookup table as a masters and slaves table,

CREATE TABLE IF NOT EXISTS `masters_slaves` (
  `mns_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `master_id` varchar(255) DEFAULT NULL COMMENT 'user id or page id',
  `slave_id` varchar(255) DEFAULT NULL COMMENT 'member id or user id or page id',
  `cat_id` varchar(255) DEFAULT NULL COMMENT 'category id',
  `mns_created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `mns_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`mns_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

so this lookup table can server the relationship of these types like,

Admins and Members
Admins and Pages
Admins and Posts
Post Categories and Posts
Page Parents and Pages
etc

the cat_id in masters and slaves table will describe and differentiate these categories. for instance, cat_id 1 is Admins and Members and so on.

And I will insert:

  1. admin id into the column of
    master_id and member id into
    slave_id column
  2. parent page id into the column of
    master_id and child page id into
    slave_id column
  3. post categories id into the column
    of master_id and page id into
    slave_id column
  4. etc

But I am sure about it whether I should go for it or not:

  1. Is this a good lookup
    table practice or should do many create more
    than one lookup tables for different
    relationships?
  2. If I can do the lookup table like
    this, which is only one lookup table
    for all, what consequences I will
    have in the future? Will this sole
    lookup table will be over populated
    when my site content grows?
  3. Another thing come to mind is that –
    isn’t the tag system a lookup table
    solution too?

Thanks.

  • 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-20T17:14:16+00:00Added an answer on May 20, 2026 at 5:14 pm

    From my experience it is better to create a lookup table for each category.
    Here are the benefits as i see them:

    1. One lookup table might became very large, while a few smaller lookup tables may be loaded by the caching mechanism of the mysql into memory and be handled only from there if you are accessing a special category.
    2. It is easier to load / reload / backup etc’ a few smaller tables.
    3. You can later on change the table schema, let’s say you wish to add another field only for one type of category. You will not need to add it to all the rows in this global table.

    I think there are more pros for having a few smaller tables than one big one.

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

Sidebar

Related Questions

hey there i wonder if any of you have come across a similar issue?
i'm using spring+tapestry for authenticate webuser. I wonder is there any technique i can
I wonder if there's any tool/website where I can plot some run times as
I wonder if anyone can think of a good technique to enable any arbitrary
I sometimes wonder how to handle construction of objects which can throw in their
I wonder if there is any practice when designing a forum. I want to
I wonder if there any better ideas to solve the problem below, I have
I wonder does it make any differences? If its declared in our m file,
I wonder if there are any game engine written in Scala or easily accesible
I wonder if there's any way to do a while loop in django (I

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.