explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Aasy

Settings
# exclusive inclusive rows x rows loops node
1. 0.265 99,488.192 ↑ 1.0 1 1

Aggregate (cost=36,253.27..36,253.30 rows=1 width=8) (actual time=99,488.192..99,488.192 rows=1 loops=1)

2. 0.742 99,487.927 ↓ 3,924.0 3,924 1

Group (cost=36,253.23..36,253.24 rows=1 width=16) (actual time=99,486.898..99,487.927 rows=3,924 loops=1)

  • Group Key: r.id, p.id, rd.created_on
3. 6.741 99,487.185 ↓ 3,925.0 3,925 1

Sort (cost=36,253.23..36,253.23 rows=1 width=16) (actual time=99,486.896..99,487.185 rows=3,925 loops=1)

  • Sort Key: r.id, p.id, rd.created_on
  • Sort Method: quicksort Memory: 280kB
4. 15.281 99,480.444 ↓ 3,925.0 3,925 1

Nested Loop Left Join (cost=6.01..36,253.22 rows=1 width=16) (actual time=68.823..99,480.444 rows=3,925 loops=1)

  • Filter: (1 = CASE WHEN ((r.review_type_id = ANY ('{21,47,13}'::integer[])) AND ((CASE WHEN (smad.deleted_on IS NULL) THEN 1 ELSE 0 END) = 1)) THEN 1 WHEN ((r.review_type_id <> ALL ('{21,47,13}'::integer[])) AND (smad.deleted_on IS NULL)) THEN 1 ELSE 0 END)
5. 9.856 1,540.338 ↓ 3,925.0 3,925 1

Nested Loop Left Join (cost=3.16..36,232.65 rows=1 width=28) (actual time=31.915..1,540.338 rows=3,925 loops=1)

6. 16.794 1,522.632 ↓ 3,925.0 3,925 1

Nested Loop (cost=3.01..36,232.32 rows=1 width=28) (actual time=31.908..1,522.632 rows=3,925 loops=1)

  • Join Filter: (r.review_type_id = rts.id)
  • Rows Removed by Join Filter: 11803
7. 8.358 1,497.988 ↓ 3,925.0 3,925 1

Nested Loop (cost=3.01..36,227.32 rows=1 width=28) (actual time=31.899..1,497.988 rows=3,925 loops=1)

  • Join Filter: (rd.property_id = p.id)
8. 11.005 1,466.080 ↓ 3,925.0 3,925 1

Nested Loop (cost=2.74..36,226.97 rows=1 width=36) (actual time=31.868..1,466.080 rows=3,925 loops=1)

  • Join Filter: ((rd.property_id = r.property_id) AND (rd.id = r.review_detail_id))
9. 21.858 289.350 ↓ 3,925.0 3,925 1

Nested Loop (cost=2.45..36,215.69 rows=1 width=36) (actual time=31.451..289.350 rows=3,925 loops=1)

  • Join Filter: (lp.property_id = rd.property_id)
10. 12.386 163.794 ↓ 283.3 17,283 1

Hash Join (cost=2.03..36,152.77 rows=61 width=20) (actual time=15.012..163.794 rows=17,283 loops=1)

  • Hash Cond: (rde.property_id = lp.property_id)
11. 137.361 137.361 ↑ 1.0 18,256 1

Seq Scan on review_detail_events rde (cost=0.00..36,077.94 rows=18,923 width=12) (actual time=0.947..137.361 rows=18,256 loops=1)

  • Filter: ((cid = 3482) AND (review_event_type_id = 16))
  • Rows Removed by Filter: 382160
12. 0.027 14.047 ↓ 171.0 171 1

