explain.depesz.com

PostgreSQL's explain analyze made readable

Result: S8Z1

Settings
# exclusive inclusive rows x rows loops node
1. 13,637.223 70,259.205 ↑ 219,824.4 30 1

Merge Left Join (cost=3,144,191.27..4,160,025.40 rows=6,594,733 width=72) (actual time=33,945.023..70,259.205 rows=30 loops=1)

  • Merge Cond: (oc.id = f.parent_id)
  • Filter: ((oc.cnt_picture <> (COALESCE((sum(oc2.cnt_picture)), '0'::bigint) + COALESCE((sum(CASE WHEN (fi.filesort_id = 1) THEN 1 ELSE 0 END)), '0'::bigint))) OR (oc.cnt_spreadsheet <> (COALESCE((sum(oc2.cnt_spreadsheet)), '0'::bigint) + COALESCE((sum(CASE WHEN (fi.filesort_id = 2) THEN 1 ELSE 0 END)), '0'::bigint))) OR (oc.cnt_video <> (COALESCE((sum(oc2.cnt_video)), '0'::bigint) + COALESCE((sum(CASE WHEN (fi.filesort_id = 3) THEN 1 ELSE 0 END)), '0'::bigint))) OR (oc.cnt_text <> (COALESCE((sum(oc2.cnt_text)), '0'::bigint) + COALESCE((sum(CASE WHEN (fi.filesort_id = 4) THEN 1 ELSE 0 END)), '0'::bigint))) OR (oc.cnt_pdf <> (COALESCE((sum(oc2.cnt_pdf)), '0'::bigint) + COALESCE((sum(CASE WHEN (fi.filesort_id = 5) THEN 1 ELSE 0 END)), '0'::bigint))) OR (oc.cnt_presentation <> (COALESCE((sum(oc2.cnt_presentation)), '0'::bigint) + COALESCE((sum(CASE WHEN (fi.filesort_id = 6) THEN 1 ELSE 0 END)), '0'::bigint))) OR (oc.cnt_audio <> (COALESCE((sum(oc2.cnt_audio)), '0'::bigint) + COALESCE((sum(CASE WHEN (fi.filesort_id = 7) THEN 1 ELSE 0 END)), '0'::bigint))) OR (oc.cnt_other <> (COALESCE((sum(oc2.cnt_other)), '0'::bigint) + COALESCE((sum(CASE WHEN (fi.filesort_id = 8) THEN 1 ELSE 0 END)), '0'::bigint))) OR ((oc.size)::numeric <> (COALESCE((sum(oc2.size)), '0'::numeric) + COALESCE((sum(fi.filesize)), '0'::numeric))) OR (oc.cnt_direct_folders <> COALESCE((count(*)), '0'::bigint)) OR (oc.cnt_direct_files <> COALESCE((count(*)), '0'::bigint)))
  • Rows Removed by Filter: 6565571
2. 2,720.819 27,359.865 ↑ 1.0 6,565,601 1

Merge Left Join (cost=990,006.45..1,609,636.75 rows=6,594,733 width=260) (actual time=7,321.016..27,359.865 rows=6,565,601 loops=1)

  • Merge Cond: (oc.id = fi.folder_id)
3. 9,518.097 9,518.097 ↑ 1.0 6,565,601 1

Index Scan using pk_containers on containers oc (cost=0.43..392,646.24 rows=6,594,733 width=156) (actual time=0.045..9,518.097 rows=6,565,601 loops=1)

  • Filter: (objecttype_id = 4)
  • Rows Removed by Filter: 1935322
4. 211.936 15,120.949 ↓ 12.7 415,569 1

Materialize (cost=990,006.02..1,200,167.52 rows=32,772 width=112) (actual time=7,320.968..15,120.949 rows=415,569 loops=1)

5. 5,861.677 14,909.013 ↓ 12.7 415,569 1

GroupAggregate (cost=990,006.02..1,199,757.87 rows=32,772 width=112) (actual time=7,320.964..14,909.013 rows=415,569 loops=1)

  • Group Key: fi.folder_id
6. 6,487.195 9,047.336 ↑ 1.0 4,186,844 1

Sort (cost=990,006.02..1,000,473.13 rows=4,186,844 width=18) (actual time=7,320.867..9,047.336 rows=4,186,844 loops=1)

  • Sort Key: fi.folder_id
  • Sort Method: external merge Disk: 139160kB
7. 2,560.141 2,560.141 ↑ 1.0 4,186,844 1

Seq Scan on files fi (cost=0.00..271,910.44 rows=4,186,844 width=18) (actual time=0.016..2,560.141 rows=4,186,844 loops=1)

8. 158.759 29,262.117 ↓ 17.2 315,545 1

Materialize (cost=2,154,184.82..2,351,611.43 rows=18,343 width=112) (actual time=22,809.770..29,262.117 rows=315,545 loops=1)

9. 4,473.635 29,103.358 ↓ 17.2 315,545 1

GroupAggregate (cost=2,154,184.82..2,351,382.14 rows=18,343 width=112) (actual time=22,809.765..29,103.358 rows=315,545 loops=1)

  • Group Key: f.parent_id
10. 10,137.738 24,629.723 ↑ 1.0 6,565,601 1

Sort (cost=2,154,184.82..2,170,598.82 rows=6,565,601 width=48) (actual time=22,809.732..24,629.723 rows=6,565,601 loops=1)

  • Sort Key: f.parent_id
  • Sort Method: external merge Disk: 372272kB
11. 5,251.090 14,491.985 ↑ 1.0 6,565,601 1

Merge Join (cost=150.38..804,832.55 rows=6,565,601 width=48) (actual time=0.042..14,491.985 rows=6,565,601 loops=1)

  • Merge Cond: (oc2.id = f.id)
12. 4,932.040 4,932.040 ↑ 1.0 8,500,923 1

Index Scan using pk_containers on containers oc2 (cost=0.43..371,393.94 rows=8,500,923 width=48) (actual time=0.025..4,932.040 rows=8,500,923 loops=1)

13. 4,308.855 4,308.855 ↑ 1.0 6,565,601 1

Index Scan using pk_folders on folders f (cost=0.43..330,151.55 rows=6,565,601 width=16) (actual time=0.012..4,308.855 rows=6,565,601 loops=1)