explain.depesz.com

A tool for finding a real cause for slow queries.

Result: nh5B

options
Did it help? Consider supporting us - Bitcoin address: 12v2hUztAk2LgzQ9H9LMwuU32urHMjZQnq
# exclusive inclusive rows x rows loops node
1. 0.005 4,274.779 ↑ 1.0 10 1

Limit (cost=0.00..22,241.91 rows=10 width=4) (actual time=4,166.847..4,274.779 rows=10 loops=1)

2. 0.017 4,274.774 ↑ 20.0 10 1

Group (cost=0.00..444,838.14 rows=200 width=4) (actual time=4,166.845..4,274.774 rows=10 loops=1)

3. 40.222 4,274.757 ↑ 122.3 20 1

Nested Loop (cost=0.00..444,832.02 rows=2,446 width=4) (actual time=4,166.843..4,274.757 rows=20 loops=1)

  • Join Filter: (cp.product_id = bp.id)
4. 0.044 0.235 ↑ 26.0 20 1

Nested Loop (cost=0.00..1,678.46 rows=520 width=4) (actual time=0.117..0.235 rows=20 loops=1)

5. 0.095 0.095 ↑ 155.7 32 1

Index Scan using channels_products_product_id_idx on channels_products cp (cost=0.00..218.64 rows=4,982 width=8) (actual time=0.036..0.095 rows=32 loops=1)

6. 0.096 0.096 ↑ 1.0 1 32

Index Scan using channels_pkey on channels (cost=0.00..0.28 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=32)

  • Index Cond: (id = cp.channel_id)
  • Filter: (site_id = 2)
7. 27.984 4,234.300 ↑ 1.0 17,638 20

Materialize (cost=0.00..305,106.63 rows=17,704 width=4) (actual time=0.199..211.715 rows=17,638 loops=20)

8. 6.549 4,206.316 ↑ 1.0 17,704 1

Subquery Scan on bp (cost=0.00..305,018.11 rows=17,704 width=4) (actual time=3.971..4,206.316 rows=17,704 loops=1)

9. 4,111.247 4,199.767 ↑ 1.0 17,704 1

Seq Scan on products p (cost=0.00..304,841.07 rows=17,704 width=750) (actual time=3.969..4,199.767 rows=17,704 loops=1)

10.          

SubPlan (forSeq Scan)

11. 17.704 88.520 ↑ 1.0 1 17,704

Aggregate (cost=16.56..16.57 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=17,704)

12. 2.758 70.816 ↓ 0.0 0 17,704

Nested Loop (cost=0.00..16.56 rows=1 width=8) (actual time=0.004..0.004 rows=0 loops=17,704)

13. 53.112 53.112 ↓ 0.0 0 17,704

Index Scan using channels_products_product_id_idx on channels_products cp (cost=0.00..8.27 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=17,704)

  • Index Cond: (product_id = p.id)
14. 14.946 14.946 ↓ 0.0 0 4,982

Index Scan using channels_pkey on channels (cost=0.00..8.28 rows=1 width=12) (actual time=0.003..0.003 rows=0 loops=4,982)

  • Index Cond: (id = cp.channel_id)
  • Filter: ((start_at < now()) AND ((end_at IS NULL) OR (end_at > now())))