Frank Poo wrote: > The query is just an UPDATE with a COALESCE keyword in it. All it does > is increment counters: > > UPDATE `statistics_api` SET `count_request` = COALESCE(`count_request`, > ?) + ? WHERE (`id` = ?) > > This one took 8,553 ms according to New Relic. The weird part is that > there is an index on 'id' (as well as a few other columns) on this > table. I just can't figure out why the query's taking so long ...
8.5 seconds? For that?!? You might want to ask someone who knows more about mySQL configuration than I do, but clearly your DB setup has problems. If you run that query when your DB is not otherwise being hit by your app, how long does it take? BTW, what does the first placeholder represent? I'd assume it would always represent 0, in which case you can hard-code it. Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

