explain.depesz.com

PostgreSQL's explain analyze made readable

Result: RQpO

Settings
# exclusive inclusive rows x rows loops node
1. 0.008 0.358 ↓ 3.0 3 1

GroupAggregate (cost=101.60..102.94 rows=1 width=74) (actual time=0.356..0.358 rows=3 loops=1)

  • Group Key: discounts_discount.id, ((SubPlan 1))
2. 0.035 0.350 ↓ 3.0 3 1

Sort (cost=101.60..101.61 rows=1 width=70) (actual time=0.349..0.350 rows=3 loops=1)

  • Sort Key: discounts_discount.id, ((SubPlan 1))
  • Sort Method: quicksort Memory: 25kB
3. 0.008 0.315 ↓ 3.0 3 1

Nested Loop (cost=88.87..101.59 rows=1 width=70) (actual time=0.206..0.315 rows=3 loops=1)

4. 0.047 0.181 ↓ 3.0 3 1

Hash Join (cost=88.73..93.38 rows=1 width=20) (actual time=0.135..0.181 rows=3 loops=1)

  • Hash Cond: (discounts_discount_order_relation.order_id = essays_order.id)
5. 0.038 0.038 ↑ 1.0 210 1

Seq Scan on discounts_discount_order_relation (cost=0.00..4.10 rows=210 width=20) (actual time=0.013..0.038 rows=210 loops=1)

6. 0.014 0.096 ↑ 1.0 33 1

Hash (cost=88.31..88.31 rows=33 width=8) (actual time=0.096..0.096 rows=33 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
7. 0.082 0.082 ↑ 1.0 33 1

Index Scan using essays_order_customer_id_idx on essays_order (cost=0.28..88.31 rows=33 width=8) (actual time=0.020..0.082 rows=33 loops=1)

  • Index Cond: (customer_id = 502)
8. 0.021 0.102 ↑ 1.0 1 3

Index Scan using discounts_discount_pkey on discounts_discount (cost=0.14..6.89 rows=1 width=26) (actual time=0.034..0.034 rows=1 loops=3)

  • Index Cond: (id = discounts_discount_order_relation.discount_id)
  • Filter: (NOT (SubPlan 2))
9.          

SubPlan (for Index Scan)

10. 0.006 0.081 ↓ 0.0 0 3

Nested Loop (cost=0.28..12.94 rows=1 width=4) (actual time=0.027..0.027 rows=0 loops=3)

11. 0.051 0.051 ↑ 1.0 1 3

Seq Scan on discounts_discount_order_relation u1 (cost=0.00..4.62 rows=1 width=12) (actual time=0.004..0.017 rows=1 loops=3)

  • Filter: (order_id = discounts_discount_order_relation.order_id)
  • Rows Removed by Filter: 209
12. 0.024 0.024 ↓ 0.0 0 3

Index Scan using essays_order_pkey on essays_order u2 (cost=0.28..8.30 rows=1 width=8) (actual time=0.008..0.008 rows=0 loops=3)

  • Index Cond: (id = discounts_discount_order_relation.order_id)
  • Filter: (paid_status = 'not_paid'::status_payment)
  • Rows Removed by Filter: 1
13.          

SubPlan (for Nested Loop)

14. 0.006 0.024 ↑ 1.0 1 3

Aggregate (cost=1.30..1.31 rows=1 width=32) (actual time=0.008..0.008 rows=1 loops=3)

15. 0.018 0.018 ↓ 0.0 0 3

Seq Scan on discounts_additional_service_relation (cost=0.00..1.30 rows=1 width=4) (actual time=0.006..0.006 rows=0 loops=3)

  • Filter: (discount_id = discounts_discount.id)
  • Rows Removed by Filter: 24
Planning time : 4.288 ms
Execution time : 1.551 ms