explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 7w9C : Optimization for: Optimization for: Optimization for: plan #DvmL; plan #ktWN; plan #MZj

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.016 0.298 ↓ 1.8 7 1

Limit (cost=73.84..73.85 rows=4 width=221) (actual time=0.280..0.298 rows=7 loops=1)

2. 0.028 0.282 ↓ 1.8 7 1

Sort (cost=73.84..73.85 rows=4 width=221) (actual time=0.277..0.282 rows=7 loops=1)

  • Sort Key: (1), r.create_txtime
  • Sort Method: quicksort Memory: 26kB
3. 0.026 0.254 ↓ 1.8 7 1

HashAggregate (cost=73.76..73.80 rows=4 width=221) (actual time=0.247..0.254 rows=7 loops=1)

  • Group Key: r.id, r.recipient_id, r.user_id, r.status, r.score, r.comment, r.create_txtime, r.user_role, r.operation_type_id, r.external_id, r.item_id, r.item_title, r.stage_id, r.is_use_stars, r.category_id, r.shop_id, (1)
4. 0.027 0.228 ↓ 1.8 7 1

Append (cost=51.37..73.59 rows=4 width=221) (actual time=0.167..0.228 rows=7 loops=1)

5. 0.064 0.190 ↓ 1.7 5 1

Bitmap Heap Scan on reviews r (cost=51.37..60.98 rows=3 width=221) (actual time=0.165..0.190 rows=5 loops=1)

  • Recheck Cond: (((recipient_id = 121201089) AND (stage_id IS NULL) AND (status = 1)) OR (stage_id = ANY ('{1,2}'::integer[])))
  • Filter: (((recipient_id = 121201089) AND (status = 1) AND (shop_id IS NULL) AND (stage_id IS NULL)) OR (stage_id = ANY ('{1,2}'::integer[])))
  • Heap Blocks: exact=3
6. 0.003 0.126 ↓ 0.0 0 1

BitmapOr (cost=51.37..51.37 rows=3 width=0) (actual time=0.126..0.126 rows=0 loops=1)

7. 0.040 0.040 ↑ 1.5 2 1

Bitmap Index Scan on reviews_recipient_id_stage_id_status_index (cost=0.00..4.31 rows=3 width=0) (actual time=0.040..0.040 rows=2 loops=1)

  • Index Cond: ((recipient_id = 121201089) AND (stage_id IS NULL) AND (status = 1))
8. 0.083 0.083 ↓ 3.0 3 1

Bitmap Index Scan on reviews_recipient_id_stage_id_status_index (cost=0.00..47.05 rows=1 width=0) (actual time=0.083..0.083 rows=3 loops=1)

  • Index Cond: (stage_id = ANY ('{1,2}'::integer[]))
9. 0.011 0.011 ↓ 2.0 2 1

Index Scan using reviews_recipient_id_stage_id_status_index on reviews r_1 (cost=0.28..12.57 rows=1 width=221) (actual time=0.007..0.011 rows=2 loops=1)

  • Index Cond: ((recipient_id = 121201089) AND (stage_id = ANY ('{3,4}'::integer[])) AND (status = 1))
  • Filter: (shop_id IS NULL)