explain.depesz.com

PostgreSQL's explain analyze made readable

Result: f5Xm

Settings
# exclusive inclusive rows x rows loops node
1. 0.004 5,378.602 ↑ 1.0 25 1

Limit (cost=438,090.66..438,096.91 rows=25 width=1,333) (actual time=5,378.217..5,378.602 rows=25 loops=1)

2. 0.029 5,378.598 ↑ 14,764.6 25 1

Unique (cost=438,090.66..530,369.66 rows=369,116 width=1,333) (actual time=5,378.216..5,378.598 rows=25 loops=1)

3. 953.975 5,378.569 ↑ 14,764.6 25 1

Sort (cost=438,090.66..439,013.45 rows=369,116 width=1,333) (actual time=5,378.214..5,378.569 rows=25 loops=1)

  • Sort Key: invoice_invoice.received_date DESC, invoice_invoice.id, invoice_invoice.created_date, invoice_invoice.modified_date, invoice_invoice.user_id, invoice_invoice.vendor_id, invoice_invoice.source, invoice_invoice.invoice_type, invoice_invoice.invoice_currency, invoice_invoice.invoice_number, invoice_invoice.invoice_date, invoice_invoice.invoice_subject, invoice_invoice.invoice_status, invoice_invoice.approval_level, invoice_invoice.invoice_total, invoice_invoice.billing_start_date, invoice_invoice.billing_end_date, invoice_invoice.file_type, invoice_invoice.vendor_client_id, invoice_invoice.assigned_to_user_id, invoice_invoice.invoice_net, invoice_invoice.invoice_tax, invoice_invoice.withholding_tax, invoice_invoice.invoice_amount_due, invoice_invoice.native_currency, invoice_invoice.native_total, invoice_invoice.native_net, invoice_invoice.native_tax, invoice_invoice.native_withholding_tax, invoice_invoice.native_invoice_amount_due, invoice_invoice.exchange_rate, invoice_invoice.read_only, invoice_invoice.po_number, invoice_invoice.po_id, invoice_invoice.original_invoice_date, invoice_invoice.original_invoice_subject, invoice_invoice.other_attributes, invoice_invoice.review_id, invoice_vendor.id, invoice_vendor.user_id, invoice_vendor.people_team_id, invoice_vendor.client_id, invoice_vendor.vendor_name, invoice_vendor.vendor_ein, invoice_vendor.vendor_email, invoice_vendor.vendor_phone, invoice_vendor.vendor_contact_name, invoice_vendor.vendor_address_1, invoice_vendor.vendor_address_2, invoice_vendor.vendor_city, invoice_vendor.vendor_state, invoice_vendor.vendor_zip, invoice_vendor.vendor_country, invoice_vendor.vendor_type, invoice_vendor.vendor_status, invoice_vendor.extra_text, invoice_vendor.accruals_enabled, invoice_vendor.tk_rates_enabled, invoice_vendor.pdf_required, invoice_vendor.po_id, invoice_vendor.accounting_code, invoice_vendor.other_attributes, invoice_vendor.tax_authority_id, invoice_vendor.created_date, invoice_vendor.modified_date, invoice_vendor.vendor_bank_id, invoice_vendor.vendor_start_date, invoice_vendor.vendor_end_date, invoice_vendor.vendor_receive_domain, invoice_vendor.vendor_system, invoice_vendor.vendor_client_id, invoice_vendor.vendor_routing_number, invoice_vendor.vendor_account_number, invoice_vendor.vendor_swift_code, invoice_vendor.vendor_wmpd_indic, invoice_vendor.vendor_group_id, invoice_vendor.invoice_reviewer_config_id, invoice_vendor.default_template_id, invoice_vendor.max_cg_admins, invoice_vendor.invoicing_enabled, api_vendorhash.id, api_vendorhash.vendor_id, api_vendorhash.vendor_hash, invoice_purchaseorders.id, invoice_purchaseorders.created_by_user_id, invoice_purchaseorders.client_id, invoice_purchaseorders.po, invoice_purchaseorders.currency, invoice_purchaseorders.amount, invoice_purchaseorders.description, invoice_purchaseorders.enabled, invoice_purchaseorders.deleted, invoice_purchaseorders.created_date, invoice_purchaseorders.modified_date, invoice_purchaseorders.other_attributes, invoice_purchaseorders.external_id, api_invoicehash.id, api_invoicehash.invoice_id, api_invoicehash.invoice_hash
  • Sort Method: external merge Disk: 340,080kB
4. 417.449 4,424.594 ↓ 1.1 421,847 1

Hash Left Join (cost=221,809.07..250,759.03 rows=369,116 width=1,333) (actual time=2,609.986..4,424.594 rows=421,847 loops=1)

  • Hash Cond: (invoice_invoice.id = api_invoicehash.invoice_id)
5. 320.177 3,836.813 ↓ 1.1 421,847 1

Hash Left Join (cost=209,215.52..237,196.53 rows=369,116 width=1,306) (actual time=2,438.636..3,836.813 rows=421,847 loops=1)

  • Hash Cond: (invoice_invoice.po_id = invoice_purchaseorders.id)
6. 309.545 3,516.625 ↓ 1.1 421,847 1

Hash Left Join (cost=209,214.49..236,226.58 rows=369,116 width=858) (actual time=2,438.614..3,516.625 rows=421,847 loops=1)

  • Hash Cond: (invoice_vendor.id = api_vendorhash.vendor_id)
7. 447.530 3,205.195 ↓ 1.1 421,847 1

Hash Left Join (cost=209,052.73..235,095.05 rows=369,116 width=810) (actual time=2,436.693..3,205.195 rows=421,847 loops=1)

  • Hash Cond: (invoice_invoice.vendor_id = invoice_vendor.id)