Hash (cost=2.00..2.00 rows=1 width=8) (actual time=14.046..14.047 rows=171 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 15kB
13. 14.020 14.020 ↓ 171.0 171 1

Function Scan on load_properties lp (cost=0.25..2.00 rows=1 width=8) (actual time=13.984..14.020 rows=171 loops=1)

  • Filter: ((cid = 3482) AND (is_disabled = 0))
  • Rows Removed by Filter: 195
14. 103.698 103.698 ↓ 0.0 0 17,283

Index Scan using pk_review_details on review_details rd (cost=0.42..1.00 rows=1 width=20) (actual time=0.006..0.006 rows=0 loops=17,283)

  • Index Cond: ((cid = 3482) AND (id = rde.review_detail_id))
  • Filter: ((is_response_approved IS TRUE) AND (is_responded_to IS FALSE) AND (final_response IS NOT NULL) AND (rde.property_id = property_id) AND (((details -> 'hide_unpublished_response_on_dashboard'::text) = 'false'::jsonb) OR ((details -> 'hide_unpublished_response_on_dashboard'::text) IS NULL)))
  • Rows Removed by Filter: 1
15. 1,165.725 1,165.725 ↑ 1.0 1 3,925

Index Scan using idx_reviews_company_property_id on reviews r (cost=0.29..11.25 rows=1 width=20) (actual time=0.087..0.297 rows=1 loops=3,925)

  • Index Cond: (property_id = rde.property_id)
  • Filter: ((deleted_on IS NULL) AND (deleted_by IS NULL) AND (cid = 3482) AND (rde.review_detail_id = review_detail_id))
  • Rows Removed by Filter: 753
16. 23.550 23.550 ↑ 1.0 1 3,925

Index Only Scan using pk_properties on properties p (cost=0.27..0.32 rows=1 width=8) (actual time=0.006..0.006 rows=1 loops=3,925)

  • Index Cond: ((cid = 3482) AND (id = r.property_id))
  • Heap Fetches: 3925
17. 7.850 7.850 ↑ 12.0 4 3,925

Seq Scan on review_types rts (cost=0.00..3.44 rows=48 width=4) (actual time=0.002..0.002 rows=4 loops=3,925)

18. 7.850 7.850 ↓ 0.0 0 3,925

Index Scan using pk_review_tasks on review_tasks rt (cost=0.15..0.29 rows=1 width=16) (actual time=0.002..0.002 rows=0 loops=3,925)

  • Index Cond: ((cid = r.cid) AND (cid = 3482))
  • Filter: ((completed_on IS NULL) AND (deleted_on IS NULL) AND (review_task_type_id = 4) AND (property_id = r.property_id) AND (review_id = r.id))
19. 0.000 97,924.825 ↓ 0.0 0 3,925

Nested Loop (cost=2.84..20.53 rows=1 width=24) (actual time=24.949..24.949 rows=0 loops=3,925)

  • Join Filter: (r1.property_id = lp_1.property_id)
20. 1,201.050 3,446.150 ↓ 171.0 171 3,925

Nested Loop (cost=1.53..4.32 rows=1 width=16) (actual time=0.009..0.878 rows=171 loops=3,925)

21. 231.575 231.575 ↓ 171.0 171 3,925

Function Scan on load_properties lp_1 (cost=0.25..2.00 rows=1 width=8) (actual time=0.004..0.059 rows=171 loops=3,925)

  • Filter: ((cid = 3482) AND (is_disabled = 0))
  • Rows Removed by Filter: 195
22. 1,342.350 2,013.525 ↑ 1.0 1 671,175

Bitmap Heap Scan on properties p_1 (cost=1.28..2.32 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=671,175)

  • Recheck Cond: (id = lp_1.property_id)
  • Filter: (cid = 3482)
  • Heap Blocks: exact=894900
23. 671.175 671.175 ↑ 1.0 1 671,175

Bitmap Index Scan on idx_properties_id (cost=0.00..1.28 rows=1 width=0) (actual time=0.001..0.001 rows=1 loops=671,175)

  • Index Cond: (id = lp_1.property_id)
24. 3,983.875 94,635.675 ↓ 0.0 0 671,175

Hash Join (cost=1.31..16.18 rows=1 width=32) (actual time=0.141..0.141 rows=0 loops=671,175)

  • Hash Cond: (r1.property_id = smad.property_id)
  • Join Filter: ((r1.review_type_id = r.review_type_id) AND CASE WHEN (r1.review_type_id = ANY ('{21,47}'::integer[])) THEN (smad.social_post_type_id = 1) WHEN (r1.review_type_id = 13) THEN (smad.social_post_type_id = 3) ELSE NULL::boolean END)
  • Rows Removed by Join Filter: 0
25. 90,608.625 90,608.625 ↓ 1.4 65 671,175

Index Scan using idx_reviews_company_property_id on reviews r1 (cost=0.29..14.94 rows=47 width=12) (actual time=0.036..0.135 rows=65 loops=671,175)

  • Index Cond: (property_id = p_1.id)
  • Filter: ((cid = 3482) AND (review_type_id = ANY ('{21,47,13}'::integer[])))
  • Rows Removed by Filter: 293
26. 7.850 43.175 ↓ 0.0 0 3,925

Hash (cost=0.99..0.99 rows=1 width=24) (actual time=0.011..0.011 rows=0 loops=3,925)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
27. 35.325 35.325 ↓ 0.0 0 3,925

Index Scan using pk_social_media_account_details on social_media_account_details smad (cost=0.14..0.99 rows=1 width=24) (actual time=0.009..0.009 rows=0 loops=3,925)

  • Index Cond: ((cid = r.cid) AND (cid = 3482))
  • Filter: ((deleted_on IS NULL) AND (property_id = r.property_id))
  • Rows Removed by Filter: 20
Planning time : 9.409 ms
Execution time : 99,489.678 ms