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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 (
 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
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


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.