explain.depesz.com

PostgreSQL's explain analyze made readable

Result: rSna

Settings
# exclusive inclusive rows x rows loops node
1. 0.038 7,769.523 ↓ 20.0 20 1

Nested Loop Left Join (cost=7.34..814,942.61 rows=1 width=152) (actual time=7,769.421..7,769.523 rows=20 loops=1)

2. 0.010 7,769.465 ↓ 20.0 20 1

Nested Loop Left Join (cost=6.92..814,934.15 rows=1 width=104) (actual time=7,769.403..7,769.465 rows=20 loops=1)

3. 0.014 7,769.455 ↓ 20.0 20 1

Nested Loop (cost=6.49..814,925.70 rows=1 width=93) (actual time=7,769.401..7,769.455 rows=20 loops=1)

4. 0.003 7,769.401 ↑ 1.1 20 1

Append (cost=6.07..814,748.19 rows=21 width=92) (actual time=7,769.387..7,769.401 rows=20 loops=1)

5. 0.000 0.021 ↓ 0.0 0 1

Subquery Scan on "*SELECT* 1" (cost=6.07..6.08 rows=1 width=65) (actual time=0.021..0.021 rows=0 loops=1)

6. 0.001 0.021 ↓ 0.0 0 1

Limit (cost=6.07..6.08 rows=1 width=65) (actual time=0.021..0.021 rows=0 loops=1)

7. 0.012 0.020 ↓ 0.0 0 1

Sort (cost=6.07..6.08 rows=1 width=65) (actual time=0.020..0.020 rows=0 loops=1)

  • Sort Key: statistic_shipped_points.date_and_time DESC NULLS LAST, statistic_shipped_points.id DESC NULLS LAST
  • Sort Method: quicksort Memory: 25kB
8. 0.008 0.008 ↓ 0.0 0 1

Index Scan using statistic_shipped_points_date_and_time_idx on statistic_shipped_points (cost=0.29..6.06 rows=1 width=65) (actual time=0.008..0.008 rows=0 loops=1)

  • Index Cond: ((subsidiary_country_id = 350) AND (date_and_time >= '2017-10-06 01:00:00'::timestamp without time zone) AND (date_and_time <= '2020-10-13 23:59:00'::timestamp without time zone))
  • Filter: ((report_type)::text <> 'POINT_DISTRIBUTION'::text)
9. 0.003 7,769.377 ↑ 1.0 20 1

Subquery Scan on "*SELECT* 2" (cost=814,741.86..814,742.11 rows=20 width=93) (actual time=7,769.366..7,769.377 rows=20 loops=1)

10. 0.004 7,769.374 ↑ 1.0 20 1

Limit (cost=814,741.86..814,741.91 rows=20 width=93) (actual time=7,769.366..7,769.374 rows=20 loops=1)

11. 3,093.258 7,769.370 ↑ 721,697.9 20 1

Sort (cost=814,741.86..850,826.76 rows=14,433,959 width=93) (actual time=7,769.365..7,769.370 rows=20 loops=1)

  • Sort Key: statistic_loyalty_point_distribution_created_events.date_and_time DESC NULLS LAST, statistic_loyalty_point_distribution_created_events.id DESC NULLS LAST
  • Sort Method: top-N heapsort Memory: 27kB
12. 4,676.112 4,676.112 ↓ 1.0 14,508,681 1

Seq Scan on statistic_loyalty_point_distribution_created_events (cost=0.00..430,659.40 rows=14,433,959 width=93) (actual time=0.032..4,676.112 rows=14,508,681 loops=1)

  • Filter: ((date_and_time >= '2017-10-06 01:00:00'::timestamp without time zone) AND (date_and_time <= '2020-10-13 23:59:00'::timestamp without time zone) AND (subsidiary_country_id = 350))
  • Rows Removed by Filter: 11,399
13. 0.040 0.040 ↑ 1.0 1 20

Index Scan using statistic_user_compound_has_subsidiary_country_ix_02 on statistic_user_compound_has_subsidiary_country (cost=0.42..8.44 rows=1 width=10) (actual time=0.002..0.002 rows=1 loops=20)

  • Index Cond: ((subsidiary_country_id = 350) AND (statistic_user_compound_user_id = ""*SELECT* 1"".user_id))
14. 0.000 0.000 ↓ 0.0 0 20

Index Scan using coupon_pk on coupon (cost=0.43..8.45 rows=1 width=15) (actual time=0.000..0.000 rows=0 loops=20)

  • Index Cond: (""*SELECT* 1"".coupon_id = id)
15. 0.020 0.020 ↑ 1.0 1 20

Index Scan using points_distribution_pkey on points_distribution (cost=0.42..8.44 rows=1 width=16) (actual time=0.001..0.001 rows=1 loops=20)

  • Index Cond: (""*SELECT* 1"".distribution_id = id)
Planning time : 0.512 ms
Execution time : 7,769.607 ms