explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Lnwv

Settings
# exclusive inclusive rows x rows loops node
1. 16.922 89,080.832 ↓ 34.2 5,332 1

Subquery Scan on t (cost=560,473.65..561,090.59 rows=156 width=195) (actual time=88,883.355..89,080.832 rows=5,332 loops=1)

  • Filter: ((t.date = '2020-03-01'::date) OR (t.date IS NULL))
  • Rows Removed by Filter: 246,935
2.          

CTE mysql_companies

3. 0.476 0.476 ↑ 1.0 432 1

Values Scan on ""*VALUES*"" (cost=0.00..5.40 rows=432 width=4) (actual time=0.001..0.476 rows=432 loops=1)

4. 135.298 89,063.910 ↓ 14.4 252,267 1

WindowAgg (cost=560,468.25..560,863.60 rows=17,571 width=131) (actual time=88,883.348..89,063.910 rows=252,267 loops=1)

5. 456.224 88,928.612 ↓ 14.4 252,267 1

Sort (cost=560,468.25..560,512.18 rows=17,571 width=35) (actual time=88,883.330..88,928.612 rows=252,267 loops=1)

  • Sort Key: metric_table.company_id, metric_table.date DESC
  • Sort Method: external merge Disk: 10,752kB
6. 27.285 88,472.388 ↓ 14.4 252,267 1

Nested Loop (cost=0.56..559,229.42 rows=17,571 width=35) (actual time=2,668.609..88,472.388 rows=252,267 loops=1)

7. 0.879 0.879 ↑ 1.0 432 1

CTE Scan on mysql_companies (cost=0.00..8.64 rows=432 width=4) (actual time=0.003..0.879 rows=432 loops=1)

8. 88,444.224 88,444.224 ↓ 14.2 584 432

Index Scan using idx_traffic_all_visit_test on traffic_similarweb_all_visit metric_table (cost=0.56..1,294.08 rows=41 width=31) (actual time=120.848..204.732 rows=584 loops=432)

  • Index Cond: ((company_id = mysql_companies.id) AND ((rollup)::text = 'month'::text) AND (is_primary_entity = 1))
  • Filter: ((organization_id = 5) OR (organization_id IS NULL))
  • Rows Removed by Filter: 3,415
Planning time : 0.772 ms
Execution time : 89,085.594 ms