• Julien Muchembled's avatar
    CMFActivity: validate a message with a single SQL request per queue · 7e387bcb
    Julien Muchembled authored
    As shown in the following example, on a big catalog table,
    MariaDB is able to use several indices at the same time
    ('...' are obfuscated unique values):
    
      > analyze select SQL_NO_CACHE uid, relative_url from catalog where reference='...' OR relative_url='...';
      +------+-------------+---------+-------------+------------------------+------------------------+---------+------+------+--------+----------+------------+--------------------------------------------------+
      | id   | select_type | table   | type        | possible_keys          | key                    | key_len | ref  | rows | r_rows | filtered | r_filtered | Extra                                            |
      +------+-------------+---------+-------------+------------------------+------------------------+---------+------+------+--------+----------+------------+--------------------------------------------------+
      |    1 | SIMPLE      | catalog | index_merge | Reference,relative_url | Reference,relative_url | 768,767 | NULL |    2 |   2.00 |   100.00 |     100.00 | Using union(Reference,relative_url); Using where |
      +------+-------------+---------+-------------+------------------------+------------------------+---------+------+------+--------+----------+------------+--------------------------------------------------+
      1 row in set (0.00 sec)
    
    So mixing different dependency types with OR should be fine
    (no need to split into more subqueries and join with UNION).
    7e387bcb
ActivityTool.py 61.5 KB