explain.depesz.com

A tool for finding a real cause for slow queries.

Result: jUb

options
Did it help? Consider supporting us - Bitcoin address: 12v2hUztAk2LgzQ9H9LMwuU32urHMjZQnq
# exclusive inclusive rows x rows loops node
1. 71.981 36,769.806 ↓ 15,524.3 46,573 1

Unique (cost=57,993.76..57,993.85 rows=3 width=391) (actual time=36,605.850..36,769.806 rows=46,573 loops=1)

2. 9,793.280 36,697.825 ↓ 16,634.0 49,902 1

Sort (cost=57,993.76..57,993.77 rows=3 width=391) (actual time=36,605.850..36,697.825 rows=49,902 loops=1)

  • Sort Key: reg.name, workareas.name, learninggroups.grade, workareas.name, ((((((p.surname)::text || ' '::text) || (p.name)::text) || ' '::text) || (p.patronymic)::text)), ((CASE WHEN (ok.id IS NOT NULL) THEN ((ok.name)::text || ' '::text) ELSE ''::text END || (ek.name)::text)), e.name, el.name, pf.name, ert.name, (array_to_string(array_agg(DISTINCT (sub.name)::text), ', '::text))
  • Sort Method: external sort Disk: 25664kB
3. 575.843 26,904.545 ↓ 16,634.0 49,902 1

GroupAggregate (cost=57,993.52..57,993.74 rows=3 width=391) (actual time=25,672.881..26,904.545 rows=49,902 loops=1)

4. 13,972.134 26,328.702 ↓ 20,039.7 60,119 1

Sort (cost=57,993.52..57,993.53 rows=3 width=391) (actual time=25,672.881..26,328.702 rows=60,119 loops=1)

  • Sort Key: reg.name, workareas.name, learninggroups.grade, p.surname, p.name, p.patronymic, workareas.name, ek.name, e.name, el.name, ert.name, e.id, ok.name, ok.id, pf.name
  • Sort Method: external merge Disk: 25416kB
5. 127.965 12,356.568 ↓ 20,039.7 60,119 1

Hash Join (cost=140.13..57,993.49 rows=3 width=391) (actual time=747.793..12,356.568 rows=60,119 loops=1)

  • Hash Cond: ((e.kind)::integer = (ek.id)::integer)
6. 171.950 12,228.603 ↓ 20,039.7 60,119 1

Hash Join (cost=138.95..57,992.27 rows=3 width=363) (actual time=747.793..12,228.603 rows=60,119 loops=1)

  • Hash Cond: ((e.level)::integer = (el.id)::integer)
7. 143.689 12,056.653 ↓ 20,039.7 60,119 1

Nested Loop Left Join (cost=137.73..57,991.01 rows=3 width=335) (actual time=747.793..12,056.653 rows=60,119 loops=1)

8. 171.892 11,792.726 ↓ 20,039.7 60,119 1

Nested Loop Left Join (cost=137.73..57,990.15 rows=3 width=287) (actual time=747.793..11,792.726 rows=60,119 loops=1)

9. 115.967 11,380.838 ↓ 19,999.7 59,999 1

Hash Join (cost=137.73..57,968.07 rows=3 width=283) (actual time=747.793..11,380.838 rows=59,999 loops=1)

  • Hash Cond: ((ep.participationform)::integer = (pf.id)::integer)
10. 147.962 11,264.871 ↓ 9,999.8 59,999 1

Hash Join (cost=136.59..57,966.88 rows=6 width=255) (actual time=747.793..11,264.871 rows=59,999 loops=1)

  • Hash Cond: ((ep.resulttypes)::integer = (ert.id)::integer)
11. 131.962 11,116.909 ↓ 4,628.0 60,164 1

Hash Left Join (cost=135.43..57,965.62 rows=13 width=227) (actual time=747.793..11,116.909 rows=60,164 loops=1)

  • Hash Cond: ((o.olympkind)::integer = (ok.id)::integer)
12. 187.411 10,984.947 ↓ 4,628.0 60,164 1

Nested Loop Left Join (cost=134.39..57,964.39 rows=13 width=195) (actual time=747.793..10,984.947 rows=60,164 loops=1)

13. 288.742 10,617.044 ↓ 4,628.0 60,164 1

Nested Loop (cost=134.39..57,960.50 rows=13 width=191) (actual time=747.793..10,617.044 rows=60,164 loops=1)

14. 390.463 9,965.224 ↓ 4,654.8 60,513 1

Nested Loop (cost=134.39..57,956.31 rows=13 width=128) (actual time=747.793..9,965.224 rows=60,513 loops=1)

15. 653.754 8,633.597 ↓ 21,390.1 235,291 1

