Skip to content

Instantly share code, notes, and snippets.

@morishjs
Last active February 28, 2017 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morishjs/fe7e7b4e97cade4d470b09cd90e27caf to your computer and use it in GitHub Desktop.
Save morishjs/fe7e7b4e97cade4d470b09cd90e27caf to your computer and use it in GitHub Desktop.
*** (1) TRANSACTION:
TRANSACTION 10521520362, ACTIVE 0 sec fetching rows
mysql tables in use 3, locked 3
LOCK WAIT 90 lock struct(s), heap size 13864, 186 row lock(s)
MySQL thread id 2215232, OS thread handle 0x7f00b060cb00, query id 14161131472 192.168.2.13 crema Sorting result
UPDATE reviews
LEFT OUTER JOIN
(
SELECT
id,
CASE
WHEN access_level = 0 AND (NOT author_grade <=> 30)
THEN (@review_index := @review_index + 1) - 1
ELSE NULL
END as review_index,
CASE
WHEN access_level = 0 AND (NOT author_grade <=> 30) AND images_count > 0
THEN (@photo_review_index := @photo_review_index + 1) - 1
ELSE NULL
END as photo_review_index
FROM reviews
LEFT OUTER JOIN review_details ON review_details.review_id = reviews.id
WHERE
reviews.access_level != 2 AND
reviews.product_id = 3164 AND
(NOT review_details.disqualified <=> true)
ORDER BY reviews.created_at
) AS updated_reviews
ON re
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 28067 page no 5002 n bits 96 index `PRIMARY` of table `crema_thedaze_kr`.`reviews` trx table locks 1 total table locks 2 trx id 10521520362 lock mode S locks rec but not gap waiting lock hold time 0 wait time before grant 0
*** (2) TRANSACTION:
TRANSACTION 10521519108, ACTIVE 1 sec starting index read
mysql tables in use 2, locked 2
5 lock struct(s), heap size 1184, 3 row lock(s), undo log entries 1
MySQL thread id 2215597, OS thread handle 0x7f00b1152b00, query id 14161131479 192.168.2.13 crema Sending data
UPDATE `review_details`
INNER JOIN `reviews` ON `reviews`.`id` = `review_details`.`review_id` AND (`reviews`.`access_level` != 2) SET `review_details`.`calculated_mileage_dirty` = 1 WHERE `reviews`.`product_id` = 3164 AND (`review_details`.`review_id` != 82091)
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 28067 page no 5002 n bits 96 index `PRIMARY` of table `crema_thedaze_kr`.`reviews` trx table locks 2 total table locks 2 trx id 10521519108 lock_mode X locks rec but not gap lock hold time 1 wait time before grant 1
*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 28067 page no 3723 n bits 872 index `index_reviews_on_product_id` of table `crema_thedaze_kr`.`reviews` trx table locks 2 total table locks 2 trx id 10521519108 lock mode S locks rec but not gap waiting lock hold time 0 wait time before grant 0
*** WE ROLL BACK TRANSACTION (2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment