You're working as a content moderator for a social media platform, analyzing the effectiveness of your spam detection system. Your goal is to calculate the daily removal rate of posts that were reported as spam.
You have access to two tables:
- Actions: Records all user interactions with posts, including reports
- Removals: Records when posts were actually removed by moderators
Your task is to find the average daily percentage of spam-reported posts that got removed, rounded to 2 decimal places.
Key Challenge: You need to match posts that were both reported as spam AND subsequently removed, then calculate the daily removal rate across all days.
Think of it like measuring how effective your content moderation team is at acting on spam reports!
Input & Output
Visualization
Time & Space Complexity
Single scan of Actions table plus efficient JOIN operation with Removals table
Space needed for intermediate CTE results and JOIN operation
Constraints
- 1 โค user_id, post_id โค 105
- action_date and remove_date are valid dates
- action โ {'view', 'like', 'reaction', 'comment', 'report', 'share'}
- extra field is 'spam' only for report actions we care about
- A post can be reported multiple times but should be counted once per day