Comment 2 for bug 1724603

Revision history for this message
issam.taboubi (issam-tab) wrote :

Hi Robert,

I would like to share a solution that I applied in our institution.

We have a collection (66 pages) that takes 130 second to be copied because of the method "update_hierarchy_path" doing update query on the table "artefact" (in our case 500K records) , with no index in the query it does not help.

We came up with the idea of adding the column owner in update query, because we update the hierarchy of the path for the artifacts we just inserted. And since there is an index on the owner column this has lowered the processing from 139 seconds to 19 seconds.

Here are the two modified lines of code (line 1429 of artefact/lib.php):

$params = array($newparent->path, $length, $this->owner, $this->path, db_like_escape("{$this->path}/") . '%');
 $sql = "UPDATE {artefact} SET path = ? || SUBSTR(path, ?) WHERE owner = ? AND (path = ? OR path LIKE ? )";

I want to know if there are any side effects for using the owner column in the query.

Please advise

Thank you.