28, May 2012

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
Instabuck - The easy way to sell digital products online

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


It's time to use PHP5!


« on: Jul 28, 2006, 03: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)

I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #1 on: Jul 28, 2006, 03: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: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #2 on: Jul 28, 2006, 03: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?

I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #3 on: Jul 28, 2006, 04: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: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


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

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

I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #5 on: Jul 29, 2006, 01: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: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #6 on: Jul 29, 2006, 01: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.

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?
May 28, 2012, 12:38:48 pm





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!






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