Nested Loop Left Join (cost=134.39..57,952.35 rows=11 width=124) (actual time=731.797..8,633.597 rows=235,291 loops=1)

16. 867.601 7,273.970 ↓ 21,390.1 235,291 1

Nested Loop (cost=134.39..57,949.00 rows=11 width=128) (actual time=731.797..7,273.970 rows=235,291 loops=1)

17. 1,003.720 4,994.623 ↓ 21,390.1 235,291 1

Hash Join (cost=134.39..57,945.02 rows=11 width=75) (actual time=731.797..4,994.623 rows=235,291 loops=1)

  • Hash Cond: ((employees.department)::integer = (learninggroups.id)::integer)
18. 1,827.500 3,263.105 ↑ 1.2 591,764 1

Merge Join (cost=0.00..55,102.02 rows=722,267 width=12) (actual time=0.000..3,263.105 rows=591,764 loops=1)

  • Merge Cond: ((students.id)::integer = (employees.id)::integer)
19. 671.819 671.819 ↑ 1.2 591,764 1

Index Scan using "fki_students_FK1" on students (cost=0.00..20,905.55 rows=722,267 width=4) (actual time=0.000..671.819 rows=591,764 loops=1)

20. 763.786 763.786 ↑ 1.1 646,703 1

Index Scan using primary_employees on employees (cost=0.00..23,360.30 rows=723,132 width=16) (actual time=0.000..763.786 rows=646,703 loops=1)

21. 35.990 727.798 ↓ 15,724.0 15,724 1

Hash (cost=134.38..134.38 rows=1 width=79) (actual time=727.798..727.798 rows=15,724 loops=1)

22. 61.071 691.808 ↓ 15,724.0 15,724 1

Nested Loop (cost=0.00..134.38 rows=1 width=79) (actual time=0.000..691.808 rows=15,724 loops=1)

23. 69.069 567.841 ↓ 15,724.0 15,724 1

Nested Loop (cost=0.00..133.99 rows=1 width=95) (actual time=0.000..567.841 rows=15,724 loops=1)

24. 78.635 435.876 ↓ 15,724.0 15,724 1

Nested Loop (cost=0.00..133.68 rows=1 width=91) (actual time=0.000..435.876 rows=15,724 loops=1)

25. 87.516 287.917 ↓ 23,108.0 23,108 1

Nested Loop (cost=0.00..133.37 rows=1 width=83) (actual time=0.000..287.917 rows=23,108 loops=1)

26. 51.958 107.969 ↓ 23,108.0 23,108 1

Nested Loop (cost=0.00..133.07 rows=1 width=79) (actual time=0.000..107.969 rows=23,108 loops=1)

27. 11.997 11.997 ↓ 746.0 746 1