8. 443.156 2,750.170 ↓ 1.1 421,847 1

Seq Scan on invoice_invoice (cost=208,613.96..233,686.52 rows=369,116 width=342) (actual time=2,429.147..2,750.170 rows=421,847 loops=1)

  • Filter: ((client_id = 1) AND ((assigned_to_user_id = 3) OR (hashed SubPlan 1) OR (hashed SubPlan 2) OR (hashed SubPlan 9)))
9.          

SubPlan (for Seq Scan)

10. 0.302 82.097 ↓ 0.0 0 1

Hash Join (cost=19,035.47..40,996.91 rows=60,721 width=4) (actual time=81.986..82.097 rows=0 loops=1)

  • Hash Cond: (w0.review_id = reviews_review.id)
11. 0.009 0.009 ↑ 421,847.0 1 1

Seq Scan on invoice_invoice w0 (cost=0.00..20,854.09 rows=421,847 width=8) (actual time=0.009..0.009 rows=1 loops=1)

  • Filter: (client_id = 1)
12. 0.001 81.786 ↓ 0.0 0 1

Hash (cost=18,276.45..18,276.45 rows=60,721 width=4) (actual time=81.677..81.786 rows=0 loops=1)

  • Buckets: 65,536 Batches: 1 Memory Usage: 512kB
13. 0.395 81.785 ↓ 0.0 0 1

HashAggregate (cost=17,062.03..17,669.24 rows=60,721 width=4) (actual time=81.676..81.785 rows=0 loops=1)

  • Group Key: reviews_review.id
14. 0.004 81.390 ↓ 0.0 0 1

Append (cost=355.77..16,910.23 rows=60,721 width=4) (actual time=81.280..81.390 rows=0 loops=1)

15. 0.001 0.758 ↓ 0.0 0 1

Nested Loop (cost=355.77..7,292.68 rows=12,030 width=4) (actual time=0.755..0.758 rows=0 loops=1)

16. 0.025 0.757 ↓ 0.0 0 1

Nested Loop (cost=355.35..703.96 rows=12,030 width=4) (actual time=0.754..0.757 rows=0 loops=1)

17. 0.044 0.620 ↑ 1.0 56 1

HashAggregate (cost=355.06..355.62 rows=56 width=8) (actual time=0.599..0.620 rows=56 loops=1)

  • Group Key: u0.id
18. 0.008 0.576 ↑ 1.0 56 1

Nested Loop (cost=3.60..354.92 rows=56 width=8) (actual time=0.131..0.576 rows=56 loops=1)

19. 0.053 0.456 ↑ 1.0 56 1

Nested Loop (cost=3.31..336.22 rows=56 width=16) (actual time=0.120..0.456 rows=56 loops=1)

20. 0.032 0.291 ↑ 1.0 56 1

Nested Loop (cost=3.02..317.51 rows=56 width=12) (actual time=0.096..0.291 rows=56 loops=1)

21. 0.045 0.091 ↑ 1.0 56 1

Bitmap Heap Scan on teams_membership u3 (cost=2.73..91.59 rows=56 width=4) (actual time=0.058..0.091 rows=56 loops=1)

  • Recheck Cond: (user_id = 3)
  • Heap Blocks: exact=3
22. 0.046 0.046 ↑ 1.0 56 1

Bitmap Index Scan on teams_membership_user_id_team_id_9e94b906_idx (cost=0.00..2.71 rows=56 width=0) (actual time=0.046..0.046 rows=56 loops=1)

  • Index Cond: (user_id = 3)
23. 0.168 0.168 ↑ 1.0 1 56

Index Only Scan using teams_subteamclosure_descendant_id_ancestor_id_7bc282c4_idx on teams_subteamclosure u1 (cost=0.29..4.02 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=56)

  • Index Cond: (descendant_id = u3.team_id)
  • Heap Fetches: 56
24. 0.112 0.112 ↑ 1.0 1 56

Index Only Scan using teams_team_pkey on teams_team u0 (cost=0.29..0.33 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=56)

  • Index Cond: (id = u1.ancestor_id)
  • Heap Fetches: 56
25. 0.112 0.112 ↑ 1.0 1 56

Index Only Scan using teams_team_pkey on teams_team u2 (cost=0.29..0.33 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=56)

  • Index Cond: (id = u1.descendant_id)
  • Heap Fetches: 56
26. 0.112 0.112 ↓ 0.0 0 56

Index Scan using reviews_review_reviewing_teams_cache_team_id_17552657 on reviews_review_reviewing_teams_cache (cost=0.29..4.07 rows=215 width=8) (actual time=0.002..0.002 rows=0 loops=56)

  • Index Cond: (team_id = u0.id)
27. 0.000 0.000 ↓ 0.0 0

Index Scan using reviews_review_pkey on reviews_review (cost=0.42..0.55 rows=1 width=4) (never executed)

  • Index Cond: (id = reviews_review_reviewing_teams_cache.review_id)
  • Filter: (client_id = 1)
28. 1.229 80.628 ↓ 0.0 0 1

Hash Semi Join (cost=4,227.65..9,010.34 rows=48,691 width=4) (actual time=80.524..80.628 rows=0 loops=1)

  • Hash Cond: (reviews_reviewerconfig_subscribers.team_id = u0_1.id)
29. 14.431 78.841 ↓ 1.3 10,784 1

