explain.depesz.com

PostgreSQL's explain analyze made readable

Result: bjw2

Settings
# exclusive inclusive rows x rows loops node
1. 0.189 296.823 ↓ 0.0 0 1

Insert on cp_request (cost=0.00..55,718.42 rows=1 width=1,297) (actual time=296.823..296.823 rows=0 loops=1)

2. 0.017 296.634 ↑ 1.0 1 1

Subquery Scan on *SELECT* (cost=0.00..55,718.42 rows=1 width=1,297) (actual time=296.592..296.634 rows=1 loops=1)

3. 0.040 296.617 ↑ 1.0 1 1

Limit (cost=0.00..55,718.41 rows=1 width=1,845) (actual time=296.577..296.617 rows=1 loops=1)

4. 0.059 296.577 ↑ 19,090.0 1 1

Seq Scan on cp_request cp_request_1 (cost=0.00..1,063,664,434.84 rows=19,090 width=1,845) (actual time=296.575..296.577 rows=1 loops=1)

5.          

SubPlan (for Seq Scan)

6. 0.013 0.013 ↑ 1.0 1 1

Index Scan using crm_country_pkey on crm_country (cost=0.15..2.37 rows=1 width=4) (actual time=0.010..0.013 rows=1 loops=1)

  • Index Cond: (countryid = cp_request_1.countryid)
7. 0.007 0.007 ↑ 1.0 1 1

Seq Scan on erp_currency (cost=0.00..1.06 rows=1 width=4) (actual time=0.004..0.007 rows=1 loops=1)

  • Filter: (currencyid = cp_request_1.currencyid)
  • Rows Removed by Filter: 4
8. 0.013 0.013 ↑ 1.0 1 1

Index Scan using crm_account_idx6 on crm_account (cost=0.42..2.64 rows=1 width=4) (actual time=0.010..0.013 rows=1 loops=1)

  • Index Cond: (_import_accountid = cp_request_1.accountid)
9. 294.857 294.857 ↑ 1.0 1 1

Seq Scan on crm_account crm_account_1 (cost=0.00..55,685.97 rows=1 width=4) (actual time=123.478..294.857 rows=1 loops=1)

  • Filter: (_import_contactpersonid = cp_request_1.contactpersonid)
  • Rows Removed by Filter: 423487
10. 0.000 0.000 ↓ 0.0 0

Seq Scan on erp_currency erp_currency_2 (cost=1.06..2.12 rows=1 width=6) (never executed)

  • Filter: (currencyid = $5)
11.          

Initplan (for Seq Scan)

12. 0.000 0.000 ↓ 0.0 0

Seq Scan on erp_currency erp_currency_1 (cost=0.00..1.06 rows=1 width=4) (never executed)

  • Filter: (currencyid = cp_request_1.currencyid)
13. 0.000 0.000 ↓ 0.0 0

Seq Scan on erp_currency erp_currency_4 (cost=1.06..2.12 rows=1 width=6) (never executed)

  • Filter: (currencyid = $7)
14.          

Initplan (for Seq Scan)

15. 0.000 0.000 ↓ 0.0 0

Seq Scan on erp_currency erp_currency_3 (cost=0.00..1.06 rows=1 width=4) (never executed)

  • Filter: (currencyid = cp_request_1.currencyid)
16. 0.279 0.710 ↓ 0.0 0 1

Nested Loop (cost=0.43..3.79 rows=1 width=4) (actual time=0.708..0.710 rows=0 loops=1)

17. 0.159 0.159 ↓ 136.0 136 1

Index Scan using cp_region_idx on cp_region (cost=0.14..2.36 rows=1 width=4) (actual time=0.027..0.159 rows=136 loops=1)

  • Index Cond: (region_typeid = 2)
18. 0.272 0.272 ↓ 0.0 0 136

Index Only Scan using cp_request2region_idx3 on cp_request2region (cost=0.29..1.41 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=136)

  • Index Cond: ((regionid = cp_region.regionid) AND (requestid = cp_request_1.requestid))
  • Heap Fetches: 0
19. 0.223 0.884 ↓ 0.0 0 1

Nested Loop Semi Join (cost=1.01..5.63 rows=1 width=4) (actual time=0.882..0.884 rows=0 loops=1)

20. 0.116 0.116 ↓ 109.0 109 1

Index Scan using cp_region_idx on cp_region regtype2reg (cost=0.14..2.36 rows=1 width=8) (actual time=0.009..0.116 rows=109 loops=1)

  • Index Cond: (region_typeid = 2)
  • Filter: (safedelete_dt IS NULL)
  • Rows Removed by Filter: 27
21. 0.109 0.545 ↓ 0.0 0 109

Nested Loop (cost=0.86..3.26 rows=1 width=8) (actual time=0.005..0.005 rows=0 loops=109)

  • Join Filter: (regtype2reg.parentid = regtype1reg.regionid)
22. 0.218 0.436 ↓ 0.0 0 109

Nested Loop Anti Join (cost=0.72..3.04 rows=1 width=4) (actual time=0.004..0.004 rows=0 loops=109)

