You may find it useful to use “tail” to monitor the file
development.logwhile you are developing - each SQL query that Rails
executes will show up
there. I believe (though you should double check this) that calling
comments.size when comments has not been loaded will do a single “select
count(*)…” query without instantiating a bunch of Comment objects.
You may find it useful to use “tail” to monitor the file
development.logwhile you are developing - each SQL query that Rails
executes will show up
there. I believe (though you should double check this) that calling
comments.size when comments has not been loaded will do a single “select
count(*)…” query without instantiating a bunch of Comment objects.
I thought that, when in development mode, Rails generates different SQL
(i.e. more SQL queries) than when in production mode.
In my applications, the logs seem to indicate that the “rendering”
part, and not the “database” part, is the bottleneck. Is ActiveRecord
work included in the database figure?
Another one: I’ve noticed that, if I have a couple thousand <%= … %>
on a page, it slows down considerably. Would it be worth a try to
build up strings of html using <% str += “more” %> and then <%= str %>?
end similar looking post calls,
Since the RESTful support uses
DELETE and PUT, i was wondering how to make ruby calls
like the above Net::HTTP of the kind DELETE and PUT?
When writing a Rails app, what common tasks can likely result in
performance issues?
I noticed in the Log folder that many SELECT statements had LIMIT 1 on
the end.
We all know that’s a no-no when you are architecting a database. It’s
mostly harmless when using it…
…however, I would have relied on assertions demanding that all select
statements that only need 1 row return will only get 1 row. Without
LIMIT 1. That would imply that the database is sufficiently normal, and
the SELECT statements are sufficiently constrained.
So, in general, the ideal might be to transfer limit-checking to the
tests, so the code can run faster without it, and with proper
constraints.
(The spectre of SQL data normalization and query optimization also
raises it’s ugly head. We might presume that the slowest DB operation
is still faster than the fastest Ruby page rendering cycle, no?
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.