explain.depesz.com

PostgreSQL's explain analyze made readable

Result: y6qF

Settings
# exclusive inclusive rows x rows loops node
1. 0.598 20,629.794 ↑ 1.9 251 1

HashAggregate (cost=247,634.31..247,640.19 rows=470 width=620) (actual time=20,629.728..20,629.794 rows=251 loops=1)

  • Group Key: "*SELECT* 1".card_number, "*SELECT* 1".state, "*SELECT* 1".holder, "*SELECT* 1".recalculation, "*SELECT* 1".nomenclature_id
2. 0.039 20,629.196 ↑ 9.4 502 1

Append (cost=60,918.25..247,563.90 rows=4,694 width=620) (actual time=885.499..20,629.196 rows=502 loops=1)

3. 0.047 885.747 ↑ 18.4 251 1

Subquery Scan on *SELECT* 1 (cost=60,918.25..61,045.11 rows=4,613 width=620) (actual time=885.498..885.747 rows=251 loops=1)

4. 32.264 885.700 ↑ 18.4 251 1

HashAggregate (cost=60,918.25..60,998.98 rows=4,613 width=563) (actual time=885.497..885.700 rows=251 loops=1)

  • Group Key: cs.card_number, socs.name, cs.holder, cm.nomenclature_id
5. 7.272 853.436 ↓ 5.5 25,144 1

Nested Loop (cost=1.16..60,860.59 rows=4,613 width=563) (actual time=1.219..853.436 rows=25,144 loops=1)

6. 0.592 15.354 ↓ 1.4 251 1

Nested Loop Left Join (cost=0.73..1,998.63 rows=181 width=551) (actual time=0.049..15.354 rows=251 loops=1)

  • Join Filter: (cs.state = socs.id)
  • Rows Removed by Join Filter: 1506
7. 14.260 14.260 ↓ 1.4 251 1

Index Scan using cards_card_number_idx on cards cs (cost=0.73..1,978.54 rows=181 width=37) (actual time=0.033..14.260 rows=251 loops=1)

  • Index Cond: ((card_number)::text = ANY ('{0250125486,0490210402,0495046482,0497496674,0505645042,0506602994,0506887922,0506986994,0507425506,0513133538,0517517282,0518894322,0575988245,0578441253,0578825253,0579423301,0579450645,0581405205,0582538005,0583039253,0807807602,0809216610,0813228386,0813641586,0813945186,0814383458,0816494434,0817226594,0823900769,0826447201,0831712609,1047520346,1047520906,1047523034,1047527162,1047527610,1047537722,1047565386,1047575562,1047581610,1047584906,1047587434,1047595690,1047599770,1047601930,1047605514,1047609370,1047620362,1047622042,1047622522,1047632010,1047634250,1047636042,1047647738,1047650314,1047656762,1047657482,1047676234,1047676618,1047676714,1047678154,1047689066,1047689546,1047690890,1047693610,1047695050,1047695434,1047696490,1047721290,1047767098,1047767178,1047771818,1047780906,1047782394,1047789130,1047792522,1047793482,1047800906,1047804586,1047804954,1047814970,1047816154,1047818410,1047819210,1047819882,1047820266,1047820410,1047822874,1047822890,1047823866,1047824602,1047825594,1047826026,1047828074,1047832618,1047833546,1047836922,1047838362,1047843946,1047857098,1047859834,1047861322,1047874522,1047883658,1047884378,1047885194,1047892906,1047901370,1320323034,1320442330,1321066874,1321069610,1321070074,1321071082,1321072890,1321075546,1321078394,1321078874,1321079114,1321079514,1321079946,1321082314,1321086154,1321088586,1321090442,1321091098,1321092538,1321092714,1321093706,1321095850,1321102538,1321103882,1321106458,1321113818,1321114970,1321115130,1321115226,1321117322,1321120426,1321122346,1321123194,1321124522,1321128442,1321134154,1321134938,1321135226,1321139834,1321141226,1321144650,1321146906,1321147514,1321172154,1321173530,1321185066,1321185626,1321189466,1321189482,1321190154,1321190506,1321192506,1321192538,1321192842,1321196618,1321198234,1321198538,1321201690,1321202618,1321203402,1321211290,1321211546,1321215850,1321217482,1321218394,1321219066,1321224394,1321224970,1321226170,1321227754,1321234810,1321236378,1321238058,1321239530,1321241338,1321246298,1321255690,1321256586,1321256922,1321259754,1321261178,1321262378,1321264826,1321267050,1321267546,1321269450,1321270362,1321270378,1321274074,1321275642,1321275882,1321276394,1321277802,1321278810,1321279290,1321279546,1321279578,1321279610,1321279850,1321280010,1321280570,1321280970,1321281050,1321287754,1321290522,1321295754,1321296314,1321298714,1321298874,1321302282,1321306938,1321314618,1321315002,1321322074,1321326762,1321328426,1321330058,1321331818,1321334538,1321337706,1321346154,1321351770,1321352234,1321352250,1321353610,1321356346,1321358682,1321360298,1321365034,1321368090,1321369722,1321375642,1321377866,1321379914,1321387146,1321388938,1321403802,1321411178,1321429802,1321438570,1321441434,1321443914,1321449018}'::text[]))
  • Filter: ((work_scheme = 1) AND (deleted = 0))
8. 0.496 0.502 ↑ 1.0 7 251

Materialize (cost=0.00..1.10 rows=7 width=518) (actual time=0.000..0.002 rows=7 loops=251)

9. 0.006 0.006 ↑ 1.0 7 1

Seq Scan on set_of_card_statuses socs (cost=0.00..1.07 rows=7 width=518) (actual time=0.004..0.006 rows=7 loops=1)

10. 830.810 830.810 ↓ 1.4 100 251

Index Scan using card_moneybag_history_card_number_idx on card_moneybag_history cm (cost=0.43..324.47 rows=73 width=23) (actual time=0.323..3.310 rows=100 loops=251)

  • Index Cond: ((card_number)::text = (cs.card_number)::text)
  • Filter: ((action = ANY ('{9,10}'::integer[])) AND (date_start <= '2019-11-28'::date))
  • Rows Removed by Filter: 19
11. 0.027 19,743.410 ↓ 3.1 251 1

Subquery Scan on *SELECT* 2 (cost=186,516.56..186,518.79 rows=81 width=621) (actual time=19,743.200..19,743.410 rows=251 loops=1)

12. 194.391 19,743.383 ↓ 3.1 251 1

HashAggregate (cost=186,516.56..186,517.98 rows=81 width=564) (actual time=19,743.199..19,743.383 rows=251 loops=1)

  • Group Key: cs_1.card_number, socs_1.name, cs_1.holder, tn.written_off_nomenclature_id
13. 138.092 19,548.992 ↓ 413.0 66,906 1

Nested Loop Left Join (cost=1.60..186,514.54 rows=162 width=564) (actual time=2.432..19,548.992 rows=66,906 loops=1)

  • Join Filter: (cs_1.state = socs_1.id)
  • Rows Removed by Join Filter: 401436
14. 101.178 19,343.994 ↓ 413.0 66,906 1

Nested Loop (cost=1.60..186,496.44 rows=162 width=50) (actual time=2.407..19,343.994 rows=66,906 loops=1)

15. 7.431 7.431 ↓ 1.4 251 1

Index Scan using cards_card_number_idx on cards cs_1 (cost=0.73..1,978.54 rows=181 width=37) (actual time=0.025..7.431 rows=251 loops=1)

  • Index Cond: ((card_number)::text = ANY ('{0250125486,0490210402,0495046482,0497496674,0505645042,0506602994,0506887922,0506986994,0507425506,0513133538,0517517282,0518894322,0575988245,0578441253,0578825253,0579423301,0579450645,0581405205,0582538005,0583039253,0807807602,0809216610,0813228386,0813641586,0813945186,0814383458,0816494434,0817226594,0823900769,0826447201,0831712609,1047520346,1047520906,1047523034,1047527162,1047527610,1047537722,1047565386,1047575562,1047581610,1047584906,1047587434,1047595690,1047599770,1047601930,1047605514,1047609370,1047620362,1047622042,1047622522,1047632010,1047634250,1047636042,1047647738,1047650314,1047656762,1047657482,1047676234,1047676618,1047676714,1047678154,1047689066,1047689546,1047690890,1047693610,1047695050,1047695434,1047696490,1047721290,1047767098,1047767178,1047771818,1047780906,1047782394,1047789130,1047792522,1047793482,1047800906,1047804586,1047804954,1047814970,1047816154,1047818410,1047819210,1047819882,1047820266,1047820410,1047822874,1047822890,1047823866,1047824602,1047825594,1047826026,1047828074,1047832618,1047833546,1047836922,1047838362,1047843946,1047857098,1047859834,1047861322,1047874522,1047883658,1047884378,1047885194,1047892906,1047901370,1320323034,1320442330,1321066874,1321069610,1321070074,1321071082,1321072890,1321075546,1321078394,1321078874,1321079114,1321079514,1321079946,1321082314,1321086154,1321088586,1321090442,1321091098,1321092538,1321092714,1321093706,1321095850,1321102538,1321103882,1321106458,1321113818,1321114970,1321115130,1321115226,1321117322,1321120426,1321122346,1321123194,1321124522,1321128442,1321134154,1321134938,1321135226,1321139834,1321141226,1321144650,1321146906,1321147514,1321172154,1321173530,1321185066,1321185626,1321189466,1321189482,1321190154,1321190506,1321192506,1321192538,1321192842,1321196618,1321198234,1321198538,1321201690,1321202618,1321203402,1321211290,1321211546,1321215850,1321217482,1321218394,1321219066,1321224394,1321224970,1321226170,1321227754,1321234810,1321236378,1321238058,1321239530,1321241338,1321246298,1321255690,1321256586,1321256922,1321259754,1321261178,1321262378,1321264826,1321267050,1321267546,1321269450,1321270362,1321270378,1321274074,1321275642,1321275882,1321276394,1321277802,1321278810,1321279290,1321279546,1321279578,1321279610,1321279850,1321280010,1321280570,1321280970,1321281050,1321287754,1321290522,1321295754,1321296314,1321298714,1321298874,1321302282,1321306938,1321314618,1321315002,1321322074,1321326762,1321328426,1321330058,1321331818,1321334538,1321337706,1321346154,1321351770,1321352234,1321352250,1321353610,1321356346,1321358682,1321360298,1321365034,1321368090,1321369722,1321375642,1321377866,1321379914,1321387146,1321388938,1321403802,1321411178,1321429802,1321438570,1321441434,1321443914,1321449018}'::text[]))
  • Filter: ((work_scheme = 1) AND (deleted = 0))