Nested Loop (cost=0.00..127.58 rows=1 width=50) (actual time=0.000..11.997 rows=746 loops=1)

  • -> Index Scan using "fki_eduinstitutions_FK1" on eduinstitutions (cost=0.00..0.27 rows=1 width:
28. 0.000 0.000 ↓ 13.3 771 1

Nested Loop (cost=0.00..111.29 rows=58 width=46) (actual time=0.000..0.000 rows=771 loops=1)

  • Index Cond: ((eduinstitutions.id)::integer = (workareas.id)::integer)
29. 0.000 0.000 ↓ 4.0 28 1

Index Scan using "fki_workareas_FK3" on workareas reg (cost=0.00..13.12 rows=7 width=25) (actual time=0.000..0.000 rows=28 loops=1)

  • Index Cond: ((padre)::integer = 4974)
30. 0.000 0.000 ↓ 3.5 28 28

Index Scan using "fki_workareas_FK3" on workareas (cost=0.00..13.92 rows=8 width=29) (actual time=0.000..0.000 rows=28 loops=28)

  • Index Cond: ((workareas.padre)::integer = (reg.id)::integer)
31. 44.014 44.014 ↓ 3.9 31 746

Index Scan using "fki_workareas_FK3" on workareas (cost=0.00..5.39 rows=8 width=29) (actual time=0.016..0.059 rows=31 loops=746)

  • Index Cond: ((workareas.padre)::integer = (workareas.id)::integer)
32. 92.432 92.432 ↑ 1.0 1 23,108

Index Scan using "fki_departments_FK1" on departments (cost=0.00..0.28 rows=1 width=4) (actual time=0.003..0.004 rows=1 loops=23,108)

  • Index Cond: ((departments.id)::integer = (workareas.id)::integer)
33. 69.324 69.324 ↑ 1.0 1 23,108

Index Scan using primary_learninggroups on learninggroups (cost=0.00..0.30 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=23,108)

  • Index Cond: ((learninggroups.id)::integer = (workareas.id)::integer)
34. 62.896 62.896 ↑ 1.0 1 15,724

Index Scan using "fki_schools_FK1" on schools (cost=0.00..0.30 rows=1 width=4) (actual time=0.003..0.004 rows=1 loops=15,724)

  • Index Cond: ((schools.id)::integer = (workareas.id)::integer)
35. 62.896 62.896 ↑ 1.0 1 15,724

Index Scan using "fki_organizations_FK1" on organizations (cost=0.00..0.37 rows=1 width=4) (actual time=0.003..0.004 rows=1 loops=15,724)

  • Index Cond: ((organizations.id)::integer = (schools.id)::integer)
36. 1,411.746 1,411.746 ↑ 1.0 1 235,291

Index Scan using primary_persons on persons p (cost=0.00..0.35 rows=1 width=53) (actual time=0.005..0.006 rows=1 loops=235,291)

  • Index Cond: ((p.id)::integer = (employees.person)::integer)
37. 705.873 705.873 ↓ 0.0 0 235,291

Index Scan using aspectinactive_pkey on aspectinactive stai (cost=0.00..0.29 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=235,291)

  • Index Cond: ((stai.id)::integer = (employees.aspect)::integer)
38. 941.164 941.164 ↓ 0.0 0 235,291

Index Scan using "fki_eventparticipants_FK273" on eventparticipants ep (cost=0.00..0.32 rows=3 width=16) (actual time=0.003..0.004 rows=0 loops=235,291)

  • Index Cond: ((ep.person)::integer = (p.id)::integer)
39. 363.078 363.078 ↑ 1.0 1 60,513

Index Scan using primary_events on events e (cost=0.00..0.31 rows=1 width=67) (actual time=0.005..0.006 rows=1 loops=60,513)

  • Index Cond: ((e.id)::integer = (ep.event)::integer)
40. 180.492 180.492 ↓ 0.0 0 60,164

Index Scan using "fki_olympiads_FK413" on olympiads o (cost=0.00..0.29 rows=1 width=8) (actual time=0.003..0.003 rows=0 loops=60,164)

  • Index Cond: ((o.id)::integer = (e.id)::integer)
41. 0.000 0.000 ↑ 1.0 2 1

Hash (cost=1.02..1.02 rows=2 width=36) (actual time=0.000..0.000 rows=2 loops=1)

42. 0.000 0.000 ↑ 1.0 2 1

Seq Scan on olympiadkinds ok (cost=0.00..1.02 rows=2 width=36) (actual time=0.000..0.000 rows=2 loops=1)

43. 0.000 0.000 ↑ 1.0 7 1

Hash (cost=1.07..1.07 rows=7 width=36) (actual time=0.000..0.000 rows=7 loops=1)

44. 0.000 0.000 ↑ 1.0 7 1

Seq Scan on eventresulttypes ert (cost=0.00..1.07 rows=7 width=36) (actual time=0.000..0.000 rows=7 loops=1)

45. 0.000 0.000 ↑ 1.0 6 1

Hash (cost=1.06..1.06 rows=6 width=36) (actual time=0.000..0.000 rows=6 loops=1)

46. 0.000 0.000 ↑ 1.0 6 1

Seq Scan on participationforms pf (cost=0.00..1.06 rows=6 width=36) (actual time=0.000..0.000 rows=6 loops=1)

47. 239.996 239.996 ↓ 0.0 0 59,999

Index Scan using "fki_event2subject_FK267" on event2subject e2s (cost=0.00..7.35 rows=1 width=8) (actual time=0.004..0.004 rows=0 loops=59,999)

  • Index Cond: ((e2s.event)::integer = (e.id)::integer)
48. 120.238 120.238 ↓ 0.0 0 60,119

Index Scan using primary_subjects on subjects sub (cost=0.00..0.27 rows=1 width=56) (actual time=0.001..0.002 rows=0 loops=60,119)

  • Index Cond: ((sub.id)::integer = (e2s.subject)::integer)
49. 0.000 0.000 ↑ 1.0 10 1

Hash (cost=1.10..1.10 rows=10 width=36) (actual time=0.000..0.000 rows=10 loops=1)

50. 0.000 0.000 ↑ 1.0 10 1

Seq Scan on eventlevels el (cost=0.00..1.10 rows=10 width=36) (actual time=0.000..0.000 rows=10 loops=1)

51. 0.000 0.000 ↑ 1.0 8 1

Hash (cost=1.08..1.08 rows=8 width=36) (actual time=0.000..0.000 rows=8 loops=1)

52. 0.000 0.000 ↑ 1.0 8 1

Seq Scan on eventkinds ek (cost=0.00..1.08 rows=8 width=36) (actual time=0.000..0.000 rows=8 loops=1)