explain.depesz.com

PostgreSQL's explain analyze made readable

Result: vkrx

Settings
# exclusive inclusive rows x rows loops node
1. 0.004 10,921.523 ↑ 8.0 1 1

Append (cost=406.93..2,717.99 rows=8 width=40) (actual time=10,921.522..10,921.523 rows=1 loops=1)

2. 0.002 25.277 ↓ 0.0 0 1

HashAggregate (cost=406.93..407.00 rows=6 width=21) (actual time=25.277..25.277 rows=0 loops=1)

  • Group Key: card_moneybag.nomenclature_id
3. 0.002 25.275 ↓ 0.0 0 1

Nested Loop (cost=0.84..406.90 rows=6 width=21) (actual time=25.275..25.275 rows=0 loops=1)

4. 25.273 25.273 ↓ 0.0 0 1

Index Scan using cards_card_number_idx on cards c (cost=0.42..8.44 rows=1 width=0) (actual time=25.273..25.273 rows=0 loops=1)

  • Index Cond: ((card_number)::text = '0882310685'::text)
  • Filter: (work_scheme = 2)
  • Rows Removed by Filter: 1
5. 0.000 0.000 ↓ 0.0 0

Append (cost=0.42..398.40 rows=6 width=21) (never executed)

6. 0.000 0.000 ↓ 0.0 0

Index Scan using card_moneybag_pkey on card_moneybag (cost=0.42..20.12 rows=4 width=12) (never executed)

  • Index Cond: ((card_number)::text = '0882310685'::text)
7. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=338.24..338.26 rows=1 width=12) (never executed)

  • Group Key: card_moneybag_history.nomenclature_id
8. 0.000 0.000 ↓ 0.0 0

Index Scan using card_moneybag_history_card_number_idx on card_moneybag_history (cost=0.43..338.24 rows=1 width=12) (never executed)

  • Index Cond: ((card_number)::text = '0882310685'::text)
  • Filter: ((date_start >= '2019-11-01'::date) AND (date_start <= '2019-11-29'::date) AND (action = 3))
9. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=39.95..39.97 rows=1 width=13) (never executed)

  • Group Key: transactions_new.written_off_nomenclature_id
10. 0.000 0.000 ↓ 0.0 0

Index Scan using transactions_new_pkey on transactions_new (cost=0.56..39.94 rows=2 width=13) (never executed)

  • Index Cond: (((entity_number)::text = '0882310685'::text) AND (transaction_date >= '2019-11-01'::date) AND (transaction_date <= '2019-11-29'::date) AND (state_id = 1))
  • Filter: ((transaction_type = 1) OR (shipping_type = 655))
11. 0.010 10,896.242 ↑ 2.0 1 1

GroupAggregate (cost=339.41..2,310.90 rows=2 width=40) (actual time=10,896.242..10,896.242 rows=1 loops=1)

  • Group Key: card_moneybag_history_1.nomenclature_id
12. 0.007 10,896.232 ↑ 1.0 2 1

Nested Loop (cost=339.41..2,310.87 rows=2 width=40) (actual time=10,896.224..10,896.232 rows=2 loops=1)

13. 0.013 10,896.177 ↑ 1.0 2 1

Merge Append (cost=338.99..2,302.40 rows=2 width=40) (actual time=10,896.174..10,896.177 rows=2 loops=1)

  • Sort Key: card_moneybag_history_1.nomenclature_id
14. 0.028 1,255.006 ↑ 1.0 1 1

Sort (cost=338.42..338.42 rows=1 width=39) (actual time=1,255.004..1,255.006 rows=1 loops=1)

  • Sort Key: card_moneybag_history_1.nomenclature_id
  • Sort Method: quicksort Memory: 25kB
15. 3.834 1,254.978 ↑ 1.0 1 1

HashAggregate (cost=338.38..338.40 rows=1 width=12) (actual time=1,254.977..1,254.978 rows=1 loops=1)

  • Group Key: card_moneybag_history_1.nomenclature_id
16. 1,251.144 1,251.144 ↓ 3.3 242 1

Index Scan using card_moneybag_history_card_number_idx on card_moneybag_history card_moneybag_history_1 (cost=0.43..338.01 rows=74 width=12) (actual time=33.286..1,251.144 rows=242 loops=1)

  • Index Cond: ((card_number)::text = '0882310685'::text)
  • Filter: ((action = ANY ('{9,10}'::integer[])) AND (date_start <= '2019-11-29'::date))
  • Rows Removed by Filter: 18
17. 26.182 9,641.158 ↑ 1.0 1 1

GroupAggregate (cost=0.56..1,963.93 rows=1 width=13) (actual time=9,641.158..9,641.158 rows=1 loops=1)

  • Group Key: transactions_new_1.written_off_nomenclature_id
18. 9,614.976 9,614.976 ↓ 5.0 2,485 1

Index Scan using transactions_new_entity_number_written_off_nomenclature_id_idx on transactions_new transactions_new_1 (cost=0.56..1,961.44 rows=496 width=13) (actual time=34.894..9,614.976 rows=2,485 loops=1)

  • Index Cond: ((entity_number)::text = '0882310685'::text)
  • Filter: ((transaction_date <= '2019-11-29'::date) AND (state_id = 1) AND ((transaction_type = 1) OR (shipping_type = 655)))
  • Rows Removed by Filter: 4
19. 0.007 0.048 ↑ 1.0 1 2

Materialize (cost=0.42..8.45 rows=1 width=0) (actual time=0.023..0.024 rows=1 loops=2)

20. 0.041 0.041 ↑ 1.0 1 1

Index Scan using cards_card_number_idx on cards c_1 (cost=0.42..8.44 rows=1 width=0) (actual time=0.040..0.041 rows=1 loops=1)

  • Index Cond: ((card_number)::text = '0882310685'::text)
  • Filter: (work_scheme = 1)
Planning time : 3.865 ms