explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 4W8J : Modified query

Settings
# exclusive inclusive rows x rows loops node
1. 0.070 1,005.704 ↑ 18.2 229 1

GroupAggregate (cost=6,586,849.57..6,586,868.34 rows=4,171 width=29) (actual time=1,005.627..1,005.704 rows=229 loops=1)

  • Group Key: accounts.id
2. 0.084 1,005.634 ↑ 18.2 229 1

Sort (cost=6,586,849.57..6,586,851.66 rows=4,171 width=21) (actual time=1,005.622..1,005.634 rows=229 loops=1)

  • Sort Key: accounts.id
  • Sort Method: quicksort Memory: 41kB
3. 38.664 1,005.550 ↑ 18.2 229 1

Index Scan using index_accounts_on_organization_id_and_sfdc_id on accounts (cost=0.11..6,586,799.41 rows=4,171 width=21) (actual time=0.041..1,005.550 rows=229 loops=1)

  • Index Cond: (organization_id = 42)
  • Filter: (((owner_sfdc_id)::text = ANY ('{0054A000009AXL4QAO,0054A000009XOFzQAO,0054A000009mf0UQAQ,0054A000009mn45QAA,0054A000009msWnQAI,0054A000009mpk8QAA,0054A0000096zqCQAQ,0054A000009kdiQQAQ,0054A0000096v1UQAQ,0054A0000097RT6QAM,0054A0000096v1FQAQ,005G0000002w15YIAQ}'::text[])) OR (alternatives: SubPlan 1 or hashed SubPlan 2))
4.          

SubPlan (for Index Scan)

5. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.23..788.28 rows=1 width=0) (never executed)

6. 0.000 0.000 ↓ 0.0 0

Index Scan using index_people_on_account_id on people (cost=0.11..325.28 rows=161 width=4) (never executed)

  • Index Cond: (account_id = accounts.id)
7. 0.000 0.000 ↓ 0.0 0

Index Only Scan using index_person_activities_on_person_id_and_user_id on person_activities (cost=0.11..2.87 rows=1 width=4) (never executed)

  • Index Cond: (person_id = people.id)
  • Filter: (user_id = ANY ('{48099,62359,51097,51846,52133,51848,28271,46358,9582,39628,34106,27846,1895}'::integer[]))
  • Heap Fetches: 0
8. 49.230 966.886 ↓ 1.2 280,409 1

Gather (cost=1,000.23..810,880.11 rows=231,170 width=4) (actual time=0.425..966.886 rows=280,409 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
9. 53.128 917.656 ↓ 1.0 140,204 2 / 2

Nested Loop (cost=0.23..786,763.11 rows=135,982 width=4) (actual time=0.224..917.656 rows=140,204 loops=2)

10. 231.873 231.873 ↓ 1.6 210,885 2 / 2

Parallel Index Scan using index_person_activities_on_user_id on person_activities person_activities_1 (cost=0.11..301,368.55 rows=135,982 width=4) (actual time=0.092..231.873 rows=210,885 loops=2)

  • Index Cond: (user_id = ANY ('{48099,62359,51097,51846,52133,51848,28271,46358,9582,39628,34106,27846,1895}'::integer[]))
11. 632.655 632.655 ↑ 1.0 1 421,770 / 2

Index Scan using people_pkey on people people_1 (cost=0.11..3.57 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=421,770)

  • Index Cond: (id = person_activities_1.person_id)
Planning time : 0.736 ms
Execution time : 1,017.880 ms