stable
Clone or download
request #11855: Performance issues when querying the permissions table with PDO
Since 0d72d085de4eb0889c926e7bc6ea584f08184b2e Tuleap uses by default PDO for all the DB queries and the chosen settings are not exactly the same than for the abstraction layer based on the mysql_* AP. Among other things, the connection is established with the charset utf8mb4 instead of utf8. When querying the permissions table CAST() is used when joining on the object_id column so that the same type is used on the two joined columns to allow MySQL to use all available indexes instead of forcing a full scan of the table. However, most of the CONVERT()/CAST() usages has been done without specifying explicitly the charset to use. In this case MySQL fallbacks on the charset used by the connection [0] so when using PDO we join on a string utf8 encoded and a value converted to a utf8mb4 encoded string. This forces MySQL to do a full scan to compute the join operation hence the degraded performance. [0] https://dev.mysql.com/doc/refman/5.6/en/cast-functions.html#function_convert Change-Id: Ia6815481433be2d352336349fbef4fe2ccb62b8b
Modified Files
Name | ||||
---|---|---|---|---|
M | plugins/docman/include/Docman_PermissionsExport.class.php | +6 | −5 | Go to diff View file |
M | plugins/docman/include/Docman_PermissionsManagerDao.class.php | +8 | −7 | Go to diff View file |
M | plugins/git/include/Git/PermissionsDao.php | +2 | −2 | Go to diff View file |
M | plugins/git/include/GitDao.class.php | +2 | −2 | Go to diff View file |
M | plugins/tracker/include/Tracker/Artifact/dao/Tracker_ArtifactDao.class.php | +1 | −1 | Go to diff View file |
M | plugins/tracker/include/Tracker/PermissionsDao.class.php | +5 | −5 | Go to diff View file |
M | plugins/tracker/include/Tracker/Report/dao/Tracker_ReportDao.class.php | +1 | −1 | Go to diff View file |
M | src/common/dao/ArtifactDao.class.php | +6 | −5 | Go to diff View file |
M | src/common/dao/PermissionsDao.class.php | +6 | −5 | Go to diff View file |
M | src/common/frs/FRSPermissionDao.php | +2 | −2 | Go to diff View file |
M | src/common/tracker/ArtifactXMLExporterDao.class.php | +2 | −2 | Go to diff View file |
M | src/common/wiki/lib/WikiCloner.class.php | +8 | −8 | Go to diff View file |
M | src/db/mysql/database_structure.sql | +1 | −1 | Go to diff View file |
M | src/utils/tv3_to_test.php | +2 | −2 | Go to diff View file |