I want to store domain names(example:google.com – without “http://” and “www”)in MySQL as primary key+Index.
so when I call a domain through PHP I should get the result according to that domain faster.
Right now I am inserting domain in plain text.
is it right way to do it?? or do I need to hash it??
your Ideas please
I think you should not use char/varchar in primary index. Rather create an int PK and domain column with unique constraint.
I think that would work in your case.
Checkout some reasons here:
CHAR() or VARCHAR() as primary key in an ISAM mySQL table?
http://forums.mysql.com/read.php?153,243809,243818#msg-243818
EDIT
Here is the sample table. I created this table on assumptions. Change it according to your need.
P.S. Created using mysql workbench.