Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get the Status of Magento Enterprise Indexers with MySQL
SELECT `main_table`.`process_id`,
`main_table`.`indexer_code`,
'community' AS `indexer_type`,
`main_table`.`status`,
`main_table`.`started_at`,
`main_table`.`ended_at`,
`main_table`.`mode`,
IF(e.events IS NULL, 0, e.events) AS `events`
FROM `index_process` AS `main_table`
LEFT JOIN
(SELECT `index_process_event`.`process_id`,
COUNT(*) AS `events`
FROM `index_process_event`
WHERE (status='new')
GROUP BY `process_id`) AS `e` ON e.process_id=main_table.process_id
LEFT JOIN `enterprise_mview_metadata_group` AS `group_table` ON group_table.group_code = main_table.indexer_code
WHERE (group_table.group_code IS NULL)
UNION ALL
SELECT UUID() AS `process_id`,
`group_table`.`group_code` AS `indexer_code`,
'enterprise' AS `indexer_type`,
CASE MIN(`metadata_table`.`status`)
WHEN 1 THEN 'pending'
WHEN 2 THEN 'scheduled'
WHEN 3 THEN 'working'
ELSE 'require_reindex'
END AS `status`,
NULL AS `started_at`,
NULL AS `ended_at`,
NULL AS `mode`,
0 AS `events`
FROM `enterprise_mview_metadata` AS `metadata_table`
INNER JOIN `enterprise_mview_metadata_group` AS `group_table` ON `group_table`.`group_id` = `metadata_table`.`group_id`
GROUP BY `metadata_table`.`group_id`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment