Skip to content

Instantly share code, notes, and snippets.

@ch1ago
Created January 2, 2011 20:08
Show Gist options
  • Save ch1ago/762774 to your computer and use it in GitHub Desktop.
Save ch1ago/762774 to your computer and use it in GitHub Desktop.
this is my code
Post.select(:id, :user_id, :title).limit(30).includes(:user)
resuls in this sql
Post Load (9.0ms) SELECT "posts".id, "posts".user_id, "posts".title FROM "posts" LIMIT 30
User Load (720.6ms) SELECT "users".* FROM "users" WHERE ("users"."id" IN (5,6,4,1,8,56,83,24,68,2,45,21))
but querying for "users".* is taking too long
is there a way I can select less fields in the includes too?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment