Given two large tables with highly skewed distribution keys, how would you optimize a complex SQL JOIN operation to avoid performance bottlenecks for Roku-scale datasets?
Using the supplied PostgreSQL tables, write the query that returns the requested result while demonstrating a skew-aware execution strategy. Assume content IDs 1 and 2 are identified as heavily skewed keys.
Output
- One row per active content item with qualifying playback events and a matching channel.
- Columns:
content_id, title, channel_name, total_watch_seconds, and event_count.
- Include playback events from January 2025 only, exclude null content IDs, and sort by total watch seconds descending, then content ID ascending.