Forum: Ruby on Rails Help Query Cache

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Marcelo G. Silva (Guest)
on 2012-05-08 20:23
(Received via mailing list)
Well folks let me try to explain my problem.
I have a database of musics and each music can have multiple
artists through other table/model in the case Performers.
I would like to record music in new/edit add
artists and select them via a combo-box, used a
simple collection_select, and used to add a new one a UJS
 i see on Railscasts.
In the testing phase with few records everything was fine, but I have
a legacy database table where the artists have 62k records.
Well .. sure takes 18s to execute the query and render the
page. and if I try to add a new artist with javascript
app dies.
I tried to use fragment caching to the select this did not work.
I also tried using memcached, it is limited to 1M, and my
query takes 5M, removed this limit and yet the system continues
crashing when I add the javascript.
my knowledge (almost none) to prevent me from creating javascript
Another method of adding artists.
I do not know if there is a way to improve performance through caching
whether it is design problem.
The environment is: Ruby 1.9.3, Rails 2.3.3, MySQL 5.5
if someone could understand my problem and it is with great humor can
look at this code snippet
Since already thank you very much.
Jeremy Walker (Guest)
on 2012-05-08 20:28
(Received via mailing list)
On 8 May 2012 19:22, Marcelo G. Silva <> wrote:

> page. and if I try to add a new artist with javascript
> app dies.

Unless I'm missing something you have a line
<%= f.collection_select :artist_id, Artist.find_ordened_artists, :id,
,:prompt => 'Selecionar Artista' %>

that is rendering all 62,000 records...

That's just not going to work. Not only will it likely overload
it's also unusable for a user to browse through.

You'll want to look at doing an AJAX autocomplete box or similar.
Marcelo G. Silva (Guest)
on 2012-05-08 20:35
(Received via mailing list)
was thinking about it now, thank you for help.
This topic is locked and can not be replied to.