explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1f3S

Settings
# exclusive inclusive rows x rows loops node
1. 0.012 6.547 ↑ 1.0 20 1

Limit (cost=19.14..551.84 rows=20 width=8,537) (actual time=2.037..6.547 rows=20 loops=1)

2. 0.096 6.535 ↑ 163.2 20 1

Nested Loop Left Join (cost=19.14..86,955.96 rows=3,264 width=8,537) (actual time=2.036..6.535 rows=20 loops=1)

  • Join Filter: (current_user_versions.public_id = files.public_id)
3. 0.030 6.379 ↑ 163.2 20 1

Nested Loop (cost=2.96..32,528.89 rows=3,264 width=1,471) (actual time=1.944..6.379 rows=20 loops=1)

  • Join Filter: (files.public_id = file_public_attributes.file_public_id)
4. 0.029 6.249 ↑ 163.2 20 1

Nested Loop Left Join (cost=2.54..30,467.68 rows=3,264 width=508) (actual time=1.912..6.249 rows=20 loops=1)

5. 0.023 6.120 ↑ 163.2 20 1

Nested Loop Left Join (cost=2.11..28,858.47 rows=3,264 width=460) (actual time=1.878..6.120 rows=20 loops=1)

6. 0.025 6.097 ↑ 163.2 20 1

Nested Loop (cost=1.83..27,903.56 rows=3,264 width=449) (actual time=1.871..6.097 rows=20 loops=1)

7. 0.020 6.052 ↑ 163.2 20 1

Nested Loop (cost=1.56..26,948.71 rows=3,264 width=438) (actual time=1.859..6.052 rows=20 loops=1)

8. 0.019 5.452 ↑ 163.2 20 1

Nested Loop (cost=1.28..25,993.87 rows=3,264 width=423) (actual time=1.320..5.452 rows=20 loops=1)

9. 0.023 0.773 ↑ 167.7 20 1

Nested Loop (cost=0.85..24,193.42 rows=3,353 width=213) (actual time=0.694..0.773 rows=20 loops=1)

10. 0.050 0.050 ↑ 168.9 20 1

Index Scan using file_buckets_join_bucket_id_index on file_buckets_join (cost=0.43..371.97 rows=3,379 width=4) (actual time=0.039..0.050 rows=20 loops=1)

  • Index Cond: (bucket_id = 1)
11. 0.700 0.700 ↑ 1.0 1 20

Index Scan using file_curations_file_public_id_index on file_curations (cost=0.43..7.04 rows=1 width=209) (actual time=0.035..0.035 rows=1 loops=20)

  • Index Cond: (file_public_id = file_buckets_join.file_public_id)
12. 4.660 4.660 ↑ 1.0 1 20

Index Scan using files_public_id_index on files (cost=0.43..0.53 rows=1 width=210) (actual time=0.233..0.233 rows=1 loops=20)

  • Index Cond: (public_id = file_curations.file_public_id)
  • Filter: ((version_id IS NULL) AND (version_id IS NULL) AND (deleted_at IS NULL))
13. 0.580 0.580 ↑ 1.0 1 20

Index Scan using users_pkey on users users_created_by (cost=0.28..0.29 rows=1 width=19) (actual time=0.029..0.029 rows=1 loops=20)

  • Index Cond: (id = files.created_by)
14. 0.020 0.020 ↑ 1.0 1 20

Index Scan using users_pkey on users users_updated_by (cost=0.28..0.29 rows=1 width=19) (actual time=0.001..0.001 rows=1 loops=20)

  • Index Cond: (id = files.updated_by)
15. 0.000 0.000 ↓ 0.0 0 20

Index Scan using users_pkey on users users_deleted_by (cost=0.28..0.29 rows=1 width=19) (actual time=0.000..0.000 rows=0 loops=20)

  • Index Cond: (id = files.deleted_by)
16. 0.100 0.100 ↑ 1.0 1 20

Index Scan using files_external_data_file_public_id_unique on files_external_data (cost=0.43..0.49 rows=1 width=52) (actual time=0.005..0.005 rows=1 loops=20)

  • Index Cond: (file_public_id = files.public_id)
17. 0.100 0.100 ↑ 1.0 1 20

Index Scan using file_public_attributes_file_public_id_index on file_public_attributes (cost=0.43..0.62 rows=1 width=975) (actual time=0.005..0.005 rows=1 loops=20)

  • Index Cond: (file_public_id = file_curations.file_public_id)
18. 0.000 0.060 ↓ 0.0 0 20

Materialize (cost=16.17..16.20 rows=1 width=2,280) (actual time=0.003..0.003 rows=0 loops=20)

19. 0.001 0.063 ↓ 0.0 0 1

Subquery Scan on current_user_versions (cost=16.17..16.19 rows=1 width=2,280) (actual time=0.063..0.063 rows=0 loops=1)

20. 0.000 0.062 ↓ 0.0 0 1

