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

The Archive Base Latest Questions

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

In a Rails controller action I call @grid = Grid.find(params[:id], :include => [:grid_properties, :grid_entities

  • 0

In a Rails controller action I call

@grid = Grid.find(params[:id], :include => [:grid_properties, :grid_entities => [:entity => :properties]])

Unfortunately it takes really long. Benchmark.realtime (in development mode) tells me 1.8812830448150635, so about 2 seconds (Rails 3.0.7, Postgres 8.4).

When turning on the SQL logging I get the following for this line of code:

Grid Load (0.9ms)  SELECT "grids".* FROM "grids" WHERE "grids"."id" = 2 LIMIT 1
GridProperty Load (2.5ms)  SELECT "grid_properties".* FROM "grid_properties" WHERE ("grid_properties".grid_id = 2) ORDER BY row_order
GridEntity Load (1.3ms)  SELECT "grid_entities".* FROM "grid_entities" WHERE ("grid_entities".grid_id = 2) ORDER BY row_order
Entity Load (3.0ms)  SELECT "entities".* FROM "entities" WHERE ("entities"."id" IN (28,7,3,6,25,11,2,12))
Property Load (6.4ms)  SELECT "properties".* FROM "properties" WHERE ("properties".entity_id IN (28,7,3,6,25,11,2,12))

Every database access seems to be in the low millisecond range. Why does it take so long in the end?

  • 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-22T12:49:12+00:00Added an answer on May 22, 2026 at 12:49 pm

    I guess that the time is spent on creating the object by Ruby. How many Properties are in that Grid? The time of ‘SELECT FROM properties’ looks relatively high.

    You could further investigate the problem, if you have some functions where you could place checkpoints – logger.debug "CHECKPOINT: #{Time.now} #{caller(0).first}"

    Do you have any ‘on_load’ callbacks, maybe?

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

Sidebar

Related Questions

In a Rails app sometimes you use a redirect in an action... redirect_to :controller
Using Rails v2.1, lets say you have an action for a controller that is
I have a Rails application that unfortunately after a request to a controller, has
In my Rails controller I want to branch to a different controller's action, show
I'd like to trigger an action from my rails controller when the user leaves
In a Rails controller I'm calling this: redirect_to :controller => user, :action => login
I have a rails route set up like: match ':controller/:id/:action' # match 'teams/:id' =>
In my Rails controller, I'm creating multiple instances of the same model class. I
I need to be able to quickly convert an image (inside a rails controller)
I came across a controller in an older set of code (Rails 1.2.3) that

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.