Gather (cost=3,872.03..8,554.30 rows=8,617 width=8) (actual time=51.600..78.841 rows=10,784 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
30. 2.703 64.410 ↓ 1.0 3,595 3 / 3

Nested Loop (cost=2,872.03..6,692.60 rows=3,590 width=8) (actual time=42.849..64.410 rows=3,595 loops=3)

31. 4.438 54.518 ↓ 1.0 3,595 3 / 3

Hash Join (cost=2,871.61..4,690.25 rows=3,590 width=8) (actual time=42.816..54.518 rows=3,595 loops=3)

  • Hash Cond: (reviews_review_associated_reviewer_configs.reviewerconfig_id = reviews_reviewerconfig.id)
32. 7.519 7.519 ↑ 1.2 24,704 3 / 3

Parallel Index Only Scan using reviews_review_associate_review_id_reviewerconfig_205b8d71_uniq on reviews_review_associated_reviewer_configs (cost=0.29..1,667.23 rows=30,880 width=8) (actual time=0.084..7.519 rows=24,704 loops=3)

  • Heap Fetches: 27,084
33. 3.041 42.561 ↑ 1.0 10,865 3 / 3

Hash (cost=2,735.51..2,735.51 rows=10,865 width=12) (actual time=42.560..42.561 rows=10,865 loops=3)

  • Buckets: 16,384 Batches: 1 Memory Usage: 595kB
34. 21.126 39.520 ↑ 1.0 10,865 3 / 3

Hash Join (cost=303.46..2,735.51 rows=10,865 width=12) (actual time=4.916..39.520 rows=10,865 loops=3)

  • Hash Cond: (reviews_reviewerconfig.id = reviews_reviewerconfig_subscribers.reviewerconfig_id)
35. 13.805 13.805 ↑ 1.0 93,451 3 / 3

Seq Scan on reviews_reviewerconfig (cost=0.00..1,622.51 rows=93,451 width=4) (actual time=0.024..13.805 rows=93,451 loops=3)

36. 2.326 4.589 ↑ 1.0 10,865 3 / 3

Hash (cost=167.65..167.65 rows=10,865 width=8) (actual time=4.588..4.589 rows=10,865 loops=3)

  • Buckets: 16,384 Batches: 1 Memory Usage: 553kB
37. 2.263 2.263 ↑ 1.0 10,865 3 / 3

Seq Scan on reviews_reviewerconfig_subscribers (cost=0.00..167.65 rows=10,865 width=8) (actual time=0.027..2.263 rows=10,865 loops=3)

38. 7.189 7.189 ↑ 1.0 1 10,784 / 3

Index Scan using reviews_review_pkey on reviews_review reviews_review_1 (cost=0.42..0.56 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=10,784)

  • Index Cond: (id = reviews_review_associated_reviewer_configs.review_id)
  • Filter: (client_id = 1)
39. 0.023 0.558 ↑ 1.0 56 1

Hash (cost=354.92..354.92 rows=56 width=8) (actual time=0.555..0.558 rows=56 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
40. 0.047 0.535 ↑ 1.0 56 1

Nested Loop (cost=3.60..354.92 rows=56 width=8) (actual time=0.061..0.535 rows=56 loops=1)

41. 0.048 0.376 ↑ 1.0 56 1

Nested Loop (cost=3.31..336.22 rows=56 width=16) (actual time=0.044..0.376 rows=56 loops=1)

42. 0.014 0.216 ↑ 1.0 56 1

Nested Loop (cost=3.02..317.51 rows=56 width=12) (actual time=0.032..0.216 rows=56 loops=1)

43. 0.020 0.034 ↑ 1.0 56 1

Bitmap Heap Scan on teams_membership u3_1 (cost=2.73..91.59 rows=56 width=4) (actual time=0.021..0.034 rows=56 loops=1)

  • Recheck Cond: (user_id = 3)
  • Heap Blocks: exact=3
44. 0.014 0.014 ↑ 1.0 56 1

Bitmap Index Scan on teams_membership_user_id_team_id_9e94b906_idx (cost=0.00..2.71 rows=56 width=0) (actual time=0.013..0.014 rows=56 loops=1)

  • Index Cond: (user_id = 3)
45. 0.168 0.168 ↑ 1.0 1 56

Index Only Scan using teams_subteamclosure_descendant_id_ancestor_id_7bc282c4_idx on teams_subteamclosure u1_1 (cost=0.29..4.02 rows=1 width=8) (actual time=0.002..0.003 rows=1 loops=56)

  • Index Cond: (descendant_id = u3_1.team_id)
  • Heap Fetches: 56
46. 0.112 0.112 ↑ 1.0 1 56

Index Only Scan using teams_team_pkey on teams_team u0_1 (cost=0.29..0.33 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=56)

  • Index Cond: (id = u1_1.ancestor_id)
  • Heap Fetches: 56
47. 0.112 0.112 ↑ 1.0 1 56

Index Only Scan using teams_team_pkey on teams_team u2_1 (cost=0.29..0.33 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=56)

  • Index Cond: (id = u1_1.descendant_id)
  • Heap Fetches: 56
48. 11.665 1,943.861 ↓ 0.0 0 1

Gather (cost=1,358.91..86,602.95 rows=79,903 width=4) (actual time=1,943.750..1,943.861 rows=0 loops=1)

  • Workers Planned: 4
  • Workers Launched: 4
49. 0.002 1,932.196 ↓ 0.0 0 5 / 5

Nested Loop (cost=358.91..77,612.65 rows=19,976 width=4) (actual time=1,932.190..1,932.196 rows=0 loops=5)

50. 66.572 1,932.194 ↓ 0.0 0 5 / 5

Hash Semi Join (cost=358.48..68,434.80 rows=19,976 width=4) (actual time=1,932.189..1,932.194 rows=0 loops=5)

  • Hash Cond: (v4.people_team_id = u0_2.id)
51. 443.724 1,865.115 ↓ 27.1 540,997 5 / 5

Nested Loop (cost=2.87..67,804.52 rows=19,976 width=8) (actual time=0.167..1,865.115 rows=540,997 loops=5)

52. 179.075 339.396 ↓ 27.1 540,997 5 / 5

Hash Join (cost=2.44..57,405.22 rows=19,976 width=8) (actual time=0.128..339.396 rows=540,997 loops=5)

  • Hash Cond: (v3.legal_entity_id = v4.id)
53. 160.271 160.271 ↑ 1.2 543,338 5 / 5

Parallel Seq Scan on invoice_lineitemallocation v3 (cost=0.00..55,398.65 rows=679,172 width=8) (actual time=0.029..160.271 rows=543,338 loops=5)

  • Filter: (client_id = 1)
54. 0.015 0.050 ↓ 34.0 34 5 / 5

Hash (cost=2.42..2.42 rows=1 width=8) (actual time=0.049..0.050 rows=34 loops=5)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
55. 0.035 0.035 ↓ 34.0 34 5 / 5

Seq Scan on matters_legalentity v4 (cost=0.00..2.42 rows=1 width=8) (actual time=0.018..0.035 rows=34 loops=5)

  • Filter: (client_id = 1)
56. 1,081.995 1,081.995 ↑ 1.0 1 2,704,987 / 5

Index Scan using invoice_invoicelineitems_pkey on invoice_invoicelineitems v2 (cost=0.43..0.52 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=2,704,987)

  • Index Cond: (id = v3.line_item_id)
  • Filter: (client_id = 1)
57. 0.020 0.507 ↑ 1.0 56 5 / 5

Hash (cost=354.92..354.92 rows=56 width=8) (actual time=0.504..0.507 rows=56 loops=5)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
58. 0.061 0.487 ↑ 1.0 56 5 / 5

Nested Loop (cost=3.60..354.92 rows=56 width=8) (actual time=0.093..0.487 rows=56 loops=5)

59. 0.039 0.370 ↑ 1.0 56 5 / 5

Nested Loop (cost=3.31..336.22 rows=56 width=16) (actual time=0.083..0.370 rows=56 loops=5)

60. 0.053 0.219 ↑ 1.0 56 5 / 5

Nested Loop (cost=3.02..317.51 rows=56 width=12) (actual time=0.061..0.219 rows=56 loops=5)

61. 0.031 0.054 ↑ 1.0 56 5 / 5

Bitmap Heap Scan on teams_membership u3_2 (cost=2.73..91.59 rows=56 width=4) (actual time=0.035..0.054 rows=56 loops=5)

  • Recheck Cond: (user_id = 3)
  • Heap Blocks: exact=3
62. 0.023 0.023 ↑ 1.0 56 5 / 5

Bitmap Index Scan on teams_membership_user_id_team_id_9e94b906_idx (cost=0.00..2.71 rows=56 width=0) (actual time=0.023..0.023 rows=56 loops=5)

  • Index Cond: (user_id = 3)
63. 0.112 0.112 ↑ 1.0 1 280 / 5

Index Only Scan using teams_subteamclosure_descendant_id_ancestor_id_7bc282c4_idx on teams_subteamclosure u1_2 (cost=0.29..4.02 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=280)

  • Index Cond: (descendant_id = u3_2.team_id)
  • Heap Fetches: 56
64. 0.112 0.112 ↑ 1.0 1 280 / 5

Index Only Scan using teams_team_pkey on teams_team u0_2 (cost=0.29..0.33 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=280)

  • Index Cond: (id = u1_2.ancestor_id)
  • Heap Fetches: 56
65. 0.056 0.056 ↑ 1.0 1 280 / 5

Index Only Scan using teams_team_pkey on teams_team u2_2 (cost=0.29..0.33 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=280)

  • Index Cond: (id = u1_2.descendant_id)
  • Heap Fetches: 56
66. 0.000 0.000 ↓ 0.0 0 / 5

Index Scan using invoice_invoice_pkey on invoice_invoice v0 (cost=0.42..0.46 rows=1 width=4) (never executed)

  • Index Cond: (id = v2.invoice_id)
  • Filter: (client_id = 1)
67. 189.867 281.056 ↓ 2.0 421,847 1

Seq Scan on invoice_invoice z0 (cost=58,226.52..80,135.22 rows=210,924 width=4) (actual time=91.741..281.056 rows=421,847 loops=1)

  • Filter: ((NOT (hashed SubPlan 8)) AND (client_id = 1))
68.          

SubPlan (for Seq Scan)

69. 11.147 91.189 ↓ 0.0 0 1

Gather (cost=14,430.53..58,072.13 rows=61,755 width=4) (actual time=91.069..91.189 rows=0 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
70. 0.001 80.042 ↓ 0.0 0 2 / 2

Nested Loop (cost=13,430.53..50,896.63 rows=36,326 width=4) (actual time=80.024..80.042 rows=0 loops=2)

71. 0.002 80.041 ↓ 0.0 0 2 / 2

Nested Loop (cost=13,430.10..31,081.37 rows=36,326 width=4) (actual time=80.023..80.041 rows=0 loops=2)

72. 32.859 80.039 ↓ 0.0 0 2 / 2

Parallel Seq Scan on matters_matters x0 (cost=13,429.67..16,742.38 rows=1,405 width=4) (actual time=80.022..80.039 rows=0 loops=2)

  • Filter: ((NOT (hashed SubPlan 3)) AND (NOT (hashed SubPlan 4)) AND (NOT (hashed SubPlan 5)) AND (NOT (hashed SubPlan 6)) AND (NOT (hashed SubPlan 7)) AND (client_id = 1))
  • Rows Removed by Filter: 38,206
73.          

SubPlan (for Parallel Seq Scan)

74. 21.862 47.180 ↑ 1.0 76,412 2 / 2

Hash Join (cost=224.18..4,418.99 rows=76,412 width=4) (actual time=0.588..47.180 rows=76,412 loops=2)

  • Hash Cond: (w0_1.read_perm_id = v0_1.id)
75. 24.788 24.788 ↑ 1.0 76,412 2 / 2

Seq Scan on matters_matters w0_1 (cost=0.00..3,144.15 rows=76,412 width=8) (actual time=0.009..24.788 rows=76,412 loops=2)

  • Filter: (client_id = 1)
76. 0.006 0.530 ↑ 1.0 8 2 / 2

Hash (cost=224.08..224.08 rows=8 width=8) (actual time=0.525..0.530 rows=8 loops=2)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
77. 0.015 0.524 ↑ 1.0 8 2 / 2

HashAggregate (cost=224.00..224.08 rows=8 width=8) (actual time=0.517..0.524 rows=8 loops=2)

  • Group Key: v0_1.id
78. 0.022 0.509 ↑ 1.9 23 2 / 2

Hash Join (cost=2.35..223.89 rows=43 width=8) (actual time=0.143..0.509 rows=23 loops=2)

  • Hash Cond: (v1.permission_id = v0_1.id)
79. 0.025 0.469 ↑ 1.9 23 2 / 2

Nested Loop Semi Join (cost=1.17..222.59 rows=43 width=4) (actual time=0.112..0.469 rows=23 loops=2)

80. 0.014 0.014 ↑ 1.0 43 2 / 2

Seq Scan on teams_permissionteam v1 (cost=0.00..1.43 rows=43 width=8) (actual time=0.009..0.014 rows=43 loops=2)

81. 0.000 0.430 ↑ 1.0 1 86 / 2

Nested Loop (cost=1.17..5.13 rows=1 width=8) (actual time=0.010..0.010 rows=1 loops=86)

82. 0.043 0.344 ↑ 1.0 1 86 / 2

Nested Loop (cost=0.88..4.79 rows=1 width=16) (actual time=0.007..0.008 rows=1 loops=86)

83. 0.043 0.258 ↑ 1.0 1 86 / 2

Nested Loop (cost=0.58..4.46 rows=1 width=12) (actual time=0.005..0.006 rows=1 loops=86)

84. 0.129 0.129 ↑ 1.0 1 86 / 2

Index Only Scan using teams_team_pkey on teams_team u0_3 (cost=0.29..4.12 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=86)

  • Index Cond: (id = v1.team_id)
  • Heap Fetches: 43
85. 0.086 0.086 ↑ 1.0 1 86 / 2

Index Only Scan using teams_subteamclosure_ancestor_id_descendant_id_8be13299_uniq on teams_subteamclosure u1_3 (cost=0.29..0.33 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=86)

  • Index Cond: (ancestor_id = u0_3.id)
  • Heap Fetches: 43
86. 0.043 0.043 ↑ 1.0 1 86 / 2

Index Only Scan using teams_team_pkey on teams_team u2_3 (cost=0.29..0.33 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=86)

  • Index Cond: (id = u1_3.descendant_id)
  • Heap Fetches: 43
87. 0.086 0.086 ↑ 1.0 1 86 / 2

Index Only Scan using teams_membership_user_id_team_id_9e94b906_idx on teams_membership u3_3 (cost=0.29..0.33 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=86)

  • Index Cond: ((user_id = 3) AND (team_id = u1_3.descendant_id))
  • Heap Fetches: 23
88. 0.007 0.018 ↑ 1.0 8 2 / 2

Hash (cost=1.08..1.08 rows=8 width=4) (actual time=0.018..0.018 rows=8 loops=2)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
89. 0.011 0.011 ↑ 1.0 8 2 / 2

Seq Scan on teams_permission v0_1 (cost=0.00..1.08 rows=8 width=4) (actual time=0.010..0.011 rows=8 loops=2)

90. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=81.89..2,426.09 rows=682 width=4) (never executed)

  • Join Filter: (v0_2.id = w0_2.read_perm_id)
91. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=7.36..12.72 rows=1 width=12) (never executed)

92. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop Semi Join (cost=1.17..6.50 rows=1 width=4) (never executed)

93. 0.000 0.000 ↓ 0.0 0 / 2

Seq Scan on matters_mattergroup w2 (cost=0.00..1.18 rows=1 width=8) (never executed)

  • Filter: (client_id = 1)
94. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=1.17..5.32 rows=1 width=8) (never executed)

95. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=0.88..4.98 rows=1 width=16) (never executed)

96. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=0.58..4.65 rows=1 width=12) (never executed)

97. 0.000 0.000 ↓ 0.0 0 / 2

Index Only Scan using teams_team_pkey on teams_team u0_4 (cost=0.29..4.31 rows=1 width=4) (never executed)

  • Index Cond: (id = w2.people_team_id)
  • Heap Fetches: 0
98. 0.000 0.000 ↓ 0.0 0 / 2

Index Only Scan using teams_subteamclosure_ancestor_id_descendant_id_8be13299_uniq on teams_subteamclosure u1_4 (cost=0.29..0.33 rows=1 width=8) (never executed)

  • Index Cond: (ancestor_id = u0_4.id)
  • Heap Fetches: 0
99. 0.000 0.000 ↓ 0.0 0 / 2

Index Only Scan using teams_team_pkey on teams_team u2_4 (cost=0.29..0.33 rows=1 width=4) (never executed)

  • Index Cond: (id = u1_4.descendant_id)
  • Heap Fetches: 0
100. 0.000 0.000 ↓ 0.0 0 / 2

Index Only Scan using teams_membership_user_id_team_id_9e94b906_idx on teams_membership u3_4 (cost=0.29..0.33 rows=1 width=4) (never executed)

  • Index Cond: ((user_id = 3) AND (team_id = u1_4.descendant_id))
  • Heap Fetches: 0
101. 0.000 0.000 ↓ 0.0 0 / 2

HashAggregate (cost=6.19..6.20 rows=1 width=8) (never executed)

  • Group Key: v0_2.id
102. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=4.46..6.19 rows=1 width=8) (never executed)

103. 0.000 0.000 ↓ 0.0 0 / 2

Hash Join (cost=4.33..5.87 rows=1 width=4) (never executed)

  • Hash Cond: (v1_1.team_id = u0_5.id)
104. 0.000 0.000 ↓ 0.0 0 / 2

Seq Scan on teams_permissionteam v1_1 (cost=0.00..1.43 rows=43 width=8) (never executed)

105. 0.000 0.000 ↓ 0.0 0 / 2

Hash (cost=4.31..4.31 rows=1 width=4) (never executed)

106. 0.000 0.000 ↓ 0.0 0 / 2

Index Scan using teams_team_system_managed_f60768d0_like on teams_team u0_5 (cost=0.29..4.31 rows=1 width=4) (never executed)

  • Index Cond: (system_managed = 'mattergroup'::text)
  • Filter: (client_id = 1)
107. 0.000 0.000 ↓ 0.0 0 / 2

Index Only Scan using teams_permission_pkey on teams_permission v0_2 (cost=0.13..0.29 rows=1 width=4) (never executed)

  • Index Cond: (id = v1_1.permission_id)
  • Heap Fetches: 0