23. 0.218 0.218 ↓ 0.0 0 109

Index Only Scan using cp_request2region_idx3 on cp_request2region regtype1 (cost=0.29..1.41 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=109)

  • Index Cond: ((regionid = regtype2reg.parentid) AND (requestid = cp_request_1.requestid))
  • Heap Fetches: 0
24. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.43..1.63 rows=1 width=4) (never executed)

25. 0.000 0.000 ↓ 0.0 0

Index Scan using cp_region_idx1 on cp_region regtype2reg_2 (cost=0.14..0.20 rows=1 width=8) (never executed)

  • Index Cond: (parentid = regtype1.regionid)
  • Filter: (region_typeid = 2)
26. 0.000 0.000 ↓ 0.0 0

Index Only Scan using cp_request2region_idx3 on cp_request2region regtype2_2 (cost=0.29..1.41 rows=1 width=4) (never executed)

  • Index Cond: ((regionid = regtype2reg_2.regionid) AND (requestid = cp_request_1.requestid))
  • Heap Fetches: 0
27. 0.000 0.000 ↓ 0.0 0

Index Scan using cp_region_pkey on cp_region regtype1reg (cost=0.14..0.20 rows=1 width=4) (never executed)

  • Index Cond: (regionid = regtype1.regionid)
  • Filter: (region_typeid = 1)
28. 0.003 0.010 ↓ 0.0 0 1

Limit (cost=0.29..2.50 rows=1 width=27) (actual time=0.009..0.010 rows=0 loops=1)

29. 0.007 0.007 ↓ 0.0 0 1

Index Scan using cp_request_position_idx on cp_request_position (cost=0.29..2.50 rows=1 width=27) (actual time=0.006..0.007 rows=0 loops=1)

  • Index Cond: (requestid = cp_request_1.requestid)
30. 0.002 0.006 ↓ 0.0 0 1

Limit (cost=0.29..2.50 rows=1 width=1,284) (actual time=0.005..0.006 rows=0 loops=1)

31. 0.004 0.004 ↓ 0.0 0 1

Index Scan using cp_request_position_idx on cp_request_position cp_request_position_1 (cost=0.29..2.50 rows=1 width=1,284) (actual time=0.003..0.004 rows=0 loops=1)

  • Index Cond: (requestid = cp_request_1.requestid)
32. 0.002 0.006 ↓ 0.0 0 1

Limit (cost=0.29..2.50 rows=1 width=8) (actual time=0.005..0.006 rows=0 loops=1)

33. 0.004 0.004 ↓ 0.0 0 1

Index Scan using cp_request_position_idx on cp_request_position cp_request_position_2 (cost=0.29..2.50 rows=1 width=8) (actual time=0.003..0.004 rows=0 loops=1)

  • Index Cond: (requestid = cp_request_1.requestid)
34. 0.002 0.006 ↓ 0.0 0 1

Limit (cost=0.29..2.50 rows=1 width=12) (actual time=0.005..0.006 rows=0 loops=1)

35. 0.004 0.004 ↓ 0.0 0 1

Index Scan using cp_request_position_idx on cp_request_position cp_request_position_3 (cost=0.29..2.50 rows=1 width=12) (actual time=0.002..0.004 rows=0 loops=1)

  • Index Cond: (requestid = cp_request_1.requestid)
36. 0.002 0.006 ↓ 0.0 0 1

Limit (cost=0.29..2.50 rows=1 width=8) (actual time=0.005..0.006 rows=0 loops=1)

37. 0.004 0.004 ↓ 0.0 0 1

Index Scan using cp_request_position_idx on cp_request_position cp_request_position_4 (cost=0.29..2.50 rows=1 width=8) (actual time=0.003..0.004 rows=0 loops=1)

  • Index Cond: (requestid = cp_request_1.requestid)
Planning time : 1.538 ms
Execution time : 298.300 ms
Trigger times:
Trigger Name:Total time:Calls:Average time:
for constraint cp_request_fk 0.173 ms 1 0.173 ms
for constraint cp_request_fk1 0.083 ms 1 0.083 ms
for constraint cp_request_fk10 0.076 ms 1 0.076 ms
for constraint cp_request_fk11 0.051 ms 1 0.051 ms
for constraint cp_request_fk12 0.049 ms 1 0.049 ms
for constraint cp_request_fk2 0.051 ms 1 0.051 ms
for constraint cp_request_fk3 0.276 ms 1 0.276 ms
for constraint cp_request_fk4 0.139 ms 1 0.139 ms
for constraint cp_request_fk5 0.052 ms 1 0.052 ms
for constraint cp_request_fk6 0.101 ms 1 0.101 ms
for constraint cp_request_fk7 0.066 ms 1 0.066 ms
for constraint cp_request_fk8 0.062 ms 1 0.062 ms
for constraint cp_request_fk9 0.049 ms 1 0.049 ms
for constraint cp_request_sys_user_userid_fk 0.007 ms 1 0.007 ms