[ticket/11224] Revert Revert "Merge pull request #2460 from ticket/11224"

This reverts commit 40cd7570e6f4da7cc60d83a3e99c72a2fb99e3f7.
Merge pull request #3016 from Nicofuma/ticket/11224-ascraeus

 [ticket/11224][ascraeus] SQL cache destroy does not destroy queries to tables joined
Merge branch 'develop-ascraeus' into develop