ILIAS icon indicating copy to clipboard operation
ILIAS copied to clipboard

IRSS: Add micro optimizations for stakeholder database repository

Open mjansenDatabay opened this issue 6 months ago • 0 comments

If approved, this should (at least) be picked to all "upper" ILIAS versions/branches.

This PR suggests some tweaks/micro optimizations for the \ILIAS\ResourceStorage\Stakeholder\Repository\StakeholderDBRepository.

The main aspect is the switch from a SELECT + potential INSERT (one or two operations) approach to the usage of an atomic \ilDBInterface::replace. I know, if a row does exist, REPLACE deletes it and inserts the new data, in one atomic step, which should not be a problem IMO.

Why?

  • The tables il_resource_stkh and il_resource_stkh_u both contain two fields. We could provide (and already do in the INSERT) values for all fields, which makes the use of REPLACE applicable and IMO (at least a tiny bit) more performant.
  • It is (IMO) more readable
  • In general: It prevents race conditions, but of course you also address them with your locker and \ILIAS\ResourceStorage\Lock\LockingRepository::getNamesForLocking

mjansenDatabay avatar Jun 25 '25 12:06 mjansenDatabay