Key Queries
Content Freshness by Scope
Find pages that haven’t been regenerated in 30 days:
SELECT s.name, COUNT(*) as stale_countFROM pages pJOIN scopes s ON s.id = p.scope_idWHERE p.generated_at < datetime('now', '-30 days')GROUP BY s.name;SEO Gap Analysis
Find pages with missing or short meta descriptions:
SELECT url_path, titleFROM pagesWHERE meta_description IS NULL OR LENGTH(meta_description) < 50;Listing Search by City
Find active listings in a specific city:
SELECT * FROM listingsWHERE city_id = (SELECT id FROM brazil_cities WHERE slug = 'sao-paulo' AND state_code = 'SP') AND status = 'active';404 Resolution Status
Check how many 404 URLs have been resolved:
SELECT resolved, COUNT(*) FROM notfound_urls GROUP BY resolved;Top Unresolved 404s
Find the most-hit unresolved URLs:
SELECT url_path, hit_countFROM notfound_urlsWHERE resolved = 0ORDER BY hit_count DESCLIMIT 20;Daily Rotation Status
Check which state was last refreshed:
SELECT * FROM daily_rotation_tracker ORDER BY refreshed_at DESC LIMIT 1;Page Count by Type
SELECT pt.name, COUNT(*) as page_countFROM pages pJOIN page_types pt ON pt.id = p.page_type_idGROUP BY pt.name;