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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:49:48+00:00 2026-05-11T16:49:48+00:00

In my Rails App I’ve several models dealing with assets (attachments, pictures, logos etc.).

  • 0

In my Rails App I’ve several models dealing with assets (attachments, pictures, logos etc.). I’m using attachment_fu and so far I have 3 different tables for storing the information in my MySQL DB.

I’m wondering if it makes a difference in the performance if I used STI and put all the information in just 1 table, using a type column and having different, inherited classes. It would be more DRY and easier to maintain, because all share many attributes and characteristics.

But what’s faster? Many tables and less rows per table or just one table with many rows? Or is there no difference at all? I’ll have to deal with a lot of information and many queries per second.

Thanks for your opinion!

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

    Many tables and fewer rows is probably faster.

    That’s not why you should do it, though: your database ought to model your Problem Domain. One table is a poor model of many entity types. So you’ll end up writing lots and lots of code to find the subset of that table that represents the entity type you’re currently concerned with.

    Regular, accepted, clean database and front-end client code won’t work, because of your one-table-that-is-all-things-and-no-thing-at-all.

    It’s slower, more fragile, will multiply your code all over you app, and makes a poor model.

    Do this only if all the things have exactly the same attributes and the same (or possibly Liskov substitutable) semantic meaning in your problem domain.

    Otherwise, just don’t even try to do this.

    Or if you do, ask why this is any better than having one big Map/hash table/associative array to hold all entities in your app (and lots of functions, most of them duplicared, cut and paste, and out of date, doing switch cases or RTTI to figure out the real type of each entity).

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

Sidebar

Related Questions

Simple rails app: I have 2 models, user and intro [which is simply a
My Rails app is getting the history of changes for two models, using the
My rails app has Podcast and Track models. Podcasts have many Tracks, Tracks belong
My rails app is set up using a mysql database. When I do a
I have a Rails app running Mongoid on Heroku and I need to set
I have a Rails app with the usual application_controller, and a controller (and model)
So I have a rails app with a url field for embedding youtube and
I am creating a rails app. And i have login in such a way
I have a rails app where i have a Contact model and with an
I am building a rails app that has a number of models, one of

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.