https://bugzilla.wikimedia.org/show_bug.cgi?id=35028

--- Comment #9 from Antoine "hashar" Musso <[email protected]> 2012-05-02 14:31:54 
UTC ---
The first part of the second query (an UPDATE statement) could be simplified
as:

SELECT * FROM run_useragent WHERE runs=max; which has the following query plan:

explain SELECT * FROM run_useragent WHERE runs=max \G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: run_useragent
         type: ALL
possible_keys: NULL
          key: NULL
      key_len: NULL
          ref: NULL
         rows: 480929
        Extra: Using where
1 row in set (0.00 sec)

Maybe an index on (runs, max) ?



The second part of the query use the `run_client` table too but uses no key:


> explain SELECT * FROM run_client, run_useragent, clients WHERE 
> run_client.run_id=run_useragent.run_id AND run_client.client_id=clients.id 
> AND clients.useragent_id=run_useragent.useragent_id \G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: run_client
         type: ALL
possible_keys: PRIMARY,idx_run_client_run_id,idx_run_client_client_id
          key: NULL
      key_len: NULL
          ref: NULL
         rows: 428455
        Extra: 
*************************** 2. row ***************************
           id: 1
  select_type: SIMPLE
        table: clients
         type: eq_ref
possible_keys: PRIMARY,idx_clients_useragent_id
          key: PRIMARY
      key_len: 4
          ref: testswarm.run_client.client_id
         rows: 1
        Extra: 
*************************** 3. row ***************************
           id: 1
  select_type: SIMPLE
        table: run_useragent
         type: eq_ref
possible_keys: PRIMARY,idx_run_useragent_run_id,idx_run_useragent_useragent_id
          key: PRIMARY
      key_len: 8
          ref: testswarm.run_client.run_id,testswarm.clients.useragent_id
         rows: 1
        Extra: 
3 rows in set (0.00 sec)

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to