On Tuesday 16 July 2002 05:05 pm, Jeremy Zawodny wrote:
> On Tue, Jul 16, 2002 at 03:52:35PM -0400, walt wrote:
> > I have an INNODB table which has 99994 records in it. customer_number is
> > the primary key.
> >
> > If I run
> > select count(cutomer_number) from customer;
> >
> > It takes about 15 seconds to return the number of rows.
> > I ran explain on the query and it's using the unique key index on
> > customer_number.
>
> That's documented.  InnoDB must read the whole table.
>
> > If I run
> > SHOW TABLE STATUS LIKE 'cutomer';
> > it only takes about 1.52 seconds for innodb to tell me number of rows.
>
> That's an estimate of the number of rows.
>
> Jeremy

Thanks Jeremy!
After I sent this email, I changed the primary key to a unique index and it 
took under 2 seconds to return the number of rows. Do you know of any 
advantage a primary key would have over a unique index? 
The unique index still enforces the uniqueness of the column. Kinda funny that 
the error message from violating the unique index is 
"Duplicate entry '104191' for key 1"
:-)

Thanks!
-- 
Walter Anthony
System Administrator
National Electronic Attachment
Atlanta, Georgia 
1-800-782-5150 ext. 1608
 "If it's not broke....tweak it"




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to