explain.depesz.com

PostgreSQL's explain analyze made readable

Result: DoiW

Settings
# exclusive inclusive rows x rows loops node
1. 52.108 1,143.177 ↓ 1.1 5,485 1

Result (cost=124,372.71..125,988.43 rows=5,010 width=394) (actual time=1,090.579..1,143.177 rows=5,485 loops=1)

2. 4.457 1,091.069 ↓ 1.1 5,485 1

Sort (cost=124,372.71..124,385.23 rows=5,010 width=370) (actual time=1,090.503..1,091.069 rows=5,485 loops=1)

  • Sort Key: (date_part('day'::text, (now() - (pv.startdate)::timestamp with time zone))) DESC
  • Sort Method: quicksort Memory: 1934kB
3. 11.784 1,086.612 ↓ 1.1 5,485 1

Nested Loop Left Join (cost=99,259.31..124,064.83 rows=5,010 width=370) (actual time=764.615..1,086.612 rows=5,485 loops=1)

4. 3.327 1,063.858 ↓ 1.1 5,485 1

Nested Loop Left Join (cost=99,259.02..121,776.89 rows=5,010 width=329) (actual time=764.593..1,063.858 rows=5,485 loops=1)

5. 2.108 1,055.046 ↓ 1.1 5,485 1

Hash Left Join (cost=99,258.73..119,906.92 rows=5,010 width=324) (actual time=764.585..1,055.046 rows=5,485 loops=1)

  • Hash Cond: (p.idinsurancetype = it_label.id)
6. 2.197 1,052.914 ↓ 1.1 5,485 1

Hash Left Join (cost=99,257.16..119,885.21 rows=5,010 width=329) (actual time=764.556..1,052.914 rows=5,485 loops=1)

  • Hash Cond: (pl.id = pl_label.id)
7. 2.547 1,050.687 ↓ 1.1 5,485 1

Nested Loop Left Join (cost=99,255.76..119,863.29 rows=5,010 width=297) (actual time=764.518..1,050.687 rows=5,485 loops=1)

8. 2.641 1,026.208 ↓ 1.1 5,483 1

Nested Loop (cost=99,255.33..114,477.10 rows=5,010 width=297) (actual time=764.506..1,026.208 rows=5,483 loops=1)

9. 5.626 1,007.118 ↓ 1.1 5,483 1

Nested Loop (cost=99,254.91..111,654.08 rows=5,046 width=305) (actual time=764.494..1,007.118 rows=5,483 loops=1)

10. 40.580 990.526 ↓ 1.1 5,483 1

Hash Join (cost=99,254.49..108,682.71 rows=5,046 width=278) (actual time=764.476..990.526 rows=5,483 loops=1)

  • Hash Cond: (tblriskpremium.idpolicyversion = pv.id)
11. 449.505 517.418 ↓ 1.3 463,762 1

HashAggregate (cost=22,083.33..26,548.93 rows=357,248 width=40) (actual time=331.807..517.418 rows=463,762 loops=1)

  • Group Key: tblriskpremium.idpolicyversion
12. 67.913 67.913 ↓ 1.0 751,226 1

Seq Scan on tblriskpremium (cost=0.00..18,327.22 rows=751,222 width=13) (actual time=0.014..67.913 rows=751,226 loops=1)

13. 2.186 432.528 ↑ 1.2 5,483 1

