explain.depesz.com

PostgreSQL's explain analyze made readable

Result: b94h

Settings
# exclusive inclusive rows x rows loops node
1. 0.297 812.106 ↓ 2.0 45 1

Limit (cost=7,826.51..7,826.56 rows=22 width=3,506) (actual time=811.665..812.106 rows=45 loops=1)

2. 0.592 811.809 ↓ 2.0 45 1

Sort (cost=7,826.51..7,826.56 rows=22 width=3,506) (actual time=811.657..811.809 rows=45 loops=1)

  • Sort Key: p.""IsTop"" DESC, p.""HasContractWithH24"" DESC, p.""LastName"", p.""Id"
  • Sort Method: quicksort Memory: 191kB
3. 0.638 811.217 ↓ 2.0 45 1

Nested Loop Semi Join (cost=4,508.99..7,826.02 rows=22 width=3,506) (actual time=514.903..811.217 rows=45 loops=1)

  • Join Filter: (p.""Id"" = e1.""PartyId"")
4. 17.828 806.169 ↓ 1.4 45 1

Hash Semi Join (cost=4,508.42..7,237.87 rows=33 width=3,518) (actual time=514.792..806.169 rows=45 loops=1)

  • Hash Cond: (p.""Id"" = e2.""PartyId"")
5. 37.339 787.270 ↑ 1.2 4,692 1

Hash Left Join (cost=4,241.88..6,955.78 rows=5,408 width=3,514) (actual time=510.378..787.270 rows=4,692 loops=1)

  • Hash Cond: (p.""LogoId"" = ""p.LogoFileItem"".""Id"")
6. 36.420 672.796 ↑ 1.2 4,692 1

Hash Left Join (cost=3,762.58..6,462.27 rows=5,408 width=3,353) (actual time=433.224..672.796 rows=4,692 loops=1)

  • Hash Cond: (p.""GenderRefId"" = ""p.GenderRef"".""Id"")
7. 37.598 636.336 ↑ 1.2 4,692 1

Hash Semi Join (cost=3,761.53..6,417.59 rows=5,408 width=2,627) (actual time=433.166..636.336 rows=4,692 loops=1)

  • Hash Cond: (p.""Id"" = e0.""PartyId"")
8. 38.845 283.347 ↑ 1.4 4,751 1

Hash Join (cost=2,542.50..4,965.71 rows=6,550 width=2,623) (actual time=117.751..283.347 rows=4,751 loops=1)

  • Hash Cond: (p.""LegalEntityId"" = l.""Id"")
9. 70.187 232.079 ↑ 1.5 4,760 1

Hash Join (cost=2,300.28..4,704.52 rows=7,209 width=1,145) (actual time=105.308..232.079 rows=4,760 loops=1)

  • Hash Cond: (p.""Id"" = e.""PartyId"")
10. 56.649 56.649 ↑ 1.0 13,603 1

Seq Scan on ""Parties"" p (cost=0.00..2,287.86 rows=13,782 width=1,141) (actual time=0.012..56.649 rows=13,603 loops=1)

  • Filter: ""IsOnPortal"
  • Rows Removed by Filter: 6883
11. 17.953 105.243 ↑ 2.0 4,857 1

