Forum: Ruby on Rails Help Query Cache

12b26b3488ef96319d4382c7355b4c67?d=identicon&s=25 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
or
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
https://gist.github.com/2637961
Since already thank you very much.
955103d80e386882143a78875fb727bf?d=identicon&s=25 Jeremy Walker (Guest)
on 2012-05-08 20:28
(Received via mailing list)
On 8 May 2012 19:22, Marcelo G. Silva <mgswolf@gmail.com> 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,
:name
,:prompt => 'Selecionar Artista' %>

that is rendering all 62,000 records...

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

You'll want to look at doing an AJAX autocomplete box or similar.
12b26b3488ef96319d4382c7355b4c67?d=identicon&s=25 Marcelo G. Silva (Guest)
on 2012-05-08 20:35
(Received via mailing list)
was thinking about it now, thank you for help.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.