Christoph, Indexes are built on key fields, so yes. When a field is identified as a key it is indexed.
To answer your second question, it is the index which maintains the uniqueness of a field. A book is a really good analogy. If you wanted to look up the references to "string", you can do it very quickly in the index. Even if you don't come close to the "s" section, you immediately know whether to look next to the right or to the left. If you push the issue, and act extremely dumb (like a computer), you'll find the page containing "string" within 7 hits; once you're on that page it's a short read to find the term. That's what makes searching on indexed fields so fast. To find the term in the book requires you to start reading on page 1 and to read text until you find the term. Which why searches which do not take advantage of key fields are so slow. Indexes are your friend, they don't slow down the addition of records that much, and make retrieval of records extremely fast. Regards - Miles Thompson At 02:13 PM 5/2/2002 +0200, Christoph Starkmann wrote: >Hi there! > >I guess I got a very easy question for the pros here... >I've been searching the documentaion of mySQL, but didn't >find the answer (even though I'm sure it's out there >somewhere :))... > >Is a primary key in mySQL automatically indexed? And is a >unique field indexed automatically ?(I don't think and >don't hope so, but one never knows) > >Thanx, > >Kiko > >-- >It's not a bug, it's a feature. >christoph starkmann >mailto:[EMAIL PROTECTED] >http://www.gruppe-69.com/ >ICQ: 100601600 >-- > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php