explain.depesz.com

PostgreSQL's explain analyze made readable

Result: LFpF

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 3,383.227 ↓ 1.2 14 1

Group (cost=0.14..890,444.00 rows=12 width=36) (actual time=313.707..3,383.227 rows=14 loops=1)

  • Group Key: loc.location_id
  • Group Key: loc.location_id
2. 0.000 0.084 ↓ 1.2 14 1

Index Scan using location_locationid_companyid_index on location loc (cost=0.14..12.58 rows=12 width=4) (actual time=0.010..0.084 rows=14 loops=1)

  • Index Cond: (company_id = 1)
  • Filter: is_open
3. 37.728 37.728 ↓ 1.2 14 1

Rows Removed by Filte"Group (cost=0.14..431,042.27 rows=12 width=36) (actual time=4.409..37.728 rows=14 loops=1)

4. 0.055 0.055 ↓ 1.2 14 1

Index Scan using location_locationid_companyid_index on location loc (cost=0.14..12.58 rows=12 width=4) (actual time=0.013..0.055 rows=14 loops=1)

  • Index Cond: (company_id = 1)
  • Filter: is_open
  • Rows Removed by Filter: 7
5.          

SubPlan (for Group)

6. 2.492 37.562 ↑ 1.0 1 14

Aggregate (cost=35,919.13..35,919.14 rows=1 width=32) (actual time=2.683..2.683 rows=1 loops=14)

7. 0.378 35.070 ↓ 1.2 34 14

Subquery Scan on query_discounts (cost=5.03..35,918.98 rows=29 width=125) (actual time=0.077..2.505 rows=34 loops=14)

8. 11.978 34.692 ↓ 1.2 34 14

Bitmap Heap Scan on discount dis (cost=5.03..35,918.69 rows=29 width=329) (actual time=0.074..2.478 rows=34 loops=14)

  • Recheck Cond: (location_id = loc.location_id)
  • Filter: (NOT is_deleted)
  • Rows Removed by Filter: 86
  • Heap Blocks: exact=515
9. 0.154 0.154 ↓ 1.2 120 14

Bitmap Index Scan on discount_location_id_idx1 (cost=0.00..5.03 rows=100 width=0) (actual time=0.011..0.011 rows=120 loops=14)

  • Index Cond: (location_id = loc.location_id)
10.          

SubPlan (for Bitmap Heap Scan)

11. 1.920 3.840 ↑ 1.0 1 480

Aggregate (cost=15.89..15.90 rows=1 width=32) (actual time=0.008..0.008 rows=1 loops=480)

12. 1.920 1.920 ↓ 1.4 7 480

Index Scan using discount_redeemable_days_pkey on discount_redeemable_days drd (cost=0.29..15.88 rows=5 width=5) (actual time=0.003..0.004 rows=7 loops=480)

  • Index Cond: (discount_id = dis.discount_id)
13. 0.000 10.560 ↑ 1.0 1 480

Result (cost=609.85..609.86 rows=1 width=32) (actual time=0.022..0.022 rows=1 loops=480)

14.          

Initplan (for Result)

15. 1.440 10.560 ↓ 0.0 0 480

Limit (cost=11.92..609.85 rows=1 width=32) (actual time=0.022..0.022 rows=0 loops=480)

16. 6.720 9.120 ↓ 0.0 0 480

Bitmap Heap Scan on discount_promo_code dpc (cost=11.92..609.85 rows=1 width=32) (actual time=0.019..0.019 rows=0 loops=480)

  • Recheck Cond: (discount_id = dis.discount_id)
  • Filter: (NOT single_use)
  • Rows Removed by Filter: 114
  • Heap Blocks: exact=741
17. 2.400 2.400 ↑ 4.2 115 480

Bitmap Index Scan on discount_promo_code_discount_id_idx1 (cost=0.00..11.92 rows=484 width=0) (actual time=0.005..0.005 rows=115 loops=480)

  • Index Cond: (discount_id = dis.discount_id)
