explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 9Tb5 : test

Settings
# exclusive inclusive rows x rows loops node
1. 360.498 54,705.767 ↓ 500.0 500 1

Limit (cost=1,140,615.08..1,140,615.09 rows=1 width=36) (actual time=54,345.231..54,705.767 rows=500 loops=1)

2. 147.081 54,345.269 ↓ 500.0 500 1

Sort (cost=1,140,615.08..1,140,615.09 rows=1 width=36) (actual time=54,345.229..54,345.269 rows=500 loops=1)

  • Sort Key: tmp."Order Name", tmp.order_discr
  • Sort Method: top-N heapsort Memory: 65kB
3. 24.799 54,198.188 ↓ 105,389.0 105,389 1

Subquery Scan on tmp (cost=1,140,612.06..1,140,615.07 rows=1 width=36) (actual time=54,099.036..54,198.188 rows=105,389 loops=1)

4. 154.990 54,173.389 ↓ 105,389.0 105,389 1

HashAggregate (cost=1,140,612.06..1,140,615.06 rows=1 width=40) (actual time=54,099.034..54,173.389 rows=105,389 loops=1)

  • Group Key: "*SELECT* 1".name
  • Filter: (CASE WHEN (GROUPING("*SELECT* 1".name) = 0) THEN 1 ELSE 0 END = 1)
5. 13.294 54,018.399 ↑ 19.4 106,869 1

Append (cost=602,825.87..1,109,464.79 rows=2,076,485 width=1,223) (actual time=38,682.855..54,018.399 rows=106,869 loops=1)

6. 48.859 54,005.102 ↑ 19.4 106,869 1

Result (cost=602,825.87..1,099,082.33 rows=2,076,484 width=1,223) (actual time=38,682.854..54,005.102 rows=106,869 loops=1)

7. 13.120 53,956.243 ↑ 19.4 106,869 1

Append (cost=602,825.87..1,067,935.07 rows=2,076,484 width=1,215) (actual time=38,682.850..53,956.243 rows=106,869 loops=1)

8. 57.533 53,943.122 ↑ 19.4 106,869 1

Result (cost=602,825.87..1,057,552.65 rows=2,076,483 width=1,215) (actual time=38,682.849..53,943.122 rows=106,869 loops=1)

9. 13.214 53,885.589 ↑ 19.4 106,869 1

Append (cost=602,825.87..1,031,596.61 rows=2,076,483 width=1,211) (actual time=38,682.845..53,885.589 rows=106,869 loops=1)

10. 0.000 53,872.372 ↑ 19.4 106,869 1

Subquery Scan on *SELECT* 1 (cost=602,825.87..1,021,214.19 rows=2,076,482 width=1,006) (actual time=38,682.844..53,872.372 rows=106,869 loops=1)

11. 4,610.129 54,163.149 ↑ 19.4 106,869 1

Gather (cost=602,825.87..995,258.17 rows=2,076,482 width=1,002) (actual time=38,682.840..54,163.149 rows=106,869 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
12. 11,249.406 49,553.020 ↑ 24.3 35,623 3 / 3

Parallel Hash Join (cost=601,825.87..786,609.97 rows=865,201 width=1,002) (actual time=38,673.687..49,553.020 rows=35,623 loops=3)

  • Hash Cond: (o_3.id = l.shopify_order_id)
13. 11.738 120.061 ↑ 1.3 35,130 3 / 3

Parallel Append (cost=662.55..95,633.10 rows=44,680 width=673) (actual time=11.420..120.061 rows=35,130 loops=3)

14. 48.557 53.915 ↑ 1.3 15,000 3 / 3

Parallel Bitmap Heap Scan on shopify_orders_2019_06_09 o_3 (cost=1,000.34..54,760.13 rows=19,135 width=779) (actual time=7.156..53.915 rows=15,000 loops=3)

  • Recheck Cond: (shop_id = 80)
  • Filter: ((created_at >= '2019-01-01 00:00:00'::timestamp without time zone) AND (created_at <= '2019-09-28 22:59:59'::timestamp without time zone))
  • Heap Blocks: exact=2,690
15. 5.358 5.358 ↑ 1.0 45,000 1 / 3

Bitmap Index Scan on shopify_orders_2019_06_09_on_shop_id (cost=0.00..988.86 rows=45,924 width=0) (actual time=16.075..16.075 rows=45,000 loops=1)

  • Index Cond: (shop_id = 80)
16. 25.293 26.399 ↓ 1.2 14,824 2 / 3

Parallel Bitmap Heap Scan on shopify_orders_2019_03_06 o_2 (cost=662.55..19,743.84 rows=12,588 width=589) (actual time=1.942..39.599 rows=14,824 loops=2)

  • Recheck Cond: (shop_id = 80)
  • Filter: ((created_at >= '2019-01-01 00:00:00'::timestamp without time zone) AND (created_at <= '2019-09-28 22:59:59'::timestamp without time zone))
  • Heap Blocks: exact=254
17. 1.106 1.106 ↑ 1.0 29,648 1 / 3

Bitmap Index Scan on shopify_orders_2019_03_06_on_shop_id (cost=0.00..655.00 rows=30,210 width=0) (actual time=3.319..3.319 rows=29,648 loops=1)

  • Index Cond: (shop_id = 80)
18. 16.791 17.820 ↓ 2.4 17,946 1 / 3

Parallel Bitmap Heap Scan on shopify_orders_2019_09_12 o_4 (cost=399.61..9,717.22 rows=7,483 width=610) (actual time=3.462..53.460 rows=17,946 loops=1)

  • Recheck Cond: (shop_id = 80)
  • Filter: ((created_at >= '2019-01-01 00:00:00'::timestamp without time zone) AND (created_at <= '2019-09-28 22:59:59'::timestamp without time zone))
  • Heap Blocks: exact=2,093
19. 1.029 1.029 ↑ 1.0 17,946 1 / 3

Bitmap Index Scan on shopify_orders_2019_09_12_on_shop_id (cost=0.00..395.12 rows=17,960 width=0) (actual time=3.087..3.087 rows=17,946 loops=1)

  • Index Cond: (shop_id = 80)
20. 7.238 10.189 ↓ 2.3 12,795 1 / 3

Parallel Bitmap Heap Scan on shopify_orders_2019_01_03 o_1 (cost=290.22..11,188.52 rows=5,473 width=584) (actual time=9.056..30.566 rows=12,795 loops=1)

  • Recheck Cond: (shop_id = 80)
  • Filter: ((created_at >= '2019-01-01 00:00:00'::timestamp without time zone) AND (created_at <= '2019-09-28 22:59:59'::timestamp without time zone))
  • Heap Blocks: exact=1,144
21. 2.950 2.950 ↑ 1.0 12,795 1 / 3

Bitmap Index Scan on shopify_orders_2019_01_03_on_shop_id (cost=0.00..286.94 rows=13,136 width=0) (actual time=8.850..8.851 rows=12,795 loops=1)

  • Index Cond: (shop_id = 80)
22. 0.000 0.000 ↓ 0.0 0 1 / 3

Parallel Seq Scan on shopify_orders o (cost=0.00..0.00 rows=1 width=644) (actual time=0.001..0.001 rows=0 loops=1)

  • Filter: ((created_at >= '2019-01-01 00:00:00'::timestamp without time zone) AND (created_at <= '2019-09-28 22:59:59'::timestamp without time zone) AND (shop_id = 80))
23. 2,982.216 38,183.553 ↑ 1.2 1,782,646 3 / 3

Parallel Hash (cost=497,632.81..497,632.81 rows=2,217,881 width=254) (actual time=38,183.553..38,183.553 rows=1,782,646 loops=3)

  • Buckets: 16,384 Batches: 512 Memory Usage: 3,328kB
24. 35,201.337 35,201.337 ↑ 1.2 1,782,646 3 / 3

Parallel Seq Scan on shopify_line_items l (cost=0.00..497,632.81 rows=2,217,881 width=254) (actual time=0.339..35,201.337 rows=1,782,646 loops=3)

25. 0.001 0.003 ↓ 0.0 0 1

Subquery Scan on *SELECT* 2 (cost=0.00..0.01 rows=1 width=1,136) (actual time=0.002..0.003 rows=0 loops=1)

26. 0.002 0.002 ↓ 0.0 0 1

Result (cost=0.00..0.00 rows=0 width=1,128) (actual time=0.002..0.002 rows=0 loops=1)

  • One-Time Filter: false
27. 0.000 0.001 ↓ 0.0 0 1

Subquery Scan on *SELECT* 3 (cost=0.00..0.01 rows=1 width=1,191) (actual time=0.001..0.001 rows=0 loops=1)

28. 0.001 0.001 ↓ 0.0 0 1

Result (cost=0.00..0.00 rows=0 width=1,183) (actual time=0.001..0.001 rows=0 loops=1)

  • One-Time Filter: false
29. 0.001 0.003 ↓ 0.0 0 1

Subquery Scan on *SELECT* 4 (cost=0.00..0.03 rows=1 width=1,199) (actual time=0.002..0.003 rows=0 loops=1)

30. 0.002 0.002 ↓ 0.0 0 1

HashAggregate (cost=0.00..0.01 rows=1 width=1,187) (actual time=0.002..0.002 rows=0 loops=1)

  • Group Key: id
31. 0.000 0.000 ↓ 0.0 0 1

Result (cost=0.00..0.00 rows=0 width=80) (actual time=0.000..0.000 rows=0 loops=1)

  • One-Time Filter: false
Planning time : 4.454 ms
Execution time : 54,707.474 ms