Unique (cost=16.17..16.18 rows=1 width=2,830) (actual time=0.062..0.062 rows=0 loops=1)

21. 0.037 0.062 ↓ 0.0 0 1

Sort (cost=16.17..16.18 rows=1 width=2,830) (actual time=0.062..0.062 rows=0 loops=1)

  • Sort Key: f.public_id
  • Sort Method: quicksort Memory: 25kB
22. 0.000 0.025 ↓ 0.0 0 1

Nested Loop Left Join (cost=1.40..16.16 rows=1 width=2,830) (actual time=0.025..0.025 rows=0 loops=1)

  • Join Filter: (fv_title.file_version_id = fv.id)
23. 0.000 0.025 ↓ 0.0 0 1

Nested Loop Left Join (cost=1.40..14.85 rows=1 width=1,768) (actual time=0.025..0.025 rows=0 loops=1)

  • Join Filter: (fv_subtext.file_version_id = fv.id)
24. 0.000 0.025 ↓ 0.0 0 1

Nested Loop Left Join (cost=1.40..13.54 rows=1 width=1,252) (actual time=0.025..0.025 rows=0 loops=1)

  • Join Filter: (fv_alternative_text.file_version_id = fv.id)
25. 0.001 0.025 ↓ 0.0 0 1

Nested Loop (cost=1.40..12.23 rows=1 width=736) (actual time=0.024..0.025 rows=0 loops=1)

  • Join Filter: (fv.id = fv_caption.file_version_id)
26. 0.000 0.024 ↓ 0.0 0 1

Nested Loop (cost=1.40..10.91 rows=1 width=220) (actual time=0.024..0.024 rows=0 loops=1)

27. 0.000 0.024 ↓ 0.0 0 1

Nested Loop (cost=1.13..10.62 rows=1 width=209) (actual time=0.024..0.024 rows=0 loops=1)

28. 0.000 0.024 ↓ 0.0 0 1

Nested Loop (cost=0.85..10.33 rows=1 width=198) (actual time=0.024..0.024 rows=0 loops=1)

29. 0.001 0.024 ↓ 0.0 0 1

Nested Loop (cost=0.43..9.70 rows=1 width=198) (actual time=0.024..0.024 rows=0 loops=1)

30. 0.023 0.023 ↓ 0.0 0 1

Seq Scan on file_versions fv (cost=0.00..1.25 rows=1 width=8) (actual time=0.023..0.023 rows=0 loops=1)

  • Filter: ((version_id IS NULL) AND (entity_type = '-1'::integer) AND (entity_id = '-1'::integer))
  • Rows Removed by Filter: 17
31. 0.000 0.000 ↓ 0.0 0

Index Scan using files_pkey on files f (cost=0.43..8.45 rows=1 width=194) (never executed)

  • Index Cond: (id = fv.file_id)
32. 0.000 0.000 ↓ 0.0 0

Index Only Scan using file_public_attributes_file_public_id_index on file_public_attributes fpa (cost=0.43..0.62 rows=1 width=4) (never executed)

  • Index Cond: (file_public_id = f.public_id)
  • Heap Fetches: 0
33. 0.000 0.000 ↓ 0.0 0

Index Scan using users_pkey on users users_created_by_1 (cost=0.28..0.29 rows=1 width=19) (never executed)

  • Index Cond: (id = f.created_by)
34. 0.000 0.000 ↓ 0.0 0

Index Scan using users_pkey on users users_updated_by_1 (cost=0.28..0.29 rows=1 width=19) (never executed)

  • Index Cond: (id = f.updated_by)
35. 0.000 0.000 ↓ 0.0 0

Seq Scan on file_version_values fv_caption (cost=0.00..1.30 rows=1 width=520) (never executed)

  • Filter: (type = 200)
36. 0.000 0.000 ↓ 0.0 0

Seq Scan on file_version_values fv_alternative_text (cost=0.00..1.30 rows=1 width=520) (never executed)

  • Filter: (type = 300)
37. 0.000 0.000 ↓ 0.0 0

Seq Scan on file_version_values fv_subtext (cost=0.00..1.30 rows=1 width=520) (never executed)

  • Filter: (type = 400)
38. 0.000 0.000 ↓ 0.0 0

Seq Scan on file_version_values fv_title (cost=0.00..1.30 rows=1 width=520) (never executed)

  • Filter: (type = 500)
39.          

SubPlan (for Nested Loop Left Join)

40. 0.000 0.000 ↓ 0.0 0 20

Index Scan using users_pkey on users (cost=0.28..8.29 rows=1 width=15) (actual time=0.000..0.000 rows=0 loops=20)

  • Index Cond: (id = file_public_attributes.curated_by)
41. 0.000 0.000 ↓ 0.0 0 20

Index Scan using users_pkey on users users_1 (cost=0.28..8.29 rows=1 width=15) (actual time=0.000..0.000 rows=0 loops=20)

  • Index Cond: (id = file_curations.comment_by)
Planning time : 57.279 ms
Execution time : 7.373 ms