Skip to content

Instantly share code, notes, and snippets.

@mpchadwick
Created September 27, 2016 19:48
Show Gist options
  • Save mpchadwick/7fc5bc96e2a4309da0e6dc17284d577c to your computer and use it in GitHub Desktop.
Save mpchadwick/7fc5bc96e2a4309da0e6dc17284d577c to your computer and use it in GitHub Desktop.
magento-cl-index-status
SELECT
emm.table_name AS "Index",
emm.version_id AS "Last Run Version",
COALESCE(
eurrc.version,
cissc.version,
csfc.version,
eurcc.version,
eurpc.version,
ccpic.version,
ccpcc.version,
cpipc.version,
ccfc.version,
cpfc.version
) AS "Most Recent Change Version"
FROM enterprise_mview_metadata emm
LEFT JOIN (
SELECT MAX(version_id) AS "version"
FROM enterprise_url_rewrite_redirect_cl
) AS eurrc ON emm.table_name = "enterprise_url_rewrite_redirect"
LEFT JOIN (
SELECT MAX(version_id) AS "version"
FROM cataloginventory_stock_status_c
) AS cissc ON emm.table_name = "cataloginventory_stock_status"
LEFT JOIN (
SELECT MAX(version_id) AS "version"
FROM catalogsearch_fulltext_cl
) AS csfc ON emm.table_name = "catalogsearch_fulltext"
LEFT JOIN (
SELECT MAX(version_id) AS "version"
FROM enterprise_url_rewrite_category_cl
) AS eurcc ON emm.table_name = "enterprise_url_rewrite_category"
LEFT JOIN (
SELECT MAX(version_id) AS "version"
FROM enterprise_url_rewrite_product_cl
) AS eurpc ON emm.table_name = "enterprise_url_rewrite_product"
LEFT JOIN (
SELECT MAX(version_id) AS "version"
FROM catalog_category_product_index_cl
) AS ccpic ON emm.table_name = "catalog_category_product_index"
LEFT JOIN (
SELECT MAX(version_id) AS "version"
FROM catalog_category_product_cat_cl
) AS ccpcc ON emm.table_name= "catalog_category_product_cat"
LEFT JOIN (
SELECT MAX(version_id) AS "version"
FROM catalog_product_index_price_cl
) AS cpipc ON emm.table_name = "catalog_product_index_price"
LEFT JOIN (
SELECT MAX(version_id) AS "version"
FROM catalog_category_flat_cl
) AS ccfc ON emm.table_name = "catalog_category_flat"
LEFT JOIN (
SELECT MAX(version_id) AS "version"
FROM catalog_product_flat_cl
) AS cpfc ON emm.table_name = "catalog_product_flat"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment