Too many SQL requests are executed when deleting a project.
For instance to delete a java project containing 1 package and 11 files this requires ... 406 SQL requests (see the attached log file).
At first approximation we generate a SQL request for each pair of Sonar resources/Sonar tables which mean in our example :
- Number of Sonar resources = 11 files + 1 package + 1 project + 4 unit test file = 17
- Number of Sonar table to be purges = 22
- Total number of SQL requests > 17 * 22 = 374
In fact we should refactor the current mechanism to execute very few SQL request by table :
- delete from graphs where resource_id in ?
- instead of delete from graphs where resource_id=