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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:06:09+00:00 2026-06-13T05:06:09+00:00

I have the following Post model: create_table posts, :force => true do |t| t.string

  • 0

I have the following Post model:

 create_table "posts", :force => true do |t|
    t.string   "title"
    t.string   "content"
    t.integer  "user_id"
    t.datetime "created_at",                               :null => false
    t.datetime "updated_at",                               :null => false
    t.integer  "comments_count",        :default => 0,     :null => false
    t.string   "image_file_name"
    t.string   "image_content_type"
    t.integer  "image_file_size"
    t.datetime "image_updated_at"
    t.boolean  "published",             :default => false
    t.datetime "published_at"
    t.boolean  "draft",                 :default => false
    t.string   "document_file_name"
    t.string   "document_content_type"
    t.integer  "document_file_size"
    t.datetime "document_updated_at"
  end

  add_index "posts", ["user_id", "created_at"], :name => "index_posts_on_user_id_and_created_at"

I only have 2 indexes so far.

I’m still not quite sure which columns to index to improve performance, so I would like to hear some suggestions.

(Sorry, I’m new to indexing so I was wondering if this: ["user_id", "created_at"] is creating a relation between these two indexes? (or there is no relation between indexes?) Or it looks like that because they were created in the same Rails migration?”)

  • 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-13T05:06:10+00:00Added an answer on June 13, 2026 at 5:06 am

    You should worry about indexing columns when you know that you are going to be doing SQL lookups on that column often. Without seeing the rest of your application code, it’s hard to determine which columns you should index, but I’d say that you’ve chosen two good ones.

    Below is a good post that helped me understand about indexes, it’s got some old Rails syntax in there, but what’s relevant are the points it makes about when to index a column.

    http://tomafro.net/2009/08/using-indexes-in-rails-choosing-additional-indexes

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

Sidebar

Related Questions

I have a Post model: class Post < ActiveRecord::Base attr_accessible :title, :content, :tag_names belongs_to
I have the following POST request: POST http://blah/Request HTTP/1.1 Host: blah Content-Length: 322 Proxy-Connection:
I have the following models: Post.rb class Post < ActiveRecord::Base belongs_to :category has_many :attachments,
I have the following Node.js directory structure. |--app/ |--app.js |--routers/ |--index.js/ |--models/ |--schemas.js |--post.js
I have been following the following post on using multiple ItemTemplates in a ListView
Using the ASP.NET Web-Api, I have the following POST setup in my controller. When
I have the following relationship: Post hasMany Comment Post belongsTo Category Post HABTM Tag
I have the following code: // // POST: /PlayRoundHole/Create [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(FormCollection collection)
i have the following javascript to post a form through ajax without refreshing the
I have the following data: A post called Hello has categories greet Another post

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.