108. 0.000 0.000 ↓ 0.0 0 / 2

Bitmap Heap Scan on matters_matters w0_2 (cost=74.52..2,345.26 rows=5,449 width=12) (never executed)

  • Recheck Cond: (matter_group_id = w2.id)
  • Filter: (client_id = 1)
109. 0.000 0.000 ↓ 0.0 0 / 2

Bitmap Index Scan on matters_matters_matter_group_id_f0949d04 (cost=0.00..73.16 rows=5,449 width=0) (never executed)

  • Index Cond: (matter_group_id = w2.id)
110. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=49.70..2,119.55 rows=281 width=4) (never executed)

  • Join Filter: (v0_3.id = w0_3.read_perm_id)
111. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=7.36..13.97 rows=1 width=12) (never executed)

112. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop Semi Join (cost=1.17..7.75 rows=1 width=4) (never executed)

113. 0.000 0.000 ↓ 0.0 0 / 2

Seq Scan on matters_legalentity w2_1 (cost=0.00..2.42 rows=1 width=8) (never executed)

  • Filter: (client_id = 1)
114. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=1.17..5.32 rows=1 width=8) (never executed)

115. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=0.88..4.98 rows=1 width=16) (never executed)

116. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=0.58..4.65 rows=1 width=12) (never executed)

117. 0.000 0.000 ↓ 0.0 0 / 2

Index Only Scan using teams_team_pkey on teams_team u0_6 (cost=0.29..4.31 rows=1 width=4) (never executed)

  • Index Cond: (id = w2_1.people_team_id)
  • Heap Fetches: 0
118. 0.000 0.000 ↓ 0.0 0 / 2

Index Only Scan using teams_subteamclosure_ancestor_id_descendant_id_8be13299_uniq on teams_subteamclosure u1_5 (cost=0.29..0.33 rows=1 width=8) (never executed)

  • Index Cond: (ancestor_id = u0_6.id)
  • Heap Fetches: 0
119. 0.000 0.000 ↓ 0.0 0 / 2

Index Only Scan using teams_team_pkey on teams_team u2_5 (cost=0.29..0.33 rows=1 width=4) (never executed)

  • Index Cond: (id = u1_5.descendant_id)
  • Heap Fetches: 0
120. 0.000 0.000 ↓ 0.0 0 / 2

Index Only Scan using teams_membership_user_id_team_id_9e94b906_idx on teams_membership u3_5 (cost=0.29..0.33 rows=1 width=4) (never executed)

  • Index Cond: ((user_id = 3) AND (team_id = u1_5.descendant_id))
  • Heap Fetches: 0
121. 0.000 0.000 ↓ 0.0 0 / 2

HashAggregate (cost=6.19..6.20 rows=1 width=8) (never executed)

  • Group Key: v0_3.id
122. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=4.46..6.19 rows=1 width=8) (never executed)

123. 0.000 0.000 ↓ 0.0 0 / 2

Hash Join (cost=4.33..5.87 rows=1 width=4) (never executed)

  • Hash Cond: (v1_2.team_id = u0_7.id)
124. 0.000 0.000 ↓ 0.0 0 / 2

Seq Scan on teams_permissionteam v1_2 (cost=0.00..1.43 rows=43 width=8) (never executed)

125. 0.000 0.000 ↓ 0.0 0 / 2

Hash (cost=4.31..4.31 rows=1 width=4) (never executed)

126. 0.000 0.000 ↓ 0.0 0 / 2

Index Scan using teams_team_system_managed_f60768d0_like on teams_team u0_7 (cost=0.29..4.31 rows=1 width=4) (never executed)

  • Index Cond: (system_managed = 'legalentity'::text)
  • Filter: (client_id = 1)
127. 0.000 0.000 ↓ 0.0 0 / 2

Index Only Scan using teams_permission_pkey on teams_permission v0_3 (cost=0.13..0.29 rows=1 width=4) (never executed)

  • Index Cond: (id = v1_2.permission_id)
  • Heap Fetches: 0
