owncloud/core — pull request #4782 by butonic (2013-09-09 20:05:34+00:00)
Title: Tune legacy cache webdav properties prefixing

@felixboehm reported lengthy upgrades from OC4.5 to OC5. Other than adding indexes this might help as well because it prefixes the webdav properties in one SQL statement instead of individual UPDATE statements. The performance could be further improved with an index on the `propertyname` column:
```sql
create index oc_properties_propertyname on oc_properties(propertyname);
```

Since we are talking 500.000+ rows creating the index might take even longer than executing the update.
@icewind1991 could you check I did not screw up the SQL?
@felixboehm would be awesome if you could check the performance. If there is a mysql DB you can try to further improve the performance by disabling index updates prior to executing the update:
```sql
ALTER TABLE `oc_properties` DISABLE KEYS;
```
and enabling them afterwards:
```sql
ALTER TABLE `oc_properties` ENABLE KEYS;
```

You can also prepare this optimization in advance of the migration. Just delete `apps/files/appinfo/update.php` and execute the following SQL (assuming you are on mysql):
```sql
ALTER TABLE `oc_properties` DISABLE KEYS;
UPDATE `*PREFIX*properties` SET `propertyname` = concat('{DAV:}', `propertyname`) WHERE `propertyname` LIKE '{%'";
ALTER TABLE `oc_properties` ENABLE KEYS;
```