Skip to content

Instantly share code, notes, and snippets.

@unicoder88
Created September 26, 2018 13:00
Show Gist options
  • Save unicoder88/7ef15ad0a0c331465a173d4570fe33d0 to your computer and use it in GitHub Desktop.
Save unicoder88/7ef15ad0a0c331465a173d4570fe33d0 to your computer and use it in GitHub Desktop.
select s.view_id,
s.version_id,
(SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = database() AND TABLE_NAME = concat(s.view_id, '_cl')) as increment_id,
(select count(*) from catalog_product_price_cl cl where cl.version_id > s.version_id) as pending_updates
from mview_state s where s.view_id = 'catalog_product_price'
UNION
select s.view_id, s.version_id, (SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = database() AND TABLE_NAME = concat(s.view_id, '_cl')) as increment_id, (select count(*) from catalog_product_flat_cl cl where cl.version_id > s.version_id) as pending_updates from mview_state s where s.view_id = 'catalog_product_flat'
UNION
select s.view_id, s.version_id, (SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = database() AND TABLE_NAME = concat(s.view_id, '_cl')) as increment_id, (select count(*) from cataloginventory_stock_cl cl where cl.version_id > s.version_id) as pending_updates from mview_state s where s.view_id = 'cataloginventory_stock'
UNION
select s.view_id, s.version_id, (SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = database() AND TABLE_NAME = concat(s.view_id, '_cl')) as increment_id, (select count(*) from catalog_product_attribute_cl cl where cl.version_id > s.version_id) as pending_updates from mview_state s where s.view_id = 'catalog_product_attribute'
UNION
select s.view_id, s.version_id, (SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = database() AND TABLE_NAME = concat(s.view_id, '_cl')) as increment_id, (select count(*) from catalog_category_product_cl cl where cl.version_id > s.version_id) as pending_updates from mview_state s where s.view_id = 'catalog_category_product'
UNION
select s.view_id, s.version_id, (SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = database() AND TABLE_NAME = concat(s.view_id, '_cl')) as increment_id, (select count(*) from catalog_product_category_cl cl where cl.version_id > s.version_id) as pending_updates from mview_state s where s.view_id = 'catalog_product_category'
UNION
select s.view_id, s.version_id, (SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = database() AND TABLE_NAME = concat(s.view_id, '_cl')) as increment_id, (select count(*) from catalogsearch_fulltext_cl cl where cl.version_id > s.version_id) as pending_updates from mview_state s where s.view_id = 'catalogsearch_fulltext'
UNION
select s.view_id, s.version_id, (SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = database() AND TABLE_NAME = concat(s.view_id, '_cl')) as increment_id, (select count(*) from algolia_products_cl cl where cl.version_id > s.version_id) as pending_updates from mview_state s where s.view_id = 'algolia_products'
-- UNION
-- select s.view_id, s.version_id, (SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = database() AND TABLE_NAME = concat(s.view_id, '_cl')) as increment_id, (select count(*) from clerk_products_cl cl where cl.version_id > s.version_id) as pending_updates from mview_state s where s.view_id = 'clerk_products'
-- UNION
-- select s.view_id, s.version_id, (SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = database() AND TABLE_NAME = concat(s.view_id, '_cl')) as increment_id, (select count(*) from convert_stock_delivery_time_cl cl where cl.version_id > s.version_id) as pending_updates from mview_state s where s.view_id = 'convert_stock_delivery_time'
order by view_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment