explain.depesz.com

PostgreSQL's explain analyze made readable

Result: D2y3

Settings
# exclusive inclusive rows x rows loops node
1. 0.036 643.167 ↑ 1.0 200 1

Limit (cost=308,149.81..308,150.31 rows=200 width=1,772) (actual time=643.043..643.167 rows=200 loops=1)

  • Buffers: shared hit=61689
2. 4.238 643.131 ↑ 24.9 200 1

Sort (cost=308,149.81..308,162.26 rows=4,979 width=1,772) (actual time=643.041..643.131 rows=200 loops=1)

  • Sort Key: document_base.number_value, document_base.number, document_base.id
  • Sort Method: top-N heapsort Memory: 287kB
  • Buffers: shared hit=61689
3. 0.955 638.893 ↑ 6.4 775 1

Nested Loop (cost=200,179.18..307,934.62 rows=4,979 width=1,772) (actual time=271.652..638.893 rows=775 loops=1)

  • Buffers: shared hit=61689
4. 1.037 637.938 ↑ 6.4 775 1

Nested Loop (cost=200,178.76..300,527.8 rows=4,979 width=1,734) (actual time=271.648..637.938 rows=775 loops=1)

  • Buffers: shared hit=61689
5. 0.715 636.901 ↑ 6.4 775 1

Hash Join (cost=200,178.33..280,704.86 rows=4,979 width=1,583) (actual time=271.637..636.901 rows=775 loops=1)

  • Buffers: shared hit=61689
6. 0.831 636.183 ↑ 6.4 775 1

Hash Join (cost=200,162.26..280,664.17 rows=4,979 width=1,317) (actual time=271.612..636.183 rows=775 loops=1)

  • Buffers: shared hit=61689
7. 1.917 635.343 ↑ 6.4 775 1

Hash Join (cost=200,101.41..280,584.64 rows=4,979 width=1,309) (actual time=271.542..635.343 rows=775 loops=1)

  • Buffers: shared hit=61689
8. 1.358 576.648 ↑ 6.4 775 1

Nested Loop (cost=197,761.2..278,200.01 rows=4,979 width=1,186) (actual time=214.399..576.648 rows=775 loops=1)

  • Buffers: shared hit=60597
9. 1.300 572.190 ↑ 6.4 775 1

Nested Loop (cost=197,760.77..266,240.7 rows=4,979 width=993) (actual time=214.384..572.19 rows=775 loops=1)

  • Buffers: shared hit=57606
10. 1.148 567.015 ↑ 6.4 775 1

Nested Loop (cost=197,760.35..258,346.54 rows=4,979 width=754) (actual time=214.37..567.015 rows=775 loops=1)

  • Buffers: shared hit=54941
11. 1.132 561.217 ↑ 6.4 775 1

Nested Loop (cost=197,759.92..245,031.06 rows=4,979 width=590) (actual time=214.356..561.217 rows=775 loops=1)

  • Buffers: shared hit=51839
12. 0.637 556.210 ↑ 6.4 775 1

Hash Join (cost=197,759.5..236,864.59 rows=4,979 width=483) (actual time=214.334..556.21 rows=775 loops=1)

  • Buffers: shared hit=48738
13. 1.187 553.883 ↑ 6.4 775 1

Nested Loop (cost=197,662.35..236,748.54 rows=4,979 width=392) (actual time=212.599..553.883 rows=775 loops=1)

  • Buffers: shared hit=48698
14. 263.698 548.046 ↑ 6.4 775 1

Hash Join (cost=197,661.92..221,450.37 rows=4,979 width=240) (actual time=212.575..548.046 rows=775 loops=1)

  • Buffers: shared hit=45596
15. 132.817 132.817 ↓ 1.0 1,096,485 1

Seq Scan on document_invoice document_invoice (cost=0..19,626.84 rows=1,096,484 width=47) (actual time=0.014..132.817 rows=1,096,485 loops=1)

  • Buffers: shared hit=8662
16. 36.645 151.531 ↑ 1.5 47,215 1

Hash (cost=196,788.01..196,788.01 rows=69,913 width=193) (actual time=151.53..151.531 rows=47,215 loops=1)

  • Buffers: shared hit=36934
17. 103.410 114.886 ↑ 1.5 47,215 1

Bitmap Heap Scan on document_base document_base (cost=2,150.45..196,788.01 rows=69,913 width=193) (actual time=19.31..114.886 rows=47,215 loops=1)

  • Buffers: shared hit=36934
18. 11.476 11.476 ↑ 1.5 47,215 1

