explain.depesz.com

PostgreSQL's explain analyze made readable

Result: bf40

Settings
# exclusive inclusive rows x rows loops node
1. 0.771 233.323 ↑ 1.0 1 1

Aggregate (cost=179,038.15..179,038.16 rows=1 width=8) (actual time=233.323..233.323 rows=1 loops=1)

2. 1.770 232.552 ↓ 13,457.0 13,457 1

Unique (cost=179,038.13..179,038.14 rows=1 width=4) (actual time=229.676..232.552 rows=13,457 loops=1)

3. 4.632 230.782 ↓ 13,458.0 13,458 1

Sort (cost=179,038.13..179,038.14 rows=1 width=4) (actual time=229.675..230.782 rows=13,458 loops=1)

  • Sort Key: clients_client.id
  • Sort Method: quicksort Memory: 1015kB
4. 5.990 226.150 ↓ 13,458.0 13,458 1

Nested Loop (cost=175,195.80..179,038.12 rows=1 width=4) (actual time=153.370..226.150 rows=13,458 loops=1)

5. 5.702 191.254 ↓ 6.5 14,453 1

Nested Loop (cost=175,195.37..177,904.45 rows=2,239 width=4) (actual time=153.361..191.254 rows=14,453 loops=1)

6. 8.450 156.646 ↓ 6.5 14,453 1

HashAggregate (cost=175,194.95..175,217.34 rows=2,239 width=4) (actual time=153.351..156.646 rows=14,453 loops=1)

  • Group Key: v0.id
7. 2.573 148.196 ↓ 6.5 14,453 1

Nested Loop (cost=0.70..175,189.35 rows=2,239 width=4) (actual time=0.071..148.196 rows=14,453 loops=1)

8. 0.207 0.207 ↑ 1.0 249 1

Index Scan using accounts_employeegroup_447d3092 on accounts_employeegroup v1 (cost=0.28..132.42 rows=249 width=4) (actual time=0.011..0.207 rows=249 loops=1)

  • Index Cond: (company_id = 18855)
9. 73.064 145.416 ↓ 3.6 58 249

Index Scan using clients_groupassignment_group_id_692cd6dd on clients_groupassignment v0 (cost=0.42..702.88 rows=16 width=8) (actual time=0.020..0.584 rows=58 loops=249)

  • Index Cond: ((group_id = v1.id) AND (group_id = ANY ('{1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126,1127,1128,1129,1130,1131,1132,1133,1134,1135,1136,1137,1138,1139,1140,1141,1142,1143,1144,1145,1146,1147,1148,1149,1150,1151,1152,1153,1154,1155,1156,1157,1158,1159,1160,1161,1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1172,1173,1174,1175,1176,1177,1178,1179,1180,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190,1191,1192,1193,1194,1195,1196,1197,1198,1199,1200,1201,1202,1203,1204,1205,1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220,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,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280,1281,1282,1283,1284,1285,1286,1287,1288,1289,1290,1291,1292,1293,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310,1311,1312,1313,1314,1315,1316,1317,1318,1319,1320,1321,1322,1323,1324,1326,1446,1468}'::integer[])))
  • Filter: ((status = 10) AND (alternatives: SubPlan 1 or hashed SubPlan 2))
  • Rows Removed by Filter: 341
10.          

SubPlan (for Index Scan)

11. 3.023 72.352 ↑ 1.0 1 18,088

Nested Loop (cost=1.00..5.46 rows=1 width=0) (actual time=0.004..0.004 rows=1 loops=18,088)

12. 3.023 54.264 ↑ 1.0 1 18,088

Nested Loop (cost=0.71..5.15 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=18,088)

13. 36.176 36.176 ↑ 1.0 1 18,088

Index Only Scan using clients_client_agents_client_id_37afacd828f1e2f6_uniq on clients_client_agents u3 (cost=0.42..2.64 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=18,088)

  • Index Cond: (client_id = v0.client_id)
  • Heap Fetches: 12899
14. 15.065 15.065 ↑ 1.0 1 15,065

Index Only Scan using auth_user_pkey on auth_user u0 (cost=0.29..2.51 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=15,065)

  • Index Cond: (id = u3.user_id)
  • Heap Fetches: 14306
15. 15.065 15.065 ↑ 1.0 1 15,065

Index Only Scan using accounts_employeegroup_employees_employeegroup_id_user_id_key on accounts_employeegroup_employees u1 (cost=0.29..0.31 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=15,065)

  • Index Cond: ((employeegroup_id = v0.group_id) AND (user_id = u0.id))
  • Heap Fetches: 5743SubPlan 2
16. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=1,930.90..19,841.38 rows=571,474 width=8) (never executed)

  • Hash Cond: (u3_1.user_id = u0_1.id)
17. 0.000 0.000 ↓ 0.0 0

Seq Scan on clients_client_agents u3_1 (cost=0.00..9,820.90 rows=633,290 width=8) (never executed)

18. 0.000 0.000 ↓ 0.0 0

Hash (cost=1,611.73..1,611.73 rows=25,534 width=12) (never executed)

19. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=1,136.35..1,611.73 rows=25,534 width=12) (never executed)

  • Hash Cond: (u1_1.user_id = u0_1.id)
20. 0.000 0.000 ↓ 0.0 0

Seq Scan on accounts_employeegroup_employees u1_1 (cost=0.00..408.34 rows=25,534 width=8) (never executed)

21. 0.000 0.000 ↓ 0.0 0

Hash (cost=782.65..782.65 rows=28,296 width=4) (never executed)

22. 0.000 0.000 ↓ 0.0 0

Index Only Scan using auth_user_pkey on auth_user u0_1 (cost=0.29..782.65 rows=28,296 width=4) (never executed)

  • Heap Fetches: 0
23. 28.906 28.906 ↑ 1.0 1 14,453

Index Scan using clients_groupassignment_pkey on clients_groupassignment (cost=0.42..1.20 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=14,453)

  • Index Cond: (id = v0.id)
24. 28.906 28.906 ↑ 1.0 1 14,453

Index Scan using clients_client_pkey on clients_client (cost=0.42..0.51 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=14,453)

  • Index Cond: (id = clients_groupassignment.client_id)
  • Filter: ((status <> ALL ('{50,70}'::integer[])) AND (brokerage_id = 18855))
  • Rows Removed by Filter: 0
Planning time : 1.941 ms
Execution time : 233.429 ms