Web Hosting Talk







View Full Version : MySQL Speed Question


rougy
08-02-2008, 05:16 PM
Hi,

I've got one main table with nothing but a numeric, primary key and a varchar column that will contain unique domain names (never a duplicate).

The primary key auto_increments and the varchar column is "unique" for now.

Is that pretty much the most optimized setup, or should I make the varchar column a secondary index as well, since it does tie into other tables?

Thanks.

Edevere
08-03-2008, 12:23 AM
Wait and when you find slow queries use EXPLAIN to figure out the problem.

CodyRo
08-03-2008, 01:22 AM
Is that pretty much the most optimized setup, or should I make the varchar column a secondary index as well, since it does tie into other tables?

Without more information it's hard to help.. but your current setup seems like it should be fine.

vibrokatana
08-03-2008, 03:06 AM
Use a unique index on the varchar column. It will cause any insertions that put in a duplicate value to fail. You can even put multiple columns into a unique index, and it will ensure a combination of the columns is not duplicated.

rougy
08-04-2008, 01:32 PM
Thanks for your input.