SQL query taking too much time to run


(Sérgio Lopes) #1

We are migrating an old forum with 1.6 million messages to Discourse. When opening the home page as logged in user, there is a super query taking too long to execute (many seconds). We are still testing so there is only one user - me.

We are on AWS using RDS. On our default machine, it took more than 13s to return this query. I updated to a xlarge super machine for testing and still this query take more than 500ms.

Is this normal? Any advice?


(Jeff Atwood) #2

More than 500ms isn’t outside the realms of normal. Do you have unusual permissions on the categories? Have you tested with an anonymous or new user rather than a staff user?


(Sam Saffron) #3

This query has been rewritten, can you update to latest?


(Sérgio Lopes) #4

Thanks guys!
We did more tests here and it seems that as an annonymous user everything is ok. SQL take no more than 30ms.

But logging in both as an admin or as a normal user, the query take too long. Usually more than 1 second, and at least 500ms.

We are using Discourse 1.4.3 (latest stable?) at http://discourse.guj.com.br:3000 . @sam, do you recommend updating to 1.5.0-beta6?


(Sam Saffron) #5

Yes, switch to the beta branch at least, let me know what happens


(Sérgio Lopes) #6

Fantastic! We updated to beta and things got much better. ~60ms to ~100ms for logged in users and ~10ms for anonymous users.


(Jeff Atwood) #7