explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ySNZ

Settings
# exclusive inclusive rows x rows loops node
1. 0.077 53,541.500 ↑ 1.0 1 1

Result (cost=3,630,470.22..3,630,470.23 rows=1 width=32) (actual time=53,541.499..53,541.500 rows=1 loops=1)

2.          

Initplan (forResult)

3. 0.041 53,541.423 ↑ 1.0 25 1

Limit (cost=3,630,470.15..3,630,470.22 rows=25 width=64) (actual time=53,541.375..53,541.423 rows=25 loops=1)

4. 1,070.643 53,541.382 ↑ 6,772.1 25 1

Sort (cost=3,630,470.15..3,630,893.41 rows=169,302 width=64) (actual time=53,541.373..53,541.382 rows=25 loops=1)

  • Sort Key: d.fullname
  • Sort Method: top-N heapsort Memory: 46kB
5. 13,265.183 52,470.739 ↓ 9.9 1,674,623 1

Subquery Scan on d (cost=3,619,343.75..3,625,692.57 rows=169,302 width=64) (actual time=33,352.272..52,470.739 rows=1,674,623 loops=1)

6. 1,608.900 39,205.556 ↓ 9.9 1,674,623 1

Unique (cost=3,619,343.75..3,623,576.30 rows=169,302 width=198) (actual time=33,352.248..39,205.556 rows=1,674,623 loops=1)

7. 11,582.660 37,596.656 ↓ 9.9 1,676,509 1

Sort (cost=3,619,343.75..3,619,767.00 rows=169,302 width=198) (actual time=33,352.245..37,596.656 rows=1,676,509 loops=1)

  • Sort Key: cm_user.ueid, ((cm_user.data ->> 'login'::text)), (btrim(((((COALESCE(((cm_user.data -> 'fullName'::text) ->> 'lastName'::text), ''::text) || ' '::text) || COALESCE(((cm_user.data -> 'fullName'::text) ->> 'firstName'::text), ''::text)) || ' '::text) || COALESCE(((cm_user.data -> 'fullName'::text) ->> 'middleName'::text), ''::text)))), ((cm_user.data #>> '{contact,email}'::text[])), ((cm_user.data ->> 'city'::text)), ((cm_user.data ->> 'firmName'::text)), ((cs.ueid IS NOT NULL)), (COALESCE(((cs.data ->> 'isResponsible'::text))::boolean, false)), (COALESCE(((cs.data ->> 'isDirector'::text))::boolean, false))
  • Sort Method: external merge Disk: 230160kB
8. 5,937.719 26,013.996 ↓ 9.9 1,676,509 1

Hash Right Join (cost=3,560,644.77..3,588,435.51 rows=169,302 width=198) (actual time=20,053.490..26,013.996 rows=1,676,509 loops=1)

  • Hash Cond: ((cs.data ->> 'userUeid'::text) = (cm_user.ueid)::text)
9. 23.375 23.375 ↓ 1.0 47,625 1

Seq Scan on cm_certificated_specialist cs (cost=0.00..2,093.61 rows=47,061 width=222) (actual time=0.013..23.375 rows=47,625 loops=1)

10. 2,329.273 20,052.902 ↓ 9.9 1,674,743 1

Hash (cost=3,544,805.50..3,544,805.50 rows=169,302 width=634) (actual time=20,052.902..20,052.902 rows=1,674,743 loops=1)

  • Buckets: 32768 (originally 32768) Batches: 128 (originally 16) Memory Usage: 13057kB
11. 6,708.723 17,723.629 ↓ 9.9 1,674,743 1

Hash Join (cost=7,701.13..3,544,805.50 rows=169,302 width=634) (actual time=5,394.071..17,723.629 rows=1,674,743 loops=1)

  • Hash Cond: ((((jsonb_array_elements((cm_user.data -> 'subscribers'::text))) ->> 'subscriberUeid'::text))::uuid = s.ueid)
12. 3,126.318 5,620.868 ↑ 96.9 1,747,660 1

ProjectSet (cost=0.00..1,336,052.32 rows=169,311,600 width=698) (actual time=0.017..5,620.868 rows=1,747,660 loops=1)

13. 2,494.550 2,494.550 ↓ 1.0 1,693,243 1

Seq Scan on cm_user (cost=0.00..472,563.16 rows=1,693,116 width=634) (actual time=0.008..2,494.550 rows=1,693,243 loops=1)

14. 1,114.038 5,394.038 ↓ 967.3 1,910,333 1

Hash (cost=7,676.44..7,676.44 rows=1,975 width=16) (actual time=5,394.038..5,394.038 rows=1,910,333 loops=1)

  • Buckets: 262144 (originally 2048) Batches: 8 (originally 1) Memory Usage: 13213kB
15. 3,964.410 4,280.000 ↓ 967.3 1,910,333 1

Bitmap Heap Scan on cm_subscriber s (cost=67.31..7,676.44 rows=1,975 width=16) (actual time=343.595..4,280.000 rows=1,910,333 loops=1)

  • Recheck Cond: (data @> jsonb_build_object('profile', 'CLIENT'))
  • Rows Removed by Index Recheck: 27312
  • Heap Blocks: exact=136112 lossy=214462
16. 315.590 315.590 ↓ 967.4 1,910,517 1

Bitmap Index Scan on cm_subscriber_table_index (cost=0.00..66.82 rows=1,975 width=0) (actual time=315.590..315.590 rows=1,910,517 loops=1)

  • Index Cond: (data @> jsonb_build_object('profile', 'CLIENT'))