954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Smaller records == better efficiency?

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?

davecoventry
Newbie Poster
16 posts since Jun 2009
Reputation Points: 10
Solved Threads: 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.

jbisono
Posting Pro in Training
442 posts since May 2009
Reputation Points: 71
Solved Threads: 59
 

Thanks for that. Roughly what I had thought.

davecoventry
Newbie Poster
16 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
 

anytime, take care.

jbisono
Posting Pro in Training
442 posts since May 2009
Reputation Points: 71
Solved Threads: 59
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You