- mysql> explain SELECT SQL_CALC_FOUND_ROWS * FROM logs WHERE facility IN ('cron') AND priority IN ('warning','err','crit') AND ( msg like '%jjj%') AND ((program = 'crond' and msg RLIKE '0') or (program='crontab') or (program ='exiting') or (program ='HOSTIDM' AND msg LIKE '%vdfgd34345%' )) ORDER BY seq desc, datetime DESC
- -> ;
- +----+-------------+-------+------+---------------------------+----------+---------+-------+-------+-----------------------------+
- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
- +----+-------------+-------+------+---------------------------+----------+---------+-------+-------+-----------------------------+
- | 1 | SIMPLE | logs | ref | program,priority,facility | facility | 33 | const | 84680 | Using where; Using filesort |
- +----+-------------+-------+------+---------------------------+----------+---------+-------+-------+-----------------------------+
- 1 row in set (0.00 sec)
- mysql> explain SELECT SQL_CALC_FOUND_ROWS * FROM logs WHERE facility IN ('cron') AND priority IN ('warning','err','crit') AND ( msg like '%jjj%') AND program IN ('crond','crontab','exiting','HOSTIDM') AND msg RLIKE '0' AND msg LIKE '%vdfgd34345%' ORDER BY seq desc, datetime DESC ;
- +----+-------------+-------+------+---------------------------+----------+---------+-------+-------+-----------------------------+
- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
- +----+-------------+-------+------+---------------------------+----------+---------+-------+-------+-----------------------------+
- | 1 | SIMPLE | logs | ref | program,priority,facility | facility | 33 | const | 84680 | Using where; Using filesort |
- +----+-------------+-------+------+---------------------------+----------+---------+-------+-------+-----------------------------+
- 1 row in set (0.00 sec)
- mysql> explain SELECT SQL_CALC_FOUND_ROWS * FROM logs WHERE ( msg like '%jjj%') AND ((program = 'crond' and msg RLIKE '0') or (program='crontab') or (program ='exiting') or (program ='HOSTIDM' AND msg LIKE '%vdfgd34345%' )) ORDER BY seq desc, datetime DESC
- -> ;
- +----+-------------+-------+-------+---------------+---------+---------+------+--------+-----------------------------+
- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
- +----+-------------+-------+-------+---------------+---------+---------+------+--------+-----------------------------+
- | 1 | SIMPLE | logs | range | program | program | 48 | NULL | 139565 | Using where; Using filesort |
- +----+-------------+-------+-------+---------------+---------+---------+------+--------+-----------------------------+
- 1 row in set (0.01 sec)
- mysql> explain SELECT SQL_CALC_FOUND_ROWS * FROM logs WHERE ( msg like '%jjj%') AND program IN ('crond','crontab','exiting','HOSTIDM') AND msg RLIKE '0' AND msg LIKE '%vdfgd34345%' ORDER BY seq desc, datetime DESC ;
- +----+-------------+-------+-------+---------------+---------+---------+------+--------+-----------------------------+
- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
- +----+-------------+-------+-------+---------------+---------+---------+------+--------+-----------------------------+
- | 1 | SIMPLE | logs | range | program | program | 48 | NULL | 139565 | Using where; Using filesort |
- +----+-------------+-------+-------+---------------+---------+---------+------+--------+-----------------------------+
- 1 row in set (0.00 sec)
- mysql> SELECT SQL_CALC_FOUND_ROWS * FROM logs WHERE ( msg like '%jjj%') AND ((program = 'crond' and msg RLIKE '0') or (program='crontab') or (program ='exiting') or (program ='HOSTIDM' AND msg LIKE '%vdfgd34345%' )) ORDER BY seq desc, datetime DESC ;
- Empty set (0.62 sec)
- mysql> SELECT SQL_CALC_FOUND_ROWS * FROM logs WHERE ( msg like '%jjj%') AND program IN ('crond','crontab','exiting','HOSTIDM') AND msg RLIKE '0' AND msg LIKE '%vdfgd34345%' ORDER BY seq desc, datetime DESC ;
- Empty set (0.53 sec)
- mysql> SELECT SQL_CALC_FOUND_ROWS * FROM logs WHERE ( msg like '%jjj%') AND ((program = 'crond' and msg RLIKE '0') or (program='crontab') or (program ='exiting') or (program ='HOSTIDM' AND msg LIKE '%vdfgd34345%' )) ORDER BY seq desc, datetime DESC ;
- Empty set (0.59 sec)
- mysql> SELECT SQL_CALC_FOUND_ROWS * FROM logs WHERE ( msg like '%jjj%') AND program IN ('crond','crontab','exiting','HOSTIDM') AND msg RLIKE '0' AND msg LIKE '%vdfgd34345%' ORDER BY seq desc, datetime DESC ;
- Empty set (0.59 sec)
- mysql> SELECT SQL_CALC_FOUND_ROWS * FROM logs WHERE ( msg like '%jjj%') AND ((program = 'crond' and msg RLIKE '0') or (program='crontab') or (program ='exiting') or (program ='HOSTIDM' AND msg LIKE '%vdfgd34345%' )) ORDER BY seq desc, datetime DESC ;
- Empty set (0.60 sec)
- mysql> SELECT SQL_CALC_FOUND_ROWS * FROM logs WHERE ( msg like '%jjj%') AND program IN ('crond','crontab','exiting','HOSTIDM') AND msg RLIKE '0' AND msg LIKE '%vdfgd34345%' ORDER BY seq desc, datetime DESC ;
- Empty set (0.58 sec)
- mysql> show index from logs;
- +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
- | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
- +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
- | logs | 0 | PRIMARY | 1 | seq | A | 3225149 | NULL | NULL | | BTREE | |
- | logs | 1 | host | 1 | host | A | 1527 | NULL | NULL | YES | BTREE | |
- | logs | 1 | program | 1 | program | A | 85 | NULL | NULL | YES | BTREE | |
- | logs | 1 | datetime | 1 | datetime | A | 806287 | NULL | NULL | YES | BTREE | |
- | logs | 1 | priority | 1 | priority | A | 85 | NULL | NULL | YES | BTREE | |
- | logs | 1 | facility | 1 | facility | A | 85 | NULL | NULL | YES | BTREE | |
- +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
- 6 rows in set (0.00 sec)
- mysql> show index from logs;
- +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
- | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
- +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
- | logs | 0 | PRIMARY | 1 | seq | A | 3225149 | NULL | NULL | | BTREE | |
- | logs | 1 | host | 1 | host | A | 1527 | NULL | NULL | YES | BTREE | |
- | logs | 1 | program | 1 | program | A | 85 | NULL | NULL | YES | BTREE | |
- | logs | 1 | datetime | 1 | datetime | A | 806287 | NULL | NULL | YES | BTREE | |
- | logs | 1 | priority | 1 | priority | A | 85 | NULL | NULL | YES | BTREE | |
- | logs | 1 | facility | 1 | facility | A | 85 | NULL | NULL | YES | BTREE | |
- +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
- 6 rows in set (0.00 sec)