Hi:

Let's say I want to store the following information.

Unique ID - INT(10) autoincrement
First Name - VARCHAR (25)
Last Name - VARCHAR (25)
Age - INT(3)
Date - DATETIME
Activity - VARCHAR(100)
Data - TEXT


I would be basing my queries on all columns _except_ the Data column. I.e. I 
would be using WHERE's with all except the Data column.


My question is...which design would perform better?

(Design A) Put all in one table...index all the columns that I will use 
WHERE with.
-TABLE_ALL-
Unique ID - INT(10) autoincrement
First Name - VARCHAR (25)
Last Name - VARCHAR (25)
Age - INT(3)
Date - DATETIME
Activity - VARCHAR(100)
Data - TEXT

Indices - Unique ID, First Name, Last Name, Age, Date, Activity

SELECT First_Name, Last_Name, Data
FROM TABLE_ALL
WHERE
Activity = 'draw' AND Age > 24;



(Design B) Put the Data in its own separate table.
-TABLE_A-
Unique ID - INT(10) autoincrement
First Name - VARCHAR (25)
Last Name - VARCHAR (25)
Age - INT(3)
Date - DATETIME
Activity - VARCHAR(100)
Data_ID - INT(10)

Indices - Unique ID, First Name, Last Name, Age, Date, Activity

-TABLE_B-
Data_ID - INT(10)
Data - TEXT

Index - Data_ID


SELECT TABLE_A.First_Name, TABLE_A.Last_Name, TABLE_B.Data
FROM TABLE_A, TABLE_B
WHERE
Activity = 'draw' AND Age > 24 AND TABLE_A.Data_ID = TABLE_B.Data_ID;
(Aside: Would this query give me the same results as the above query?)


-James

Reply via email to