0

I have a drupal user table:

+------------------+------------------+------+-----+---------+----------------+
| Field            | Type             | Null | Key | Default | Extra          |
+------------------+------------------+------+-----+---------+----------------+
| uid              | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| name             | varchar(60)      | NO   | UNI |         |                |
| pass             | varchar(32)      | NO   |     |         |                |
| mail             | varchar(64)      | YES  | MUL |         |                |
| mode             | tinyint(4)       | NO   |     | 0       |                |
| sort             | tinyint(4)       | YES  |     | 0       |                |
| threshold        | tinyint(4)       | YES  |     | 0       |                |
| theme            | varchar(255)     | NO   |     |         |                |
| signature        | varchar(255)     | NO   |     |         |                |
| created          | int(11)          | NO   | MUL | 0       |                |
| access           | int(11)          | NO   | MUL | 0       |                |
| login            | int(11)          | NO   |     | 0       |                |
| status           | tinyint(4)       | NO   |     | 0       |                |
| timezone         | varchar(8)       | YES  |     | NULL    |                |
| language         | varchar(12)      | NO   |     |         |                |
| picture          | varchar(255)     | NO   |     |         |                |
| init             | varchar(64)      | YES  |     |         |                |
| data             | longtext         | YES  |     | NULL    |                |
| signature_format | smallint(6)      | NO   |     | 0       |                |
+------------------+------------------+------+-----+---------+----------------+
19 rows in set (0.09 sec)

I'm doing a lot of SELECT uid FROM users WHERE name='dave';

Does it make sense to create the new table:

+-------+-------------+------+-----+---------+-------+
| Field | Type        | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| uid   | int(10)     | NO   | PRI | NULL    |       |
| name  | varchar(64) | NO   |     | NULL    |       |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.09 sec)

Are there any benefits?

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by jbisono
0

I do not see any benefit creating another table,
First you are retrieving a specific value without any join or combined statement. In the other hand you right if you retrieve smaller record you have better efficiency, but the question is, is it worth the difference between the retrieving time? in this specific case I bet you not, besides creating another table is going to add another procedure to maintain two tables at the same time.

Regards.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.