Bitmap Index Scan on document_base_ent_id_date_formatting_state_type_idx (cost=0..2,132.97 rows=69,913 width=0) (actual time=11.476..11.476 rows=47,215 loops=1)

  • Index Cond: ((document_base.ent_id = ANY ('{8210,8211,1086,1599,1600,1608,1609,1610,1611,1612,1626,1627,1628,1634,1636,1639,1640,1641,1642,1643,1677,1680,1686,1687,1221,1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235,1236,1237,1238,1239,1240,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250,1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,1266,1267,1268,1269,837,838,839,843,844,845,847,851,853,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,1421,1422,1423,1433}'::bigint[])) AND (document_base.date_formatting <= '2019-12-31'::date) AND (document_base.date_formatting >= '2019-01-01'::date))
  • Buffers: shared hit=768
19. 4.650 4.650 ↑ 1.0 1 775

Index Scan using document_types_pkey on document_types document_types (cost=0.43..3.06 rows=1 width=152) (actual time=0.006..0.006 rows=1 loops=775)

  • Index Cond: (document_types.id = document_base.type_id)
  • Buffers: shared hit=3102
20. 0.969 1.690 ↑ 1.0 2,540 1

Hash (cost=65.4..65.4 rows=2,540 width=91) (actual time=1.69..1.69 rows=2,540 loops=1)

  • Buffers: shared hit=40
21. 0.721 0.721 ↑ 1.0 2,540 1

Seq Scan on dicts_department dicts_department (cost=0..65.4 rows=2,540 width=91) (actual time=0.012..0.721 rows=2,540 loops=1)

  • Buffers: shared hit=40
22. 3.875 3.875 ↑ 1.0 1 775

Index Scan using contragent_mol_pkey on contragent_mol contragent_mol (cost=0.42..1.63 rows=1 width=107) (actual time=0.005..0.005 rows=1 loops=775)

  • Index Cond: (document_base.mol_id = contragent_mol.id)
  • Buffers: shared hit=3101
23. 4.650 4.650 ↑ 1.0 1 775

Index Scan using contragent_supplier_pkey on contragent_supplier contragent_supplier (cost=0.43..2.66 rows=1 width=164) (actual time=0.006..0.006 rows=1 loops=775)

  • Index Cond: (document_base.supplier_id = contragent_supplier.id)
  • Buffers: shared hit=3102
24. 3.875 3.875 ↑ 1.0 1 775

Index Scan using contragent_corporation_pkey on contragent_corporation contragent_corporation (cost=0.42..1.58 rows=1 width=239) (actual time=0.005..0.005 rows=1 loops=775)

  • Index Cond: (contragent_supplier.corporation_id = contragent_corporation.id)
  • Buffers: shared hit=2665
25. 3.100 3.100 ↑ 1.0 1 775

Index Scan using kbk_pkey on kbk kbk (cost=0.42..2.39 rows=1 width=193) (actual time=0.004..0.004 rows=1 loops=775)

  • Index Cond: (document_base.kbk_id = kbk.id)
  • Buffers: shared hit=2991
26. 33.526 56.778 ↑ 1.0 55,476 1

Hash (cost=1,646.76..1,646.76 rows=55,476 width=123) (actual time=56.778..56.778 rows=55,476 loops=1)

  • Buffers: shared hit=1092
27. 23.252 23.252 ↑ 1.0 55,476 1

Seq Scan on kbk_activity_type kbk_activity_type (cost=0..1,646.76 rows=55,476 width=123) (actual time=0.018..23.252 rows=55,476 loops=1)

  • Buffers: shared hit=1092
28. 0.002 0.009 ↓ 0.0 0 1

Hash (cost=32.6..32.6 rows=2,260 width=8) (actual time=0.009..0.009 rows=0 loops=1)

29. 0.007 0.007 ↓ 0.0 0 1

Seq Scan on external_relation_with_document external_relation_with_document (cost=0..32.6 rows=2,260 width=8) (actual time=0.007..0.007 rows=0 loops=1)

30. 0.000 0.003 ↓ 0.0 0 1

Hash (cost=12.7..12.7 rows=270 width=266) (actual time=0.003..0.003 rows=0 loops=1)

31. 0.003 0.003 ↓ 0.0 0 1

Seq Scan on doc_external_relation doc_external_relation (cost=0..12.7 rows=270 width=266) (actual time=0.003..0.003 rows=0 loops=1)

32. 0.000 0.000 ↓ 0.0 0 775

Index Scan using unidictrec_pkey on unidictrec unidictrec (cost=0.43..3.97 rows=1 width=151) (actual time=0..0 rows=0 loops=775)

  • Index Cond: (document_base.kvd_analytic_id = unidictrec.id)
33. 0.000 0.000 ↓ 0.0 0 775

Index Scan using contract_pkey on contract contract (cost=0.42..1.48 rows=1 width=38) (actual time=0..0 rows=0 loops=775)

  • Index Cond: (document_invoice.contract_id = contract.id)