diff options
author | Jose M. Guisado <jguisado@soleta.eu> | 2021-04-16 10:33:51 +0000 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2021-04-16 13:31:45 +0200 |
commit | 746166e4c23cb6bbb60d104b5c79df119f7e161b (patch) | |
tree | e932ffdd5693d39345208edfde36ae53b263336e /tests | |
parent | 42c22539a3970395ebfd6c0f306ca18624089293 (diff) |
#971 Remove sql bottleneck when removing software profiles
Several universities have reported that creating a software profile
hangs the machine running the ogServer for a while, sometimes up to
minutes.
Legacy SQL code is producing said bottleneck, responsible for pruning a
intermediate table between "perfilessoft" and "softwares". There is
redundant code, "perfilssoft" should be pruned first, speeding up the
later task of pruning the intermediate table "perfilessoft_softwares"
There is no need to execute:
DELETE FROM perfilessoft_softwares
WHERE idperfilsoft IN (
SELECT idperfilsoft
FROM perfilessoft
WHERE idperfilsoft NOT IN (
SELECT DISTINCT idperfilsoft
from ordenadores_particiones)
AND idperfilsoft NOT IN (
SELECT DISTINCT idperfilsoft from imagenes))
When afterwards "perfilessoft" is going to be pruned and
"perfilessoft_softwares" pruned again:
DELETE FROM perfilessoft WHERE idperfilsoft NOT IN
(SELECT DISTINCT idperfilsoft from ordenadores_particiones)
AND idperfilsoft NOT IN
(SELECT DISTINCT idperfilsoft from imagenes)
DELETE FROM perfilessoft_softwares WHERE idperfilsoft NOT IN
(SELECT idperfilsoft from perfilessoft)
The two latter commands suffice.
This should not happen when using a relational database supporting
foreign keys and ON DELETE CASCADE, like innoDB, which will be adopted
soon.
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions