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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:37:08+00:00 2026-05-22T16:37:08+00:00

I have been building rails apps for a while now, but unfortunately for me,

  • 0

I have been building rails apps for a while now, but unfortunately for me, none of my apps have had a large amount of data or traffic. But now I have one that is gaining steam. So I am diving in head first into scaling and optimizing my app.

It seems the first and easiest step to do this is with database indexes. I’ve got a good huge list of indexes that should cover pretty much all of my queries, but when I added them to my database via migrations it only took a few seconds to add them. For some reason I thought they would have to go through all of my entries (of which there are thousands) and index them.

Does this mean my indexes haven’t been applied to my already existing data? Will they only be added to new entries?

Additionally, I am looking into other scaling solutions, such as memcached, and all around slimming down my queries, etc.

If anyone can point me to some good resources for optimizing my rails 3 app I would greatly appreciate it!

Thanks!

EDIT:

Thanks for all the great answers regarding database indexes! What else should I be looking at in terms of optimizing and scaling my app? Memcached? What has the best performance boost/effort ratio in terms of optimization?

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

    It is always a good idea to add index’s to your all ID’s and data you ‘find_by’ on more then a few occasions e.g. email_address. Likewise you can safely assume that ID will never go into negative, so making ID columns Unsigned will benefit in the long run. Speak to any DBA (Database Administrator) and they will, more times than not tell you to do this.

    Currently you most likely have something like this for all your ID Columns…

    t.integer :column_name, :null => false
    

    or…

    t.references :column_name, :null => false
    

    By simply changing this to…

    t.column :column_name, 'integer unsigned', :null => false
    

    You will see a tiny increase.

    Index’s are simple…

    add_index :reviews, [:column_id, :column_type] # Polymorphic
    add_index :reviews, :column_id # Standard
    

    The Rails API should give you all you need to know.

    Peepcode have a really get tutorial video that was a great insight to me and well worth the $12 and 37 minutes of your time. There are Gems like MetaWhere which may be able to help you as well.

    Most importantly, in Rails 3 and above, is ActiveRelations. This is where Queries are only executed when required. For example instead off User.all you could call User.scoped and when the iteration in the View occurs the SQL in executed. Powerful stuff and the Future of Rails.

    Let us know how you get on… All the best.

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

Sidebar

Related Questions

I have been building this app for a while now and have not had
I have been building a game for a while (nearly done) - But the
Hi Im new to Ruby On Rails, but have experience building iPhone apps. So
I have been building IMO a really cool RIA. But its now close to
I've been following a lot of good tutorials on building rails apps but I
I have been building a large scale rails app and it has come time
I have been involved in building a custum QGIS application in which live data
I'm exploring package building on Windows 7 but have been running into trouble after
I'm building a forum for my friends to use, but since we have been
I'm a PHP dev and I'm new to Rails but have been getting on

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.