You are given a dashboard query that joins several large tables to show monthly revenue by account, product, and region. Your task is to write a PostgreSQL query that returns the final dashboard result efficiently, while preserving correct totals and ranking the top products within each month. Assume the source tables are large enough that repeated scans and unnecessary row expansion matter.