Take the 2-minute tour ×
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 need to store search keywords in a database to analyse user needs. How efficient should my schema be?

I'm thinking like this:

CREATE TABLE SearchKeyword (
 ID         INTEGER        PRIMARY KEY AUTOINCREMENT NOT NULL,
 UserID     INTEGER,         
 SearchKey  VARCHAR( 255 ) NOT NULL,
 Date       TIMESTAMP      NOT NULL
); 

But with this, the table will grow. Any suggestions for improvements?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

If the keys repeat frequently, create a second table

CREATE TABLE Key_tbl (key_id INT, key VARCHAR(<>))

and reference the first table with this, while inserting just look up the key and insert the key_id in SearchKeyword

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.