Hash (cost=2,177.05..2,177.05 rows=9,859 width=4) (actual time=105.240..105.243 rows=4,857 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 299kB
12. 51.533 87.290 ↑ 2.0 4,857 1

HashAggregate (cost=2,078.46..2,177.05 rows=9,859 width=4) (actual time=68.851..87.290 rows=4,857 loops=1)

  • Group Key: e.""PartyId"
13. 35.757 35.757 ↑ 1.3 8,341 1

Index Scan using ""Employees_IX_DivisionId"" on ""Employees"" e (cost=0.29..2,051.67 rows=10,715 width=4) (actual time=0.116..35.757 rows=8,341 loops=1)

  • Index Cond: ((""DivisionId"" IS NOT NULL) AND (""DivisionId"" = ANY ('{1975,2058,1701,1765,1800,1812,1817,1828,1830,982,1013,1838,933,1839,1841,1851,1051,1154,1789,1862,1868,1207,1870,1871,1874,1875,782,1208,1883,795,1788,1884,1889,1890,1892,1895,755,1210,1252,1499,1594,1674,1692,1538,1575,1171,771,1942,1619,1759,1944,1945,1946,815,793,1948,1950,975,995,1951,986,1952,1955,1956,990,1006,1960,1009,1961,1968,1969,1974,1010,1979,1982,1983,1984,1985,1018,1987,1205,1990,1991,1993,1054,1042,1994,1996,1058,1161,1766,1015,1027,1037,1048,1998,2000,2002,1094,1109,1118,1129,1136,1139,1155,1239,1242,940,1174,1060,1175,953,1244,2003,2009,2010,2011,1341,2012,2013,1211,1216,1467,2014,1305,1240,1243,1250,1245,1527,1576,1246,1247,1248,1249,1620,1647,2015,2017,1670,2019,1675,2020,2024,1062,1251,1693,2044,1347,2048,867,2049,2050,1544,886,949,992,1696,1071,2051,1513,1514,1526,2053,2056,1757,2060,1079,1453,1536,1080,2062,2063,2064,2065,1764,2066,1372,2067,2068,1085,1273,2070,2072,1086,1539,1559,1012,1317,1819,1019,1092,1537,1824,1335,2076,1368,1410,1411,1768,1769,2077,1774,1776,2078,1344,2079,1107,2081,2084,1572,1784,2085,1281,1324,1511,1574,1630,2023,956,1034,1367,1792,2093,2086,1110,1371,1426,2089,2090,1462,2094,2095,1111,1112,1645,1346,2074,1483,1114,1348,2098,1349,1484,1489,1509,1849,2101,2103,1120,1350,1510,1579,968,1121,1008,1057,1050,1599,2105,2106,1519,2108,1649,2114,2115,2117,1666,1061,1068,2118,2119,2120,1070,1073,1077,1088,1657,1089,1351,1540,1679,2121,1542,2122,2123,2124,2125,2127,1543,2128,2131,2132,1685,2133,1299,1555,2135,2136,2142,2143,2146,1557,2151,2154,2156,2157,1353,1354,1359,1560,1300,1360,1364,1396,2158,2160,1301,1562,2164,2165,1365,1366,1796,1689,1303,1577,2116,2166,2168,2169,2170,2172,2174,2180,2181,2187,2192,2195,1793,2196,2197,1304,1695,1756,2198,2199,2201,2202,2203,2205,1799,2207,2209,2214,1580,2217,1375,2226,2229,2230,2239,2240,2241,1376,1589,1697,1546,1550,1552,1553,1563,2244,2245,2259,2261,2262,2264,1115,1377,2265,2266,2267,2270,1427,1379,1802,1122,1564,1565,1805,1125,1149,1157,1622,1807,1380,1381,2278,1624,1626,1603,1809,1681,1811,1311,1447,1394,1605,1813,2301,1615,1628,1401,1814,1312,1568,1570,1629,1314,1402,1650,1172,1319,1320,1323,1651,1653,1327,1409,1566,1659,1397,1567,1608,1610,1612,1665,1706,1425,1428,1631,1448,971,1640,1449,1641,1020,1644,1049,1043,1307,1431,1437,1444,1445,1669,2269,1343,1055,1137,1450,1452,959,961,962,1831,1412,1413,1414,1702,1832,988,1571,1144,1438,1672,1145,1147,1148,1646,1857,1146,1623,1673,1705,1439,1454,1860,1056,1861,1102,1440,1442,1443,939,946,973,1419,1456,1648,1835,974,980,1423,1678,1424,1463,947,989,1128,1131,948,1352,1132,1170,1310,1837,2468,1133,1134,1135,1680,993,1321,1322,1474,1632,1865,1482,996,997,1490,1654,2511,1635,1022,1476,1584,1638,1588,1639,1023,1663,1682,1498,1655,1664,1024,1683,1836,1025,1593,999,1004,1030,1591,1451,1158,1159,1872,1826,1212,1501,1684,1162,1007,1581,1755,1047,1031,1873,1160,1213,1582,1164,1595,1748,1658,1325,1504,1507,1331,1332,1059,1508,1167,1355,1435,1597,1214,1441,1485,1215,1356,1758,1488,1688,1492,1219,1512,1569,1494,1495,1497,2861,2863,1035,1036,1039,1338,1339,1040,951,1446,1502,1515,952,1044,1503,954,1237,1238,1592,1505,1667,1694,1573,1847,964,967,969,1578,976,977,978,979,981,983,1877,984,1389,994,1209,1392,1052,1660,1000,1002,1003,1097,1378,1848,1045,1046,1014,1017,1676,1021,1026,1124,1033,1420,1637,1859,868,1041,1082,1083,1810,1888,1104,1699,1785,1818,1117,1313,1091,1093,955,1105,1106,1140,1333,1334,960,1116,1126,1340,972,1168,1169,1173,1150,1218,1596,1686,1773,1465,1466,1306,1469,1336,1204,1475,1671,1016,1316,1633,1032,1825,1337,1500,1517,1518,1583,1395,1408,1522,1636,1643,1881,1084,1370,1545,1604,1541,1801,1551,1625,1780,1846,1405,1677,1754,1298,1328,1749,1315,1308,1833,1869,1166,1326,1330,1345,1457,1458,1855,1609,1611,1856,1399,1820,1821,1876,1943,1823,1391,1398,1523,1525,1954,1421,1858,1891,1687,1845,1487,1561,1606,1607,1691,1455,1854,1468,1521,1703,1318,1491,1528,1634,1493,1590,1506,1598,1358,1516,1971,1614,1616,1618,1844,1939,1390,1547,1548,1549,1400,1554,1972,1642,1936,1977,1602,1652,1613,1661,1772,1781,1782,1783,1896,1964,1797,1798,1965,1617,1690,1806,1970,1496,1662,1992,1834,1668,1700,1842,1852,2047,1778,1698,2008,2025,1808,2022,1600,1815,1816,1822,1989,2061,1770,1777,1843,2073,1656,1853,1973,1794,1795,2018,1803,2055,1840,1867,2041,1959,1882,1866,1885,2071,1887,2075,1893,1864,2082,2100,2092,1790,1791,2088,1894,1878,1947,1953,2102,1962,1963,2104,1966,1967,2091,1863,1976,1988,1981,1986,2129,1995,2130,2006,2007,1980,2150,2171,2137,2162,1997,1949,2001,2004,2134,2161,2045,2144,2046,2080,2021,2163,2204,2177,2186,2039,2096,2179,2052,2189,2193,2087,2219,2016,2138,2167,2152,2153,2178,2040,2184,2220,2099,2190,2054,2107,2173,2176,2145,2147,2183,2188,2260,2194,2218,2263,2148,2149,2155,2276,2175,2126,2185,2271,2216,2277,2215,2208,2256,2257,2503,2484,2532,2517,2615,2717,2758,2824,2862,2898,3179,3124,3138,3296,3299,3300}'::integer[])))
  • Filter: (NOT ""IsDeleted"")
14. 6.065 12.423 ↑ 1.0 1,413 1

Hash (cost=224.55..224.55 rows=1,413 width=1,478) (actual time=12.420..12.423 rows=1,413 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 1565kB
15. 6.358 6.358 ↑ 1.0 1,413 1

Seq Scan on ""LegalEntities"" l (cost=0.00..224.55 rows=1,413 width=1,478) (actual time=0.013..6.358 rows=1,413 loops=1)

  • Filter: ((NOT ""IsDeleted"") AND ""IsOnPortal"")
  • Rows Removed by Filter: 142
16. 79.730 315.391 ↓ 1.1 18,177 1

Hash (cost=1,007.62..1,007.62 rows=16,913 width=4) (actual time=315.388..315.391 rows=18,177 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 896kB
17. 140.092 235.661 ↓ 1.1 18,177 1

Hash Join (cost=319.07..1,007.62 rows=16,913 width=4) (actual time=20.723..235.661 rows=18,177 loops=1)

  • Hash Cond: (e0.""DivisionId"" = ""e.Division"".""Id"")
18. 74.869 74.869 ↓ 1.0 18,234 1

Seq Scan on ""Employees"" e0 (cost=0.00..641.49 rows=17,902 width=8) (actual time=0.008..74.869 rows=18,234 loops=1)

  • Filter: ((NOT ""IsDeleted"") AND ""IsOnPortal"" AND (""DivisionId"" IS NOT NULL))
  • Rows Removed by Filter: 8415
19. 9.543 20.700 ↑ 1.0 2,420 1

Hash (cost=288.71..288.71 rows=2,429 width=4) (actual time=20.697..20.700 rows=2,420 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 118kB
20. 11.157 11.157 ↑ 1.0 2,420 1

Seq Scan on ""Divisions"" ""e.Division"" (cost=0.00..288.71 rows=2,429 width=4) (actual time=0.007..11.157 rows=2,420 loops=1)

  • Filter: ""IsOnPortal"
  • Rows Removed by Filter: 151
21. 0.015 0.040 ↑ 1.0 2 1

Hash (cost=1.02..1.02 rows=2 width=726) (actual time=0.037..0.040 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
22. 0.025 0.025 ↑ 1.0 2 1

Seq Scan on ""GenderRefs"" ""p.GenderRef"" (cost=0.00..1.02 rows=2 width=726) (actual time=0.015..0.025 rows=2 loops=1)

23. 38.696 77.135 ↑ 1.0 10,058 1

Hash (cost=353.58..353.58 rows=10,058 width=161) (actual time=77.132..77.135 rows=10,058 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 2065kB
24. 38.439 38.439 ↑ 1.0 10,058 1

Seq Scan on ""Files"" ""p.LogoFileItem"" (cost=0.00..353.58 rows=10,058 width=161) (actual time=0.009..38.439 rows=10,058 loops=1)

25. 0.451 1.071 ↑ 1.0 124 1

Hash (cost=264.96..264.96 rows=126 width=4) (actual time=1.067..1.071 rows=124 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 13kB
26. 0.600 0.620 ↑ 1.0 124 1

Bitmap Heap Scan on ""Employees"" e2 (cost=5.26..264.96 rows=126 width=4) (actual time=0.032..0.620 rows=124 loops=1)

  • Recheck Cond: (""PositionRefId"" = 123)
  • Filter: (NOT ""IsDeleted"")
  • Heap Blocks: exact=81
27. 0.020 0.020 ↑ 1.0 124 1

Bitmap Index Scan on ""Employees_IX_PositionRefId"" (cost=0.00..5.23 rows=126 width=0) (actual time=0.016..0.020 rows=124 loops=1)

  • Index Cond: (""PositionRefId"" = 123)
28. 1.005 4.410 ↑ 1.0 1 45

Nested Loop Left Join (cost=0.57..17.81 rows=1 width=4) (actual time=0.098..0.098 rows=1 loops=45)

  • Filter: (SubPlan 1)
  • Rows Removed by Filter: 0
29. 0.585 0.585 ↑ 1.0 1 45

Index Scan using ""Employees_IX_PartyId"" on ""Employees"" e1 (cost=0.29..0.41 rows=1 width=8) (actual time=0.013..0.013 rows=1 loops=45)

  • Index Cond: (""PartyId"" = e0.""PartyId"")
  • Filter: (NOT ""IsDeleted"")
30. 0.423 0.423 ↑ 1.0 1 47

Index Only Scan using ""PK_dbo.Divisions"" on ""Divisions"" ""e.Division0"" (cost=0.28..0.34 rows=1 width=4) (actual time=0.008..0.009 rows=1 loops=47)

  • Index Cond: (""Id"" = e1.""DivisionId"")
  • Heap Fetches: 46
31.          

SubPlan (for Nested Loop Left Join)

32. 0.574 2.397 ↑ 1.0 1 47

Nested Loop (cost=0.98..17.06 rows=1 width=0) (actual time=0.051..0.051 rows=1 loops=47)

  • Join Filter: (a.""Address_Id"" = ""a.AddressH24"".""Id"")
33. 0.573 1.363 ↑ 1.0 1 47

Nested Loop (cost=0.70..16.73 rows=1 width=8) (actual time=0.029..0.029 rows=1 loops=47)

34. 0.376 0.376 ↑ 1.0 1 47

Index Only Scan using ""PK_dbo.DivisionAddresses"" on ""DivisionAddresses"" a (cost=0.28..8.30 rows=1 width=4) (actual time=0.008..0.008 rows=1 loops=47)

  • Index Cond: (""Division_Id"" = ""e.Division0"".""Id"")
  • Heap Fetches: 46
35. 0.414 0.414 ↑ 1.0 1 46

Index Only Scan using ""PK_dbo.Addresses"" on ""Addresses"" ""a.Address"" (cost=0.42..8.44 rows=1 width=4) (actual time=0.009..0.009 rows=1 loops=46)

  • Index Cond: (""Id"" = a.""Address_Id"")
  • Heap Fetches: 46
36. 0.460 0.460 ↑ 1.0 1 46

Index Scan using ""PK_dbo.AddressH24"" on ""AddressH24"" ""a.AddressH24"" (cost=0.29..0.31 rows=1 width=4) (actual time=0.010..0.010 rows=1 loops=46)

  • Index Cond: ((""Id"" = ""a.Address"".""Id"") AND (""Id"" IS NOT NULL))
  • Filter: (""SettlementId"" = 29219)
  • Rows Removed by Filter: 0
Planning time : 4.421 ms
Execution time : 812.688 ms