Tell me more ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have a database with one table which contains a few varchar columns which can contain data from a fixed set (testdata1 can contain three different values in about 10,000 rows).

I thought about to use two relational tables for the values, is it worth?

My actual database with one table:

+-------------+--------------+------+-----+---------+----------------+
| Field       | Type         | Null | Key | Default | Extra          |
+-------------+--------------+------+-----+---------+----------------+
| id          | int(10)      | NO   | PRI | NULL    | auto_increment |
| name        | varchar(100) | NO   |     | NULL    |                |                                             
| description | text         | YES  |     | NULL    |                |                                             
| testdata1   | varchar(100) | NO   |     | NULL    |                |                                             
| testdata2   | varchar(100) | NO   |     | NULL    |                |                                                                                        
+-------------+--------------+------+-----+---------+----------------+



and I thought to replace the columns testdata1 and testdata2 with a relational tables, like this:

+-------------+--------------+------+-----+---------+----------------+
| Field       | Type         | Null | Key | Default | Extra          |
+-------------+--------------+------+-----+---------+----------------+
| id          | int(10)      | NO   | PRI | NULL    | auto_increment |
| name        | varchar(100) | NO   |     | NULL    |                |                                             
| description | text         | YES  |     | NULL    |                |                                             
| testdata1   | int(10)      | NO   |     | NULL    |                |                                             
| testdata2   | int(10)      | NO   |     | NULL    |                |                                                                                        
+-------------+--------------+------+-----+---------+----------------+

and the tables, they are just simple id and name (this table exist two times, for testdata1 and testdata2)

+-------------+--------------+------+-----+---------+----------------+
| Field       | Type         | Null | Key | Default | Extra          |
+-------------+--------------+------+-----+---------+----------------+
| id          | int(10)      | NO   | PRI | NULL    | auto_increment |
| name        | varchar(100) | NO   |     | NULL    |                |                                                                                      
+-------------+--------------+------+-----+---------+----------------+

I want the best performance and the smallest size, because I have to query the database often via a PHP Api.


Edit: The most used query:

`SELECT * FROM `table` WHERE `column` LIKE '%$query_input%' ORDER BY `column` ASC LIMIT $start_input, $count_input`

Replace column with name, testdata1 or testdata2 (the table have 5 more columns which are like testdata).

Sometimes there are UPDATEs or INSERTs, but they're mostly executed by myself.

share|improve this question
8  
Please put a lot of effort into clarifying what you are asking here. It's entirely unclear what the question is. – JNK Oct 12 '12 at 14:42
1  
Will you reuse your varchar values? And, please, read something to discover the difference between a database and a table. – dezso Oct 12 '12 at 14:54
1  
Please provide examples of queries that run against this table. – Jon Seigel Oct 12 '12 at 15:11
1  
Edited my question with some examples and explenation. – Leandros Oct 12 '12 at 15:20
1  
The answer is gone. I think I completely misunderstood you. But what do you want to do with a DB if not storing data? (Regarding this:"Hm, why do I need to store data? Which data? ") – dezso Oct 13 '12 at 17:17
show 4 more comments

closed as not a real question by Phil, Derek Downey, Marian, RolandoMySQLDBA, Paul White Oct 21 '12 at 22:33

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

Browse other questions tagged or ask your own question.