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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:06:27+00:00 2026-05-22T15:06:27+00:00

For a table with 100% reading (no writing), which structure is better and why?

  • 0

For a table with 100% reading (no writing), which structure is better and why?

[My table has many columns, but I’ve made an example here with 4 columns for simplicity]

Option 1: One table with multiple columns

ID | Length   | Width    | Height
-----------------------------------------
1  | 10       | 20       | 30
2  | 100      | 200      | 300

Option 2: Two tables; one storing column headers, and other storing values

Table 1:

ID | Object_ID | Attribute_ID | Attribute_Value
------------------------------------------
1  | 1         | 1            | 10
2  | 1         | 2            | 20
3  | 1         | 3            | 30
4  | 2         | 1            | 100
5  | 2         | 2            | 200
6  | 2         | 3            | 300

Table 2:

ID | Name
-------------------
1  | Length
2  | Width
3  | Height
  • 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-22T15:06:28+00:00Added an answer on May 22, 2026 at 3:06 pm

    I will preface this by saying that I’m a relative novice to SQL and database tables; that, however, doesn’t mean that I don’t know my basics.

    Unless your example is heavily oversimplified, you really should use the first example. Not only will it be faster and easier to query, but it simply makes more sense.

    In this example, you don’t need to split your tables at all; your ‘Attribute IDs’ are adequately represented by the table headers. Further, these values have no real meaning by themselves, so they really don’t need to be in another table.

    You would generally break out a new table and reference it as you have if you had another object, existing separately, relating to your object with a one-to-many relationship.

    Here’s an example (actually from my database on an O’Reilly server) using blog entries and comments on blog entries:

    mysql> select * from blog_entries;
    +----+--------------+-------------+---------------------+
    | id | poster       | post        | timestamp           |
    +----+--------------+-------------+---------------------+
    |  1 | lunchmeat317 | blah blah   | 0000-00-00 00:00:00 |
    |  2 | Yongho Shin  | yadda yadda | 0000-00-00 00:00:00 |
    +----+--------------+-------------+---------------------+
    2 rows in set (0.00 sec)
    
    mysql> select id, blog_id, poster, post, timestamp from blog_comments;
    +----+---------+--------------+----------------+---------------------+
    | id | blog_id | poster       | post           | timestamp           |
    +----+---------+--------------+----------------+---------------------+
    |  1 |       1 | lunchmeat317 | humina humina  | 0000-00-00 00:00:00 |
    |  2 |       1 | Joe Blow     | huh?           | 0000-00-00 00:00:00 |
    |  3 |       2 | lunchmeat317 | yakk yakk yakk | 0000-00-00 00:00:00 |
    |  4 |       2 | Yongho Shin  | lol            | 0000-00-00 00:00:00 |
    +----+---------+--------------+----------------+---------------------+
    4 rows in set (0.00 sec)
    
    mysql>
    

    Think about it from a logical perspective; there’s no reason to artificially inject complexity into this design when it doesn’t need to be there. In your example, length, width, and height aren’t really separate objects, and they’re all related to the dimensions of the object you’re describing in the table row. Further, length width and height only have one value at a given time.

    I hope that made some sense – if I was a bit pedantic in my pedagogy, I apologize. However, if someone else stumbles on this question, hopefully this example will help them.

    Good luck.

    Edit: I just realized that your question was specifically about performance. That’s a little more in-depth, perhaps based on the db engine that you use? Generally, though, I would imagine that querying a table without doing any joins would be slightly faster, considering that denormalization is a commonly-cited method of improving performance.

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

Sidebar

Related Questions

We've a table with a varchar2(100) column, that occasionally contains carriage-return & line-feeds. We
I have a table like this (Oracle, 10) Account Bookdate Amount 1 20080101 100
table data of 2 columns category and subcategory i want to get a collection
My table structure looks like this: tbl.users tbl.issues +--------+-----------+ +---------+------------+-----------+ | userid | real_name
Warning I'm brand new to rails! While reading through a tutorial it has asked
I have a huge database with some 100 tables and some 250 stored procedures.
I have a huge database with 100's of tables and stored procedures. Using SQL
Table: UserId, Value, Date. I want to get the UserId, Value for the max(Date)
The table doesn't have a last updated field and I need to know when
A table row is generated using an asp:Repeater: <asp:repeater ID=announcementsRepeater OnItemDataBound=announcementsRepeater_ItemDataBound runat=Server> <itemtemplate> <tr

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.