Applies To | |||
Product(s): | eB Director | ||
Version(s): | v15.4.x & v 15.5.x | ||
Environment: | N/A | ||
Area: | Document & Tags | ||
Subarea: | N/A | ||
Original Author: | Manav Bhardwaj, Bentley Technical Support Group | ||
Slowness in Document Creation with Dynamic Security
Problem Description
If we try to modify certain document attributes when the status was either “Planned” or “In Progress”, using Dynamic Security to an attribute group, it triggers Document-Add and Document-Change events. It will run with below query:
select
distinct d.document_id object_id, 3 object_type, rp.person_id
from documents d join char_data cd on d.document_id=cd.object_id join characteristics c on c.char_id=cd.char_id
and c.char_name='Dokumentenstatus', role_persons rp join roles r on rp.role_id = r.role_id
and r.name='Engineer'
where
cd.char_value='InProgress' or cd.char_value='Planned'
It worked as per required logic, however creating a new Document took 17-20 secs which is more than expected.
Reason
Though the database was small, it still take way longer time. If we disable Dynamic Security again, it will add new document in 1-2 secs.
DISTINCT keyword do a sorting which takes time to give the result. If we remove the same keyword, it will eliminate the sorting.
Workaround
Run below query as a workaround:
SELECT docs.object_id, docs.object_type, rp.person_id
FROM
(
select d.document_id object_id, 3 object_type
from char_data cd
inner join characteristics c on c.char_id=cd.char_id
and c.char_name='Dokumentenstatus' inner join documents d on cd.object_id = d.document_id
where
cd.char_value='In Progress' or cd.char_value='Planned'
)
docs LEFT join roles r on r.name='Engineer'
LEFT join role_persons rp on rp.role_id = r.role_id
WHERE
rp.person_id is not null
Hope this will help you to deal with slowness in document creation.