Open hedwig100 opened 1 year ago
++ dirname ./slowquery.sh + cd . + rotate_filepath= + '[' 0 -eq 1 ']' + sudo mysqldumpslow -s t /var/log/mysql/mysql-slow.log + head -n 100 Reading mysql slow query log from /var/log/mysql/mysql-slow.log Count: 14855 Time=0.01s (112s) Lock=0.00s (0s) Rows=0.8 (11725), isucon[isucon]@localhost SELECT image FROM icons WHERE user_id = N Count: 238794 Time=0.00s (56s) Lock=0.00s (0s) Rows=0.4 (99451), 2users@localhost # Count: 11961 Time=0.00s (27s) Lock=0.00s (0s) Rows=1.0 (11961), isucon[isucon]@localhost SELECT * FROM themes WHERE user_id = N Count: 810 Time=0.02s (20s) Lock=0.00s (0s) Rows=1.0 (810), isucon[isucon]@localhost SELECT slot FROM reservation_slots WHERE start_at = N AND end_at = N Count: 34423 Time=0.00s (19s) Lock=0.00s (0s) Rows=0.0 (0), isucon[isucon]@localhost DELETE FROM livecomments WHERE id = N AND livestream_id = N AND (SELECT COUNT(*) FROM (SELECT 'S' AS text) AS texts INNER JOIN (SELECT CONCAT('S', 'S', 'S') AS pattern) AS patterns ON texts.text LIKE patterns.pattern) >= N Count: 326 Time=0.06s (18s) Lock=0.00s (0s) Rows=0.2 (74), isucon[isucon]@localhost SELECT id, user_id, livestream_id, word FROM ng_words WHERE user_id = N AND livestream_id = N Count: 2545 Time=0.00s (9s) Lock=0.00s (0s) Rows=0.0 (0), isucon[isucon]@localhost COMMIT Count: 23875 Time=0.00s (8s) Lock=0.00s (0s) Rows=1.0 (23875), isucon[isucon]@localhost SELECT * FROM tags WHERE id = N Count: 95 Time=0.05s (5s) Lock=0.00s (0s) Rows=0.0 (0), isucon[isucon]@localhost UPDATE reservation_slots SET slot = slot - N WHERE start_at >= N AND end_at <= N Count: 97 Time=0.05s (4s) Lock=0.00s (0s) Rows=8.4 (811), isucon[isucon]@localhost SELECT * FROM reservation_slots WHERE start_at >= N AND end_at <= N FOR UPDATE Count: 11720 Time=0.00s (4s) Lock=0.00s (0s) Rows=1.0 (11720), isucon[isucon]@localhost SELECT * FROM users WHERE id = N Count: 236 Time=0.02s (4s) Lock=0.00s (0s) Rows=0.0 (0), isudns[isudns]@localhost delete from records where domain_id=N and name='S' and type='S' Count: 86 Time=0.05s (4s) Lock=0.00s (0s) Rows=1.6 (137), isucon[isucon]@localhost SELECT * FROM livestreams WHERE user_id = N Count: 6696 Time=0.00s (4s) Lock=0.00s (0s) Rows=3.6 (23875), isucon[isucon]@localhost SELECT * FROM livestream_tags WHERE livestream_id = N Count: 1000 Time=0.00s (4s) Lock=0.00s (0s) Rows=0.0 (0), isucon[isucon]@localhost INSERT INTO users (id, name, display_name, description, password) VALUES (N, 'S', 'S', 'S', 'S') Count: 235 Time=0.01s (2s) Lock=0.00s (0s) Rows=0.0 (0), isucon[isucon]@localhost INSERT INTO icons (user_id, image) VALUES (N, 'S') Count: 472 Time=0.01s (2s) Lock=0.00s (0s) Rows=0.5 (236), isudns[isudns]@localhost SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=N and type='S' and name='S' and domain_id=N Count: 5062 Time=0.00s (2s) Lock=0.00s (0s) Rows=1.0 (5062), isucon[isucon]@localhost SELECT * FROM livestreams WHERE id = N Count: 31 Time=0.07s (2s) Lock=0.00s (0s) Rows=0.1 (3), isucon[isucon]@localhost SELECT * FROM ng_words WHERE user_id = N AND livestream_id = N ORDER BY created_at DESC Count: 237 Time=0.01s (1s) Lock=0.00s (0s) Rows=0.0 (0), isudns[isudns]@localhost commit Count: 510 Time=0.00s (1s) Lock=0.00s (0s) Rows=0.0 (0), isucon[isucon]@localhost INSERT INTO themes (user_id, dark_mode) VALUES (N, true) Count: 490 Time=0.00s (1s) Lock=0.00s (0s) Rows=0.0 (0), isucon[isucon]@localhost INSERT INTO themes (user_id, dark_mode) VALUES (N, false) Count: 236 Time=0.01s (1s) Lock=0.00s (0s) Rows=0.0 (0), isudns[isudns]@localhost SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=N and name='S' and domain_id=N Count: 2917 Time=0.00s (1s) Lock=0.00s (0s) Rows=0.0 (0), isucon[isucon]@localhost ROLLBACK Count: 235 Time=0.01s (1s) Lock=0.00s (0s) Rows=0.0 (0), isucon[isucon]@localhost DELETE FROM icons WHERE user_id = N Count: 3156 Time=0.00s (1s) Lock=0.00s (0s) Rows=1.0 (3155), isucon[isucon]@localhost SELECT * FROM users WHERE name = 'S' Count: 23 Time=0.06s (1s) Lock=0.00s (0s) Rows=1.4 (32), isucon[isucon]@localhost SELECT * FROM ng_words WHERE livestream_id = N Count: 293 Time=0.00s (1s) Lock=0.00s (0s) Rows=7.4 (2160), isucon[isucon]@localhost SELECT * FROM livecomments WHERE livestream_id = N ORDER BY created_at DESC Count: 5471 Time=0.00s (1s) Lock=0.00s (0s) Rows=0.0 (0), isucon[isucon]@localhost START TRANSACTION Count: 326 Time=0.00s (1s) Lock=0.00s (0s) Rows=6.0 (1967), isucon[isucon]@localhost SELECT * FROM reactions WHERE livestream_id = N ORDER BY created_at DESC Count: 237 Time=0.00s (0s) Lock=0.00s (0s) Rows=1.0 (237), isudns[isudns]@localhost