Welcome Guest, Not a member yet? Register   Sign In
How can I rate query performance?

Sometimes we can write a query multiple ways, or break down a query into multiple queries, so I wonder how to rate the performance of the query (or queries) to know what will have the best performance.

I'm thinking about this this morning because I have a query like this:

    GROUP_CONCAT( DISTINCT r.role SEPARATOR "," ) roles,
    GROUP_CONCAT( DISTINCT g.group SEPARATOR "," ) groups
FROM users u
    LEFT JOIN user_roles r
        ON u.user_id = r.user_id
    LEFT JOIN user_groups g
        ON u.user_id = g.user_id
    LOWER(u.username) = ? OR LOWER(u.email) = ?
GROUP BY u.user_id

When I use EXPLAIN it looks like it's doing 3 queries, and I could just do 3 separate queries, but how will I know which way is best/fastest? Is there a way to rate the query (some numeric value)?

Messages In This Thread
How can I rate query performance? - by skunkbad - 09-07-2018, 08:21 AM

Theme © iAndrew 2016 - Forum software by © MyBB