128. 0.000 0.000 ↓ 0.0 0 / 2

Bitmap Heap Scan on matters_matters w0_3 (cost=42.33..2,066.80 rows=3,102 width=12) (never executed)

  • Recheck Cond: (legal_entity_id = w2_1.id)
  • Filter: (client_id = 1)
129. 0.000 0.000 ↓ 0.0 0 / 2

Bitmap Index Scan on matters_matters_b2dbc6f0 (cost=0.00..41.56 rows=3,102 width=0) (never executed)

  • Index Cond: (legal_entity_id = w2_1.id)
130. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop Semi Join (cost=360.52..3,885.18 rows=983 width=4) (never executed)

  • Join Filter: (w0_4.read_perm_id = v0_4.id)
131. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=356.06..3,761.05 rows=7,862 width=8) (never executed)

132. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=355.77..1,249.58 rows=7,862 width=4) (never executed)

133. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=355.34..373.43 rows=56 width=4) (never executed)

134. 0.000 0.000 ↓ 0.0 0 / 2

HashAggregate (cost=355.06..355.62 rows=56 width=8) (never executed)

  • Group Key: u0_8.id
135. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=3.60..354.92 rows=56 width=8) (never executed)

136. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=3.31..336.22 rows=56 width=16) (never executed)

137. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=3.02..317.51 rows=56 width=12) (never executed)

138. 0.000 0.000 ↓ 0.0 0 / 2

Bitmap Heap Scan on teams_membership u3_6 (cost=2.73..91.59 rows=56 width=4) (never executed)

  • Recheck Cond: (user_id = 3)
139. 0.000 0.000 ↓ 0.0 0 / 2

Bitmap Index Scan on teams_membership_user_id_team_id_9e94b906_idx (cost=0.00..2.71 rows=56 width=0) (never executed)

  • Index Cond: (user_id = 3)
140. 0.000 0.000 ↓ 0.0 0 / 2

Index Only Scan using teams_subteamclosure_descendant_id_ancestor_id_7bc282c4_idx on teams_subteamclosure u1_6 (cost=0.29..4.02 rows=1 width=8) (never executed)

  • Index Cond: (descendant_id = u3_6.team_id)
  • Heap Fetches: 0
141. 0.000 0.000 ↓ 0.0 0 / 2

Index Only Scan using teams_team_pkey on teams_team u0_8 (cost=0.29..0.33 rows=1 width=4) (never executed)

  • Index Cond: (id = u1_6.ancestor_id)
  • Heap Fetches: 0
142. 0.000 0.000 ↓ 0.0 0 / 2

Index Only Scan using teams_team_pkey on teams_team u2_6 (cost=0.29..0.33 rows=1 width=4) (never executed)

  • Index Cond: (id = u1_6.descendant_id)
  • Heap Fetches: 0
143. 0.000 0.000 ↓ 0.0 0 / 2

Index Scan using invoice_vendor_people_team_id_e2bba6b2 on invoice_vendor w4 (cost=0.28..0.31 rows=1 width=8) (never executed)

  • Index Cond: (people_team_id = u0_8.id)
144. 0.000 0.000 ↓ 0.0 0 / 2

Index Scan using matters_referral_vendor_id_matter_id_44190561_idx on matters_referral w2_2 (cost=0.42..11.80 rows=385 width=8) (never executed)

  • Index Cond: (vendor_id = w4.id)
  • Filter: (client_id = 1)
145. 0.000 0.000 ↓ 0.0 0 / 2

Index Scan using matters_matters_pkey on matters_matters w0_4 (cost=0.29..0.32 rows=1 width=8) (never executed)

  • Index Cond: (id = w2_2.matter_id)
  • Filter: (client_id = 1)
146. 0.000 0.000 ↓ 0.0 0 / 2

Materialize (cost=4.46..6.20 rows=1 width=8) (never executed)

147. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=4.46..6.19 rows=1 width=8) (never executed)

148. 0.000 0.000 ↓ 0.0 0 / 2

Hash Join (cost=4.33..5.87 rows=1 width=4) (never executed)

  • Hash Cond: (v1_3.team_id = u0_9.id)
149. 0.000 0.000 ↓ 0.0 0 / 2

Seq Scan on teams_permissionteam v1_3 (cost=0.00..1.43 rows=43 width=8) (never executed)

150. 0.000 0.000 ↓ 0.0 0 / 2

Hash (cost=4.31..4.31 rows=1 width=4) (never executed)

151. 0.000 0.000 ↓ 0.0 0 / 2

Index Scan using teams_team_system_managed_f60768d0_like on teams_team u0_9 (cost=0.29..4.31 rows=1 width=4) (never executed)

  • Index Cond: (system_managed = 'vendor'::text)
  • Filter: (client_id = 1)
152. 0.000 0.000 ↓ 0.0 0 / 2

Index Only Scan using teams_permission_pkey on teams_permission v0_4 (cost=0.13..0.29 rows=1 width=4) (never executed)

  • Index Cond: (id = v1_3.permission_id)
  • Heap Fetches: 0
153. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop Semi Join (cost=359.81..383.83 rows=56 width=4) (never executed)

  • Join Filter: (w0_5.read_perm_id = v0_5.id)
154. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=355.35..376.80 rows=56 width=8) (never executed)

155. 0.000 0.000 ↓ 0.0 0 / 2

HashAggregate (cost=355.06..355.62 rows=56 width=8) (never executed)

  • Group Key: u0_10.id
156. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=3.60..354.92 rows=56 width=8) (never executed)

157. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=3.31..336.22 rows=56 width=16) (never executed)

158. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=3.02..317.51 rows=56 width=12) (never executed)

159. 0.000 0.000 ↓ 0.0 0 / 2

Bitmap Heap Scan on teams_membership u3_7 (cost=2.73..91.59 rows=56 width=4) (never executed)

  • Recheck Cond: (user_id = 3)
160. 0.000 0.000 ↓ 0.0 0 / 2

Bitmap Index Scan on teams_membership_user_id_team_id_9e94b906_idx (cost=0.00..2.71 rows=56 width=0) (never executed)

  • Index Cond: (user_id = 3)
161. 0.000 0.000 ↓ 0.0 0 / 2

Index Only Scan using teams_subteamclosure_descendant_id_ancestor_id_7bc282c4_idx on teams_subteamclosure u1_7 (cost=0.29..4.02 rows=1 width=8) (never executed)

  • Index Cond: (descendant_id = u3_7.team_id)
  • Heap Fetches: 0
162. 0.000 0.000 ↓ 0.0 0 / 2

Index Only Scan using teams_team_pkey on teams_team u0_10 (cost=0.29..0.33 rows=1 width=4) (never executed)

  • Index Cond: (id = u1_7.ancestor_id)
  • Heap Fetches: 0
163. 0.000 0.000 ↓ 0.0 0 / 2

Index Only Scan using teams_team_pkey on teams_team u2_7 (cost=0.29..0.33 rows=1 width=4) (never executed)

  • Index Cond: (id = u1_7.descendant_id)
  • Heap Fetches: 0
164. 0.000 0.000 ↓ 0.0 0 / 2

Index Scan using matters_matters_people_team_id_3fd421e8 on matters_matters w0_5 (cost=0.29..0.37 rows=1 width=12) (never executed)

  • Index Cond: (people_team_id = u0_10.id)
  • Filter: (client_id = 1)
165. 0.000 0.000 ↓ 0.0 0 / 2

Materialize (cost=4.46..6.20 rows=1 width=8) (never executed)

166. 0.000 0.000 ↓ 0.0 0 / 2

Nested Loop (cost=4.46..6.19 rows=1 width=8) (never executed)

167. 0.000 0.000 ↓ 0.0 0 / 2

Hash Join (cost=4.33..5.87 rows=1 width=4) (never executed)

  • Hash Cond: (v1_4.team_id = u0_11.id)
168. 0.000 0.000 ↓ 0.0 0 / 2

Seq Scan on teams_permissionteam v1_4 (cost=0.00..1.43 rows=43 width=8) (never executed)

169. 0.000 0.000 ↓ 0.0 0 / 2

Hash (cost=4.31..4.31 rows=1 width=4) (never executed)

170. 0.000 0.000 ↓ 0.0 0 / 2

Index Scan using teams_team_system_managed_f60768d0_like on teams_team u0_11 (cost=0.29..4.31 rows=1 width=4) (never executed)

  • Index Cond: (system_managed = 'matters'::text)
  • Filter: (client_id = 1)
171. 0.000 0.000 ↓ 0.0 0 / 2

Index Only Scan using teams_permission_pkey on teams_permission v0_5 (cost=0.13..0.29 rows=1 width=4) (never executed)

  • Index Cond: (id = v1_4.permission_id)
  • Heap Fetches: 0
172. 0.000 0.000 ↓ 0.0 0 / 2

Index Scan using matters_matters_lineitems_5c20b3d2 on matters_matters_lineitems y2 (cost=0.43..9.41 rows=80 width=8) (never executed)

  • Index Cond: (matters_id = x0.id)
173. 0.000 0.000 ↓ 0.0 0 / 2

Index Scan using invoice_invoicelineitems_pkey on invoice_invoicelineitems y1 (cost=0.43..0.55 rows=1 width=8) (never executed)

  • Index Cond: (id = y2.invoicelineitems_id)
174. 3.724 7.495 ↑ 1.0 4,923 1

Hash (cost=377.23..377.23 rows=4,923 width=468) (actual time=7.495..7.495 rows=4,923 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 2,503kB
175. 3.771 3.771 ↑ 1.0 4,923 1

Seq Scan on invoice_vendor (cost=0.00..377.23 rows=4,923 width=468) (actual time=0.011..3.771 rows=4,923 loops=1)

176. 0.948 1.885 ↑ 1.0 4,923 1

Hash (cost=100.23..100.23 rows=4,923 width=48) (actual time=1.885..1.885 rows=4,923 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 453kB
177. 0.937 0.937 ↑ 1.0 4,923 1

Seq Scan on api_vendorhash (cost=0.00..100.23 rows=4,923 width=48) (actual time=0.011..0.937 rows=4,923 loops=1)

178. 0.003 0.011 ↑ 1.0 1 1

Hash (cost=1.01..1.01 rows=1 width=448) (actual time=0.011..0.011 rows=1 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
179. 0.008 0.008 ↑ 1.0 1 1

Seq Scan on invoice_purchaseorders (cost=0.00..1.01 rows=1 width=448) (actual time=0.008..0.008 rows=1 loops=1)

180. 92.033 170.332 ↑ 1.0 421,847 1

Hash (cost=7,320.47..7,320.47 rows=421,847 width=27) (actual time=170.332..170.332 rows=421,847 loops=1)

  • Buckets: 524,288 Batches: 1 Memory Usage: 28,752kB
181. 78.299 78.299 ↑ 1.0 421,847 1

Seq Scan on api_invoicehash (cost=0.00..7,320.47 rows=421,847 width=27) (actual time=0.011..78.299 rows=421,847 loops=1)

Planning time : 43.740 ms
Execution time : 5,444.713 ms