explain.depesz.com

PostgreSQL's explain analyze made readable

Result: OzXd

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.050 663.749 ↑ 1.0 200 1

Limit (cost=308,432.83..308,433.33 rows=200 width=1,772) (actual time=663.578..663.749 rows=200 loops=1)

  • Buffers: shared hit=61680
2. 4.429 663.699 ↑ 24.9 200 1

Sort (cost=308,432.83..308,445.27 rows=4,979 width=1,772) (actual time=663.576..663.699 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=61680
3. 0.948 659.270 ↑ 6.4 775 1

Nested Loop (cost=200,462.19..308,217.64 rows=4,979 width=1,772) (actual time=289.028..659.27 rows=775 loops=1)

  • Buffers: shared hit=61680
4. 1.057 658.322 ↑ 6.4 775 1

Nested Loop (cost=200,461.77..300,810.81 rows=4,979 width=1,734) (actual time=289.021..658.322 rows=775 loops=1)

  • Buffers: shared hit=61680
5. 0.734 657.265 ↑ 6.4 775 1

Hash Join (cost=200,461.34..280,987.87 rows=4,979 width=1,583) (actual time=289.009..657.265 rows=775 loops=1)

  • Buffers: shared hit=61680
6. 0.827 656.527 ↑ 6.4 775 1

Hash Join (cost=200,445.27..280,947.18 rows=4,979 width=1,317) (actual time=288.982..656.527 rows=775 loops=1)

  • Buffers: shared hit=61680
7. 1.797 655.690 ↑ 6.4 775 1

Hash Join (cost=200,384.42..280,867.65 rows=4,979 width=1,309) (actual time=288.942..655.69 rows=775 loops=1)

  • Buffers: shared hit=61680
8. 1.274 612.181 ↑ 6.4 775 1

Nested Loop (cost=198,044.21..278,483.03 rows=4,979 width=1,186) (actual time=246.959..612.181 rows=775 loops=1)

  • Buffers: shared hit=60588
9. 1.372 607.807 ↑ 6.4 775 1

Nested Loop (cost=198,043.78..266,523.71 rows=4,979 width=993) (actual time=246.946..607.807 rows=775 loops=1)

  • Buffers: shared hit=57597
10. 1.117 602.560 ↑ 6.4 775 1

Nested Loop (cost=198,043.36..258,629.56 rows=4,979 width=754) (actual time=246.925..602.56 rows=775 loops=1)

  • Buffers: shared hit=54932
11. 0.949 596.793 ↑ 6.4 775 1

Nested Loop (cost=198,042.93..245,314.07 rows=4,979 width=590) (actual time=246.911..596.793 rows=775 loops=1)

  • Buffers: shared hit=51830
12. 0.612 591.969 ↑ 6.4 775 1

Hash Join (cost=198,042.51..237,147.6 rows=4,979 width=483) (actual time=246.895..591.969 rows=775 loops=1)

  • Buffers: shared hit=48729
13. 1.665 589.827 ↑ 6.4 775 1

Nested Loop (cost=197,945.36..237,031.55 rows=4,979 width=392) (actual time=245.322..589.827 rows=775 loops=1)

  • Buffers: shared hit=48689
14. 250.189 584.287 ↑ 6.4 775 1

Hash Join (cost=197,944.93..221,733.38 rows=4,979 width=240) (actual time=245.295..584.287 rows=775 loops=1)

  • Buffers: shared hit=45587
15. 136.409 136.409 ↓ 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.037..136.409 rows=1,096,485 loops=1)

  • Buffers: shared hit=8662
16. 43.066 197.689 ↑ 1.5 47,215 1

Hash (cost=197,071.02..197,071.02 rows=69,913 width=193) (actual time=197.689..197.689 rows=47,215 loops=1)

  • Buffers: shared hit=36925
17. 132.710 154.623 ↑ 1.5 47,215 1

Bitmap Heap Scan on document_base document_base (cost=2,152.29..197,071.02 rows=69,913 width=193) (actual time=39.101..154.623 rows=47,215 loops=1)

  • Filter: (document_base.state <> 4)
  • Buffers: shared hit=36925
18. 21.913 21.913 ↑ 1.5 47,215 1

Bitmap Index Scan on document_base_ent_id_date_formatting_f1cc9952_idx (cost=0..2,134.81 rows=70,049 width=0) (actual time=21.913..21.913 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=759
19. 3.875 3.875 ↑ 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.005..0.005 rows=1 loops=775)

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

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

  • Buffers: shared hit=40
21. 0.621 0.621 ↑ 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.621 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. 24.321 41.712 ↑ 1.0 55,476 1

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

  • Buffers: shared hit=1092
27. 17.391 17.391 ↑ 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.012..17.391 rows=55,476 loops=1)

  • Buffers: shared hit=1092
28. 0.000 0.010 ↓ 0.0 0 1

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

29. 0.010 0.010 ↓ 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.01..0.01 rows=0 loops=1)

30. 0.001 0.004 ↓ 0.0 0 1

Hash (cost=12.7..12.7 rows=270 width=266) (actual time=0.003..0.004 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)