In Rails there is a useful method that can show how long a query takes and what query it is.
The method is 'explain'
So I can do:
User.where(name: 'Johnny').explain
And it will display the actual sql query.
the 'count' method also makes an sql query but since 'count' returns a number and not an active record, I cannot use explain on it. Is there any way to do that?
Aucun commentaire:
Enregistrer un commentaire