Hi all,

I noticed that homebox_users lacks any indexes. This maybe a problem down the road and indexing (uid,name) as a PK seems like a fairly good choice unless I'm missing something.


MariaDB [drupal_redesign]> desc homebox_users;
+----------+------------------+------+-----+---------+-------+
| Field    | Type             | Null | Key | Default | Extra |
+----------+------------------+------+-----+---------+-------+
| uid      | int(10) unsigned | NO   |     | 0       |       |
| name     | varchar(64)      | NO   |     |         |       |
| settings | longtext         | NO   |     | NULL    |       |
+----------+------------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

I'd put UID first in the index, as name is likely to have a very low cardinality on most sites. Especially as you will only be able to index a prefix of the column. This should be a considerable performance improvement for larger sites and makes it a less dangerous table (as with longtext in the table, if an order by/group by ever hits the table its going to go directly to a temp table on disk and not be able to enter a HEAP table).

I can understand that this may have been done due to this being a very volatile table, to avoid the index overhead. However, with InnoDB you will always have a PK index so all you get by not defining one is the assurance it will be entirely useless to a select.

CommentFileSizeAuthor
#3 homebox.patch1.06 KBdrumm
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drumm’s picture

mstef’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev

Changing version

drumm’s picture

FileSize
1.06 KB

Straightforward patch attached.

drumm’s picture

Status: Active » Needs review
mstef’s picture

Status: Needs review » Patch (to be ported)

Nice work

mstef’s picture

Status: Patch (to be ported) » Closed (fixed)

Committed