Magento 2 SQL queries › Store setup
How many active CMS pages does each store view have?
Short answer: Pages link to store views in cms_page_store; store 0 means All Store Views.
In the Magento admin
- Go to Content › Pages, filter Status = Enabled and Store View one at a time.
With one query
These queries only read data. Run them on a copy of your database if you can, or ask your developer to. If your tables have a prefix (set in app/etc/env.php), add it to each table name.
Magento Open Source
SELECT IF(ps.store_id = 0, 'All Store Views', s.code) AS store_view, COUNT(*) AS active_pages
FROM cms_page p
JOIN cms_page_store ps ON ps.page_id = p.page_id
LEFT JOIN store s ON s.store_id = ps.store_id
WHERE p.is_active = 1
GROUP BY ps.store_id, s.code
ORDER BY ps.store_id;
Adobe Commerce
Product, category, rule and CMS values are stored per version and joined on row_id (why):
SELECT IF(ps.store_id = 0, 'All Store Views', s.code) AS store_view, COUNT(*) AS active_pages
FROM cms_page p
JOIN cms_page_store ps ON ps.row_id = p.row_id
LEFT JOIN store s ON s.store_id = ps.store_id
WHERE p.is_active = 1
AND p.created_in <= UNIX_TIMESTAMP() AND p.updated_in > UNIX_TIMESTAMP()
GROUP BY ps.store_id, s.code
ORDER BY ps.store_id;
Good to know
- A page assigned to All Store Views is counted once, under that row, not in every store view.