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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:49:07+00:00 2026-06-11T16:49:07+00:00

I am in the process of creating a second version of my technical wiki

  • 0

I am in the process of creating a second version of my technical wiki site and one of the things I want to improve is the database design. The problem (or so I think) is that to display each document, I need to join upwards of 15 tables. I have a bunch of lookup tables that contain descriptive data associated with each wiki entry such as programmer used, cpu, tags, peripherals, PCB layout software, difficulty level, etc.

Here is an example of the layout:

    doc
--------------
id   | author_id   |    doc_type_id      .....
1    | 8           |        1
2    | 11          |        3
3    | 13          |        3

_

    lookup_programmer
--------------
doc_id   | programmer_id     
1        | 1                    
1        | 3                     
2        | 2                   

_

     programmer
--------------
programmer_id   | programmer      
1               | USBtinyISP        
2               | PICkit              
3               | .....              

Since some doc IDs may have multiples entries for a single attribute (such as programmer), I have created the DB to compensate for this. The other 10 attributes have a similiar layout as the 2 programmer tables above. To display a single document article, approx 20 tables are joined.

I used the Sphinx Search engine for finding articles with certain characteristics. Essentially Sphinx indexes all of the data (does not store) and returns the wiki doc ID of interest based on the filters presented. If I want to find articles that use a certain programmer and then sort by date, MYSQL has to first join ALL documents with the 2 programmer tables, then filter, and finally sort the remaining by insert time. No index can help me ordering the filtered results (takes a LONG time with 150k doc IDs) since it is done in a temporary table. As you can imagine, it gets worse really quickly with the more parameters that need to be filtered.

It is because I have to rely on Sphinx to return – say all wiki entries that use a certain CPU AND programer – that lead me to believe that there is a DB smell with my current setup….

edit: Looks like I have implemented a [Entity–attribute–value model]1

  • 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-11T16:49:08+00:00Added an answer on June 11, 2026 at 4:49 pm

    I don’t see anything here that suggests you’ve implemented EAV. Instead, it looks like you’ve assigned every row in every table an ID number. That’s a guaranteed way to increase the number of joins, and it has nothing to do with normalization. (There is no “I’ve now added an id number” normal form.)

    Pick one lookup table. (I’ll use “programmer” in my example.) Don’t build it like this.

    create table programmer (
      programmer_id integer primary key,
      programmer varchar(20) not null,
      primary key (programmer_id),
      unique key (programmer)
    );
    

    Instead, build it like this.

    create table programmer (
      programmer varchar(20) not null,
      primary key (programmer)
    );
    

    And in the tables that reference it, consider cascading updates and deletes.

    create table lookup_programmer (
      doc_id integer not null,
      programmer varchar(20) not null,
      primary key (doc_id, programmer),
      foreign key (doc_id) references doc (id) 
        on delete cascade,
      foreign key (programmer) references programmer (programmer)
        on update cascade on delete cascade
    );
    

    What have you gained? You keep all the data integrity that foreign key references give you, your rows are more readable, and you’ve eliminated a join. Build all your “lookup” tables that way, and you eliminate one join per lookup table. (And unless you have many millions of rows, you’re probably not likely to see any degradation in performance.)

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

Sidebar

Related Questions

I am in the process of creating an app, and one of the pieces
I am in the process of creating a site that i would like to
) I'm in a process of creating a memory game. My problem is that
I am in process of creating a software for dumping plain text of whatever
Suppose that a process is creating a mutex in shared memory and locking it
I am in the process of creating an iPhone app that requires to interact
I'm in the process of creating a coverflow view for android, but I'm running
I'm in the process of creating a metasearch engine and I'm stuck! Using php
I'm in the process of creating a web service that uses XML to handle
I'm in the process of creating a double-linked list, and have overloaded the operator=

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.