List:General Discussion« Previous MessageNext Message »
From:Mikhail Berman Date:November 17 2005 9:29pm
Subject:RE: A "key" question
View as plain text  
Dear Jasper,

I may not have been precise in my question, but the Unique Index in
question is a two fields index, and I was looking to find out wisdom
from the List if there is sense and/or experience in keying second(left)
field on in the Unique Index to speed up a search.
I am dealing with 32M rows table, where second field in the Unique Index
is a date field. Unfortunately for my simple "SELECT MAX(Date) as
Latest_Date from THE_TABLE" took 4 minutes and some seconds, so before I
will go and buy bigger server I needed to re-assure myself that there is
no other way.

I would not bother the List without a good reason and doing what you
said before


Mikhail Berman

-----Original Message-----
From: Jasper Bryant-Greene [mailto:jasper@stripped] 
Sent: Thursday, November 17, 2005 4:19 PM
To: Mikhail Berman
Cc: mysql@stripped
Subject: Re: A "key" question

Mikhail Berman wrote:
> Is it possible or  makes sense to key a field that is a part of Unique

> Index already?

It's possible, but it doesn't make sense. A unique index is a normal
index with an added unique constraint. Adding another index on the same
field would make no sense (unless the field is a rightmost part of a
unique index).

Your question would have been answered by checking the archives less
than a week back (this question comes up a lot) or reading the manual.

A "key" questionMikhail Berman17 Nov
  • Re: A "key" questionJasper Bryant-Greene17 Nov
  • Re: A "key" questionPeter Brawley17 Nov
RE: A "key" questionMikhail Berman17 Nov
  • Re: A "key" questionJeremy Cole17 Nov
RE: A "key" questionMikhail Berman18 Nov
  • Re: A "key" questionJeremy Cole18 Nov
  • Re: A "key" questionMichael Stassen18 Nov
RE: A "key" questionMikhail Berman18 Nov
  • Re: A "key" questionMichael Stassen18 Nov
RE: A "key" questionMikhail Berman18 Nov
  • Re: A "key" questionDavid Griffiths18 Nov
  • Connection ProblemTripp Bishop18 Nov
    • Re: Connection ProblemMichael Stassen18 Nov
      • Re: Connection ProblemTripp Bishop18 Nov