title: MySQL performance: Single query using GROUP_CONCAT, or two separate queries?
body: <p>I have a MySQL database in which each user has an account, and each account can have multiple permissions. </p>
  
  <p>My ultimate goal is to end up with the account's username, and a comma-delimited list of permissions ids. There are two ways I can accomplish this:</p>
  
  <pre><code>SELECT a.username, GROUP_CONCAT(rp.permission_id) as permission_ids
  FROM account AS a
  JOIN role_permission AS rp
  ON rp.role_id = a.role_id
  WHERE a.id = 1902
  </code></pre>
  
  <p>... or ...</p>
  
  <pre><code>SELECT username
  FROM account
  WHERE id = 1902;
  
  SELECT permission_id
  FROM account_permission
  WHERE account_id = 1902
  </code></pre>
  
  <p>With the single query, I get my results exactly as I want them. With two queries, I have to create the comma-delimited list in the app (PHP) using the second result set.</p>
  
  <p>Are there any performance reasons to NOT choose the first option? I have never used GROUP_CONCAT before, so I don't know the implications of it, performance-wise.</p>