16. 19,235.385 19,235.385 ↓ 133.5 267 251

Index Scan using transactions_new_entity_number_written_off_nomenclature_id_idx on transactions_new tn (cost=0.87..1,019.42 rows=2 width=24) (actual time=0.307..76.635 rows=267 loops=251)

  • Index Cond: (((entity_number)::text = (cs_1.card_number)::text) AND ((entity_number)::text = ANY ('{0250125486,0490210402,0495046482,0497496674,0505645042,0506602994,0506887922,0506986994,0507425506,0513133538,0517517282,0518894322,0575988245,0578441253,0578825253,0579423301,0579450645,0581405205,0582538005,0583039253,0807807602,0809216610,0813228386,0813641586,0813945186,0814383458,0816494434,0817226594,0823900769,0826447201,0831712609,1047520346,1047520906,1047523034,1047527162,1047527610,1047537722,1047565386,1047575562,1047581610,1047584906,1047587434,1047595690,1047599770,1047601930,1047605514,1047609370,1047620362,1047622042,1047622522,1047632010,1047634250,1047636042,1047647738,1047650314,1047656762,1047657482,1047676234,1047676618,1047676714,1047678154,1047689066,1047689546,1047690890,1047693610,1047695050,1047695434,1047696490,1047721290,1047767098,1047767178,1047771818,1047780906,1047782394,1047789130,1047792522,1047793482,1047800906,1047804586,1047804954,1047814970,1047816154,1047818410,1047819210,1047819882,1047820266,1047820410,1047822874,1047822890,1047823866,1047824602,1047825594,1047826026,1047828074,1047832618,1047833546,1047836922,1047838362,1047843946,1047857098,1047859834,1047861322,1047874522,1047883658,1047884378,1047885194,1047892906,1047901370,1320323034,1320442330,1321066874,1321069610,1321070074,1321071082,1321072890,1321075546,1321078394,1321078874,1321079114,1321079514,1321079946,1321082314,1321086154,1321088586,1321090442,1321091098,1321092538,1321092714,1321093706,1321095850,1321102538,1321103882,1321106458,1321113818,1321114970,1321115130,1321115226,1321117322,1321120426,1321122346,1321123194,1321124522,1321128442,1321134154,1321134938,1321135226,1321139834,1321141226,1321144650,1321146906,1321147514,1321172154,1321173530,1321185066,1321185626,1321189466,1321189482,1321190154,1321190506,1321192506,1321192538,1321192842,1321196618,1321198234,1321198538,1321201690,1321202618,1321203402,1321211290,1321211546,1321215850,1321217482,1321218394,1321219066,1321224394,1321224970,1321226170,1321227754,1321234810,1321236378,1321238058,1321239530,1321241338,1321246298,1321255690,1321256586,1321256922,1321259754,1321261178,1321262378,1321264826,1321267050,1321267546,1321269450,1321270362,1321270378,1321274074,1321275642,1321275882,1321276394,1321277802,1321278810,1321279290,1321279546,1321279578,1321279610,1321279850,1321280010,1321280570,1321280970,1321281050,1321287754,1321290522,1321295754,1321296314,1321298714,1321298874,1321302282,1321306938,1321314618,1321315002,1321322074,1321326762,1321328426,1321330058,1321331818,1321334538,1321337706,1321346154,1321351770,1321352234,1321352250,1321353610,1321356346,1321358682,1321360298,1321365034,1321368090,1321369722,1321375642,1321377866,1321379914,1321387146,1321388938,1321403802,1321411178,1321429802,1321438570,1321441434,1321443914,1321449018}'::text[])))
  • Filter: ((state_id = ANY ('{1,3}'::integer[])) AND (transaction_type = ANY ('{1,2}'::integer[])) AND (transaction_date <= '2019-11-28'::date))
17. 66.898 66.906 ↑ 1.0 7 66,906

Materialize (cost=0.00..1.10 rows=7 width=518) (actual time=0.000..0.001 rows=7 loops=66,906)

18. 0.008 0.008 ↑ 1.0 7 1

Seq Scan on set_of_card_statuses socs_1 (cost=0.00..1.07 rows=7 width=518) (actual time=0.005..0.008 rows=7 loops=1)

Planning time : 28.176 ms