explain.depesz.com

PostgreSQL's explain analyze made readable

Result: DdSu

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.029 809.074 ↑ 1.0 200 1

Limit (cost=308,434.49..308,434.99 rows=200 width=1,772) (actual time=808.964..809.074 rows=200 loops=1)

  • Buffers: shared hit=61680
2. 6.186 809.045 ↑ 24.9 200 1

Sort (cost=308,434.49..308,446.94 rows=4,979 width=1,772) (actual time=808.963..809.045 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. 1.579 802.859 ↑ 6.4 775 1

Nested Loop (cost=200,462.96..308,219.3 rows=4,979 width=1,772) (actual time=294.964..802.859 rows=775 loops=1)

  • Buffers: shared hit=61680
4. 1.750 801.280 ↑ 6.4 775 1

Nested Loop (cost=200,462.54..300,812.47 rows=4,979 width=1,734) (actual time=294.956..801.28 rows=775 loops=1)

  • Buffers: shared hit=61680
5. 1.065 799.530 ↑ 6.4 775 1

Hash Join (cost=200,462.11..280,989.22 rows=4,979 width=1,583) (actual time=294.943..799.53 rows=775 loops=1)

  • Buffers: shared hit=61680
6. 1.293 798.462 ↑ 6.4 775 1

Hash Join (cost=200,446.04..280,948.52 rows=4,979 width=1,317) (actual time=294.918..798.462 rows=775 loops=1)

  • Buffers: shared hit=61680
7. 2.697 797.159 ↑ 6.4 775 1

Hash Join (cost=200,385.19..280,868.99 rows=4,979 width=1,309) (actual time=294.845..797.159 rows=775 loops=1)

  • Buffers: shared hit=61680
8. 2.144 742.358 ↑ 6.4 775 1

Nested Loop (cost=198,044.98..278,484.37 rows=4,979 width=1,186) (actual time=242.338..742.358 rows=775 loops=1)

  • Buffers: shared hit=60588
9. 1.229 732.464 ↑ 6.4 775 1

Nested Loop (cost=198,044.55..266,524.62 rows=4,979 width=993) (actual time=242.316..732.464 rows=775 loops=1)

  • Buffers: shared hit=57597
10. 1.248 725.035 ↑ 6.4 775 1

Nested Loop (cost=198,044.13..258,630.47 rows=4,979 width=754) (actual time=242.281..725.035 rows=775 loops=1)

  • Buffers: shared hit=54932
11. 1.518 716.037 ↑ 6.4 775 1

Nested Loop (cost=198,043.7..245,314.85 rows=4,979 width=590) (actual time=242.261..716.037 rows=775 loops=1)

  • Buffers: shared hit=51830
12. 0.925 708.319 ↑ 6.4 775 1

Hash Join (cost=198,043.28..237,148.47 rows=4,979 width=483) (actual time=242.24..708.319 rows=775 loops=1)

  • Buffers: shared hit=48729
13. 2.469 704.246 ↑ 6.4 775 1

Nested Loop (cost=197,946.13..237,032.42 rows=4,979 width=392) (actual time=239.045..704.246 rows=775 loops=1)

  • Buffers: shared hit=48689
14. 330.637 690.927 ↑ 6.4 775 1

Hash Join (cost=197,945.7..221,734.15 rows=4,979 width=240) (actual time=238.993..690.927 rows=775 loops=1)

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

  • Buffers: shared hit=8662
16. 40.472 179.048 ↑ 1.5 47,215 1

Hash (cost=197,071.78..197,071.78 rows=69,914 width=193) (actual time=179.048..179.048 rows=47,215 loops=1)

  • Buffers: shared hit=36925
17. 124.140 138.576 ↑ 1.5 47,215 1

Bitmap Heap Scan on document_base document_base (cost=2,152.29..197,071.78 rows=69,914 width=193) (actual time=24.979..138.576 rows=47,215 loops=1)

  • Filter: (document_base.state <> 4)
  • Heap Blocks: exact=36166
  • Buffers: shared hit=36925
18. 14.436 14.436 ↑ 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=14.436..14.436 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. 10.850 10.850 ↑ 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.008..0.014 rows=1 loops=775)

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

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

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

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

  • Buffers: shared hit=40
22. 6.200 6.200 ↑ 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.008..0.008 rows=1 loops=775)

  • Index Cond: (document_base.mol_id = contragent_mol.id)
  • Buffers: shared hit=3101
23. 7.750 7.750 ↑ 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.009..0.01 rows=1 loops=775)

  • Index Cond: (document_base.supplier_id = contragent_supplier.id)
  • Buffers: shared hit=3102
24. 6.200 6.200 ↑ 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.007..0.008 rows=1 loops=775)

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

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

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

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

  • Buffers: shared hit=1092
27. 21.773 21.773 ↑ 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.017..21.773 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.009..0.01 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)
Planning time : 30.48 ms
Execution time : 810.39 ms