22, March 2010

UNIQUE and INDEX keys should not both be set for column ... - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  Databases  >  MySQL
Topic: UNIQUE and INDEX keys should not both be set for column ...
« previous next »
Pages: [1] Print

Author Topic: UNIQUE and INDEX keys should not both be set for column ...  (Read 2033 times)
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6690
34708 credits
Members referred : 374


It's time to use PHP5!


« on: Jul 28, 2006, 04:42:36 pm »

Hello,

I have a table with the domain tld as key and the unique key to prevent double entries.

but phpmyadmin (and maybe also mysql) is giving this warning:

UNIQUE and INDEX keys should not both be set for column `tld`

why? it works well (I think)


Last blog : A new Wordpress theme for our blog
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5660
45593 credits
Members referred : 3



« Reply #1 on: Jul 28, 2006, 04:47:50 pm »

This is because a UNIQUE key is actually an extension to a INDEX.

In other words it is an index that doesn't allow the same records to reappear.

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6690
34708 credits
Members referred : 374


It's time to use PHP5!


« Reply #2 on: Jul 28, 2006, 04:53:58 pm »

This is because a UNIQUE key is actually an extension to a INDEX.

In other words it is an index that doesn't allow the same records to reappear.
that will say the index key is enough to prevent double values?


Last blog : A new Wordpress theme for our blog
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5660
45593 credits
Members referred : 3



« Reply #3 on: Jul 28, 2006, 05:55:43 pm »

No. The unique key is for that, but both are indexing the table.

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6690
34708 credits
Members referred : 374


It's time to use PHP5!


« Reply #4 on: Jul 28, 2006, 08:32:44 pm »

that will say I have to use them both and I have to ignore the warning...


Last blog : A new Wordpress theme for our blog
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5660
45593 credits
Members referred : 3



« Reply #5 on: Jul 29, 2006, 02:04:02 am »

No. You only need a unique, because a unique index is still an index.

By having them both you will not have better performance, and the table will get more HD space.

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6690
34708 credits
Members referred : 374


It's time to use PHP5!


« Reply #6 on: Jul 29, 2006, 02:08:48 am »

No. You only need a unique, because a unique index is still an index.

By having them both you will not have better performance, and the table will get more HD space.
Ok, I understand thank you.


Last blog : A new Wordpress theme for our blog
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=3440
Tags : domains php my admin Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  Databases  >  MySQL
Topic: UNIQUE and INDEX keys should not both be set for column ...
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Mar 22, 2010, 11:04:58 am





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!





Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2010 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.