explain.depesz.com

PostgreSQL's explain analyze made readable

Result: h8R0

Settings
# exclusive inclusive rows x rows loops node
1. 0.029 0.932 ↓ 2.6 60 1

Nested Loop Left Join (cost=22.62..135.83 rows=23 width=156) (actual time=0.150..0.932 rows=60 loops=1)

2.          

CTE filter_orders

3. 0.040 0.135 ↓ 3.4 54 1

Sort (cost=20.89..20.93 rows=16 width=32) (actual time=0.119..0.135 rows=54 loops=1)

  • Sort Key: orders_1.id DESC
  • Sort Method: quicksort Memory: 29kB
4. 0.095 0.095 ↓ 3.4 54 1

Index Scan using orders_application_user_id_state_id_created_at_idx_dba on orders orders_1 (cost=0.56..20.57 rows=16 width=32) (actual time=0.024..0.095 rows=54 loops=1)

  • Index Cond: ((application_user_id = 14358921) AND ((state)::text = ANY ('{arrive,finished}'::text[])) AND (created_at >= '2019-06-12 17:21:46.976176'::timestamp without time zone))
5. 0.011 0.795 ↓ 3.4 54 1

Nested Loop Left Join (cost=1.13..89.64 rows=16 width=128) (actual time=0.141..0.795 rows=54 loops=1)

6. 0.037 0.514 ↓ 3.4 54 1

Nested Loop Left Join (cost=0.56..45.00 rows=16 width=124) (actual time=0.131..0.514 rows=54 loops=1)

7. 0.153 0.153 ↓ 3.4 54 1

CTE Scan on filter_orders orders (cost=0.00..0.32 rows=16 width=110) (actual time=0.120..0.153 rows=54 loops=1)

8. 0.324 0.324 ↑ 1.0 1 54

Index Scan using orders_pkey on orders calculated (cost=0.56..2.78 rows=1 width=18) (actual time=0.006..0.006 rows=1 loops=54)

  • Index Cond: (order_id = orders.id)
9. 0.270 0.270 ↓ 0.0 0 54

Index Scan using order_discounts_order_id_index on order_discounts (cost=0.56..2.78 rows=1 width=8) (actual time=0.005..0.005 rows=0 loops=54)

  • Index Cond: (order_id = orders.id)
10. 0.108 0.108 ↓ 0.0 0 54

Index Scan using order_discount_details_order_discount_id_index_dba on order_discount_details (cost=0.56..1.43 rows=15 width=36) (actual time=0.002..0.002 rows=0 loops=54)

  • Index Cond: (order_discount_id = order_discounts.id)
Planning time : 0.581 ms
Execution time : 0.999 ms