So I investigated a bit further and try to find the sql
db-1 | 2026-03-11 07:46:27.994 UTC [29] LOG: duration: 0.171 ms parse <unnamed>: select max(organisati0_.hierarchylevel) as col_0_0_ from organisationunit organis
ati0_
db-1 | 2026-03-11 07:46:27.994 UTC [29] LOG: duration: 0.120 ms bind <unnamed>: select max(organisati0_.hierarchylevel) as col_0_0_ from organisationunit organisa
ti0_
db-1 | 2026-03-11 07:46:27.994 UTC [29] LOG: execute <unnamed>: select max(organisati0_.hierarchylevel) as col_0_0_ from organisationunit organisati0_
db-1 | 2026-03-11 07:46:27.994 UTC [29] LOG: duration: 0.039 ms
db-1 | 2026-03-11 07:46:28.000 UTC [29] LOG: duration: 0.391 ms parse <unnamed>: select distinct organisati0_.organisationunitid as organisa1_135_, organisati0_.u
id as uid2_135_, organisati0_.code as code3_135_, organisati0_.created as created4_135_, organisati0_.lastUpdated as lastupda5_135_, organisati0_.lastupdatedby as last
upda6_135_, organisati0_.name as name7_135_, organisati0_.shortname as shortnam8_135_, organisati0_.parentid as parentid9_135_, organisati0_.path as path10_135_, organ
isati0_.hierarchylevel as hierarc11_135_, organisati0_.description as descrip12_135_, organisati0_.openingdate as opening13_135_, organisati0_.closeddate as closedd14_
135_, organisati0_.comment as comment15_135_, organisati0_.geometry as geometr16_135_, organisati0_.url as url17_135_, organisati0_.contactPerson as contact18_135_, or
ganisati0_.address as address19_135_, organisati0_.email as email20_135_, organisati0_.phoneNumber as phonenu21_135_, organisati0_.translations as transla22_135_, orga
nisati0_.image as image23_135_, organisati0_.userid as userid24_135_, organisati0_.attributeValues as attribu25_135_ from organisationunit organisati0_ where organisat
i0_.hierarchylevel in ($1) order by organisati0_.name
db-1 | 2026-03-11 07:46:28.000 UTC [29] LOG: duration: 0.236 ms bind <unnamed>: select distinct organisati0_.organisationunitid as organisa1_135_, organisati0_.ui
d as uid2_135_, organisati0_.code as code3_135_, organisati0_.created as created4_135_, organisati0_.lastUpdated as lastupda5_135_, organisati0_.lastupdatedby as lastu
pda6_135_, organisati0_.name as name7_135_, organisati0_.shortname as shortnam8_135_, organisati0_.parentid as parentid9_135_, organisati0_.path as path10_135_, organi
sati0_.hierarchylevel as hierarc11_135_, organisati0_.description as descrip12_135_, organisati0_.openingdate as opening13_135_, organisati0_.closeddate as closedd14_1
35_, organisati0_.comment as comment15_135_, organisati0_.geometry as geometr16_135_, organisati0_.url as url17_135_, organisati0_.contactPerson as contact18_135_, org
anisati0_.address as address19_135_, organisati0_.email as email20_135_, organisati0_.phoneNumber as phonenu21_135_, organisati0_.translations as transla22_135_, organ
isati0_.image as image23_135_, organisati0_.userid as userid24_135_, organisati0_.attributeValues as attribu25_135_ from organisationunit organisati0_ where organisati
0_.hierarchylevel in ($1) order by organisati0_.name
db-1 | 2026-03-11 07:46:28.000 UTC [29] DETAIL: parameters: $1 = '1'
db-1 | 2026-03-11 07:46:28.000 UTC [29] LOG: execute <unnamed>: select distinct organisati0_.organisationunitid as organisa1_135_, organisati0_.uid as uid2_135_, o
rganisati0_.code as code3_135_, organisati0_.created as created4_135_, organisati0_.lastUpdated as lastupda5_135_, organisati0_.lastupdatedby as lastupda6_135_, organi
sati0_.name as name7_135_, organisati0_.shortname as shortnam8_135_, organisati0_.parentid as parentid9_135_, organisati0_.path as path10_135_, organisati0_.hierarchyl
evel as hierarc11_135_, organisati0_.description as descrip12_135_, organisati0_.openingdate as opening13_135_, organisati0_.closeddate as closedd14_135_, organisati0_
.comment as comment15_135_, organisati0_.geometry as geometr16_135_, organisati0_.url as url17_135_, organisati0_.contactPerson as contact18_135_, organisati0_.address
as address19_135_, organisati0_.email as email20_135_, organisati0_.phoneNumber as phonenu21_135_, organisati0_.translations as transla22_135_, organisati0_.image as
image23_135_, organisati0_.userid as userid24_135_, organisati0_.attributeValues as attribu25_135_ from organisationunit organisati0_ where organisati0_.hierarchylevel
in ($1) order by organisati0_.name
db-1 | 2026-03-11 07:46:28.000 UTC [29] DETAIL: parameters: $1 = '1'
db-1 | 2026-03-11 07:46:28.000 UTC [29] LOG: duration: 0.069 ms
db-1 | 2026-03-11 07:46:28.004 UTC [29] LOG: duration: 0.095 ms parse <unnamed>: select distinct organisati0_.organisationunitid as organisa1_135_, organisati0_.uid as uid2_135_, organisati0_.code as code3_135_, organisati0_.created as created4_135_, organisati0_.lastUpdated as lastupda5_135_, organisati0_.lastupdatedby as lastupda6_135_, organisati0_.name as name7_135_, organisati0_.shortname as shortnam8_135_, organisati0_.parentid as parentid9_135_, organisati0_.path as path10_135_, organisati0_.hierarchylevel as hierarc11_135_, organisati0_.description as descrip12_135_, organisati0_.openingdate as opening13_135_, organisati0_.closeddate as closedd14_135_, organisati0_.comment as comment15_135_, organisati0_.geometry as geometr16_135_, organisati0_.url as url17_135_, organisati0_.contactPerson as contact18_135_, organisati0_.address as address19_135_, organisati0_.email as email20_135_, organisati0_.phoneNumber as phonenu21_135_, organisati0_.translations as transla22_135_, organisati0_.image as image23_135_, organisati0_.userid as userid24_135_, organisati0_.attributeValues as attribu25_135_ from organisationunit organisati0_ where organisati0_.hierarchylevel in ($1) order by organisati0_.name
the process seem to be done by “hierarchylevel”
but clearly don’t understand how it might happen to have duplicates, there’s no join from what I see
(still haven’t located in the code what is loading the orgunits)
since the offending orgunit seem to be in a part of the pyramid we don’t want anymore, I’ll try to advise the admin to delete the “dead” pyramid