explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Bl9V

Settings
# exclusive inclusive rows x rows loops node
1. 0.004 2,161.004 ↑ 1.0 20 1

Limit (cost=252,662.98..252,792.96 rows=20 width=118) (actual time=2,160.981..2,161.004 rows=20 loops=1)

2. 0.007 2,161.000 ↑ 177.8 20 1

Subquery Scan on base (cost=252,662.98..275,767.42 rows=3,555 width=118) (actual time=2,160.980..2,161.000 rows=20 loops=1)

  • Filter: (base.rank = 1)
3. 0.025 2,160.993 ↑ 35,545.3 20 1

WindowAgg (cost=252,662.98..266,881.10 rows=710,906 width=134) (actual time=2,160.976..2,160.993 rows=20 loops=1)

4. 178.951 2,160.968 ↑ 33,852.7 21 1

Sort (cost=252,662.98..254,440.24 rows=710,906 width=126) (actual time=2,160.964..2,160.968 rows=21 loops=1)

  • Sort Key: od.id, od.created_at DESC
  • Sort Method: external merge Disk: 53,488kB
5. 244.967 1,982.017 ↑ 1.8 395,370 1

Hash Join (cost=691.03..156,523.86 rows=710,906 width=126) (actual time=37.689..1,982.017 rows=395,370 loops=1)

  • Hash Cond: ((op.product_id)::text = (curriculum.curriculum_id)::text)
6. 475.308 1,731.922 ↓ 1.0 1,211,890 1

Merge Join (cost=5.86..144,225.30 rows=1,201,155 width=151) (actual time=32.544..1,731.922 rows=1,211,890 loops=1)

  • Merge Cond: (op.order_id = od.id)
7. 553.758 553.758 ↓ 1.0 1,261,908 1

Index Scan using order_product_order_id_idx on order_product op (cost=0.43..60,903.36 rows=1,254,330 width=33) (actual time=0.011..553.758 rows=1,261,908 loops=1)

8. 702.856 702.856 ↑ 1.0 1,037,408 1

Index Scan using order_pkey on "order" od (cost=0.43..65,944.40 rows=1,037,509 width=126) (actual time=12.114..702.856 rows=1,037,408 loops=1)

  • Filter: ((order_time >= '2019-06-30 03:21:35+00'::timestamp with time zone) AND (order_time <= '2020-06-30 03:21:35+00'::timestamp with time zone))
  • Rows Removed by Filter: 49,578
9. 0.624 5.128 ↓ 1.0 3,298 1

Hash (cost=644.14..644.14 rows=3,283 width=25) (actual time=5.127..5.128 rows=3,298 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 216kB
10. 0.893 4.504 ↓ 1.0 3,298 1

Hash Join (cost=417.81..644.14 rows=3,283 width=25) (actual time=2.510..4.504 rows=3,298 loops=1)

  • Hash Cond: (curriculum_grade.curriculum_id = curriculum.id)
11. 1.128 1.128 ↓ 1.0 3,298 1

Seq Scan on curriculum_grade (cost=0.00..217.70 rows=3,283 width=8) (actual time=0.012..1.128 rows=3,298 loops=1)

  • Filter: (grade = ANY ('{6,7,8,5}'::bigint[]))
  • Rows Removed by Filter: 4,928
12. 0.942 2.483 ↑ 1.0 5,547 1

Hash (cost=348.47..348.47 rows=5,547 width=33) (actual time=2.482..2.483 rows=5,547 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 417kB
13. 1.541 1.541 ↑ 1.0 5,547 1

Seq Scan on curriculum (cost=0.00..348.47 rows=5,547 width=33) (actual time=0.004..1.541 rows=5,547 loops=1)

Planning time : 1.300 ms
Execution time : 2,176.121 ms