Hash (cost=77,089.27..77,089.27 rows=6,551 width=238) (actual time=432.528..432.528 rows=5,483 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 1246kB
14. 26.012 430.342 ↑ 1.2 5,483 1

Hash Right Join (cost=74,928.24..77,089.27 rows=6,551 width=238) (actual time=399.281..430.342 rows=5,483 loops=1)

  • Hash Cond: (tblpolicyinstallmentcache.idpolicyversion = pv.id)
  • Filter: ((p.policystatus = 'BINDER'::text) OR ((p.policystatus = 'ACTIVE'::text) AND (tblpolicyinstallmentcache.paidvalue < tblpolicyinstallmentcache.value) AND (pv.enddate >= now())))
  • Rows Removed by Filter: 46421
15. 5.128 5.128 ↓ 1.0 70,611 1

Seq Scan on tblpolicyinstallmentcache (cost=0.00..1,703.10 rows=70,610 width=25) (actual time=0.023..5.128 rows=70,611 loops=1)

16. 19.307 399.202 ↑ 1.1 50,261 1

Hash (cost=74,223.54..74,223.54 rows=56,376 width=221) (actual time=399.202..399.202 rows=50,261 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 10316kB
17. 15.863 379.895 ↑ 1.1 50,261 1

Hash Join (cost=47,543.22..74,223.54 rows=56,376 width=221) (actual time=176.183..379.895 rows=50,261 loops=1)

  • Hash Cond: (p.idemployee = employee.id)
18. 12.304 349.327 ↑ 1.1 50,261 1

Hash Join (cost=45,709.84..72,242.17 rows=56,376 width=191) (actual time=161.427..349.327 rows=50,261 loops=1)

  • Hash Cond: (p.idagencyunit = division.id)
19. 11.672 323.622 ↑ 1.1 50,261 1

Hash Join (cost=43,794.45..70,178.78 rows=56,376 width=178) (actual time=147.977..323.622 rows=50,261 loops=1)

  • Hash Cond: (p.idagency = agency.id)
20. 10.625 302.084 ↑ 1.1 50,261 1

Hash Join (cost=41,879.05..68,115.38 rows=56,376 width=162) (actual time=138.062..302.084 rows=50,261 loops=1)

  • Hash Cond: (ga.idproductline = pl.id)
21. 11.492 291.447 ↑ 1.1 50,261 1

Hash Join (cost=41,877.40..67,944.12 rows=56,376 width=137) (actual time=138.044..291.447 rows=50,261 loops=1)

  • Hash Cond: (p.idgeneralagreement = ga.id)
22. 9.247 279.936 ↑ 1.1 50,261 1

Hash Join (cost=41,874.34..67,779.73 rows=56,376 width=150) (actual time=138.020..279.936 rows=50,261 loops=1)

  • Hash Cond: (p.idinsurancecompany = cu.id)
23. 66.794 270.680 ↑ 1.1 50,261 1

Hash Join (cost=41,872.91..67,597.31 rows=56,376 width=126) (actual time=138.006..270.680 rows=50,261 loops=1)

  • Hash Cond: (pv.idpolicy = p.id)
24. 65.943 65.943 ↑ 1.0 441,552 1

Seq Scan on tblpolicyversion pv (cost=0.00..24,562.00 rows=442,814 width=46) (actual time=0.005..65.943 rows=441,552 loops=1)

  • Filter: (policyversionstatus = 'CURRENT'::text)
  • Rows Removed by Filter: 22210
25. 10.666 137.943 ↑ 1.1 50,261 1

Hash (cost=41,170.24..41,170.24 rows=56,214 width=99) (actual time=137.943..137.943 rows=50,261 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 7267kB
26. 127.277 127.277 ↑ 1.1 50,261 1

Seq Scan on tblpolicy p (cost=0.00..41,170.24 rows=56,214 width=99) (actual time=0.007..127.277 rows=50,261 loops=1)

  • Filter: ((NOT test) AND (canceldate IS NULL) AND (policytype = 'POLICY'::text))
  • Rows Removed by Filter: 391281
27. 0.003 0.009 ↑ 1.0 19 1

Hash (cost=1.19..1.19 rows=19 width=40) (actual time=0.008..0.009 rows=19 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
28. 0.006 0.006 ↑ 1.0 19 1

Seq Scan on tblinsurancecompanyunit cu (cost=0.00..1.19 rows=19 width=40) (actual time=0.004..0.006 rows=19 loops=1)

29. 0.008 0.019 ↑ 1.0 47 1

Hash (cost=2.47..2.47 rows=47 width=23) (actual time=0.019..0.019 rows=47 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
30. 0.011 0.011 ↑ 1.0 47 1

Seq Scan on tblgeneralagreement ga (cost=0.00..2.47 rows=47 width=23) (actual time=0.005..0.011 rows=47 loops=1)

31. 0.005 0.012 ↑ 1.0 29 1

Hash (cost=1.29..1.29 rows=29 width=32) (actual time=0.012..0.012 rows=29 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
32. 0.007 0.007 ↑ 1.0 29 1

Seq Scan on tblproductline pl (cost=0.00..1.29 rows=29 width=32) (actual time=0.005..0.007 rows=29 loops=1)

33. 4.585 9.866 ↑ 1.0 40,862 1

Hash (cost=1,404.62..1,404.62 rows=40,862 width=32) (actual time=9.866..9.866 rows=40,862 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 2631kB
34. 5.281 5.281 ↑ 1.0 40,862 1

Seq Scan on tblagencyunit agency (cost=0.00..1,404.62 rows=40,862 width=32) (actual time=0.006..5.281 rows=40,862 loops=1)

35. 5.071 13.401 ↑ 1.0 40,862 1

Hash (cost=1,404.62..1,404.62 rows=40,862 width=29) (actual time=13.401..13.401 rows=40,862 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 3096kB
36. 8.330 8.330 ↑ 1.0 40,862 1

Seq Scan on tblagencyunit division (cost=0.00..1,404.62 rows=40,862 width=29) (actual time=0.007..8.330 rows=40,862 loops=1)

37. 7.157 14.705 ↑ 1.0 46,150 1

Hash (cost=1,256.50..1,256.50 rows=46,150 width=46) (actual time=14.705..14.705 rows=46,150 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 4231kB
38. 7.548 7.548 ↑ 1.0 46,150 1

Seq Scan on tblemployee employee (cost=0.00..1,256.50 rows=46,150 width=46) (actual time=0.010..7.548 rows=46,150 loops=1)

39. 10.966 10.966 ↑ 1.0 1 5,483

Index Scan using tblpolicyclient_idpolicyversion on tblpolicyclient pc_ubezpieczony (cost=0.42..0.58 rows=1 width=51) (actual time=0.002..0.002 rows=1 loops=5,483)

  • Index Cond: (idpolicyversion = pv.id)
40. 16.449 16.449 ↑ 1.0 1 5,483

Index Only Scan using tblpolicyclientrole_role_unique on tblpolicyclientrole pcr_ubezpieczony (cost=0.42..0.56 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=5,483)

  • Index Cond: ((idpolicyclient = pc_ubezpieczony.id) AND (role = 'ubezpieczony'::text))
  • Heap Fetches: 5483
41. 21.932 21.932 ↑ 1.0 1 5,483

Index Scan using tblprint_idpolicyversion on tblprint invoice (cost=0.43..1.07 rows=1 width=16) (actual time=0.003..0.004 rows=1 loops=5,483)

  • Index Cond: (pv.id = idpolicyversion)
  • Filter: (documenttype = 'FAKTURA'::text)
  • Rows Removed by Filter: 4
42. 0.005 0.030 ↓ 26.0 26 1

Hash (cost=1.39..1.39 rows=1 width=64) (actual time=0.030..0.030 rows=26 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
43. 0.025 0.025 ↓ 26.0 26 1

Seq Scan on tblproductlinelabel pl_label (cost=0.00..1.39 rows=1 width=64) (actual time=0.013..0.025 rows=26 loops=1)

  • Filter: ('en_US'::text ~~* (locale || '%'::text))
44. 0.003 0.024 ↓ 20.0 20 1

Hash (cost=1.55..1.55 rows=1 width=32) (actual time=0.024..0.024 rows=20 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
45. 0.021 0.021 ↓ 20.0 20 1

Seq Scan on tblinsurancetypelabel it_label (cost=0.00..1.55 rows=1 width=32) (actual time=0.005..0.021 rows=20 loops=1)

  • Filter: ('en_US'::text ~~* (locale || '%'::text))
  • Rows Removed by Filter: 17
46. 5.485 5.485 ↑ 1.0 1 5,485

Index Scan using tblemployee_pkey on tblemployee producer (cost=0.29..0.37 rows=1 width=21) (actual time=0.001..0.001 rows=1 loops=5,485)

  • Index Cond: (id = p.idproduceremployee)
47. 10.970 10.970 ↑ 1.0 1 5,485

Index Scan using tblnumber_idpolicy_indx on tblnumber n (cost=0.29..0.39 rows=1 width=40) (actual time=0.002..0.002 rows=1 loops=5,485)

  • Index Cond: (p.id = idpolicy)
Planning time : 9.204 ms
Execution time : 1,145.406 ms