18. 0.000 8.160 ↑ 1.0 1 480

Result (cost=609.85..609.86 rows=1 width=4) (actual time=0.017..0.017 rows=1 loops=480)

19.          

Initplan (for Result)

20. 0.480 8.160 ↓ 0.0 0 480

Limit (cost=11.92..609.85 rows=1 width=4) (actual time=0.017..0.017 rows=0 loops=480)

21. 5.280 7.680 ↓ 0.0 0 480

Bitmap Heap Scan on discount_promo_code dpc_1 (cost=11.92..609.85 rows=1 width=4) (actual time=0.016..0.016 rows=0 loops=480)

  • Recheck Cond: (discount_id = dis.discount_id)
  • Filter: (NOT single_use)
  • Rows Removed by Filter: 114
  • Heap Blocks: exact=741
22. 2.400 2.400 ↑ 4.2 115 480

Bitmap Index Scan on discount_promo_code_discount_id_idx1 (cost=0.00..11.92 rows=484 width=0) (actual time=0.005..0.005 rows=115 loops=480)

  • Index Cond: (discount_id = dis.discount_id)
23. 6.524 3,382.988 ↑ 1.0 1 14

Aggregate (cost=74,202.61..74,202.62 rows=1 width=32) (actual time=241.641..241.642 rows=1 loops=14)

24. 1.624 3,376.464 ↓ 1.2 34 14

Subquery Scan on query_discounts (cost=0.00..74,202.46 rows=29 width=125) (actual time=6.872..241.176 rows=34 loops=14)

25. 38.840 3,374.840 ↓ 1.2 34 14

Seq Scan on discount dis (cost=0.00..74,202.17 rows=29 width=329) (actual time=6.862..241.060 rows=34 loops=14)

  • Filter: ((NOT is_deleted) AND (location_id = loc.location_id))
  • Rows Removed by Filter: 1,858
26.          

SubPlan (for Seq Scan)

27. 5.760 10.560 ↑ 1.0 1 480

Aggregate (cost=15.89..15.90 rows=1 width=32) (actual time=0.022..0.022 rows=1 loops=480)

28. 4.800 4.800 ↓ 1.4 7 480

Index Scan using discount_redeemable_days_pkey on discount_redeemable_days drd (cost=0.29..15.88 rows=5 width=5) (actual time=0.008..0.010 rows=7 loops=480)

  • Index Cond: (discount_id = dis.discount_id)
29. 0.960 1,682.400 ↑ 1.0 1 480

Result (cost=1,269.62..1,269.63 rows=1 width=32) (actual time=3.505..3.505 rows=1 loops=480)

30.          

Initplan (for Result)

31. 1.920 1,681.440 ↓ 0.0 0 480

Limit (cost=0.00..1,269.62 rows=1 width=32) (actual time=3.503..3.503 rows=0 loops=480)

32. 1,679.520 1,679.520 ↓ 0.0 0 480

Seq Scan on discount_promo_code dpc (cost=0.00..1,269.62 rows=1 width=32) (actual time=3.499..3.499 rows=0 loops=480)

  • Filter: ((NOT single_use) AND (discount_id = dis.discount_id))
  • Rows Removed by Filter: 40,060
33. 0.960 1,643.040 ↑ 1.0 1 480

Result (cost=1,269.61..1,269.62 rows=1 width=4) (actual time=3.423..3.423 rows=1 loops=480)

34.          

Initplan (for Result)

35. 1.920 1,642.080 ↓ 0.0 0 480

Limit (cost=0.00..1,269.61 rows=1 width=4) (actual time=3.421..3.421 rows=0 loops=480)

36. 1,640.160 1,640.160 ↓ 0.0 0 480

Seq Scan on discount_promo_code dpc_1 (cost=0.00..1,269.61 rows=1 width=4) (actual time=3.417..3.417 rows=0 loops=480)

  • Filter: ((NOT single_use) AND (discount_id = dis.discount_id))
  • Rows Removed by Filter: 40,060
Planning time : 0.464 ms