Hery,
          You need to get some idea of how many records are being counted. 
What I suggest is to put a Limit on your select statement and gradually 
increase it.

For example
select count(*) from TABLE_1 where FIELD_1 = "XXX_CC" limit 10;

If this takes too long, then you know right away there is something wrong 
with the index.
If it is fast enough, then increase it to "Limit 1000" and test the time. 
Then bump it up to 5000, 10000 etc. until you get an idea of how many rows 
it is trying to count. Perhaps it there are 1 million rows with FIELD_1 = 
"XXX_CC"?

Brent

At 03:08 AM 2/4/2002 , you wrote:

>----- Original Message -----
>From: "David Phillips" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Monday, February 04, 2002 4:01 PM
>Subject: Re: How to index Optimization on 20 million record
>
>
> > >   PRIMARY KEY  (`FIELD_1`),
> > >   KEY `FIELD_1` (`FIELD_1`),
> >
> > You don't need a second key on the column, as it is a duplicate of the
> > primary key.
>
>
>of cource FIELD_2 also primary key, sorry i miss information
>
>CREATE TABLE `TABLE_1`(
>   `FIELD_1` varchar(64) NOT NULL default '',
>   `FIELD_2` varchar(16) NOT NULL default '',
>   `FIELD_3` varchar(150) default NULL '',
>   PRIMARY KEY  (`FIELD_1`,'`FIELD_2`),
>   KEY `FIELD_1` (`FIELD_1`),
>) TYPE=MyISAM PACK_KEYS=1
>
>
>but, why still long time to got the result from this query  : select
>count(*) from TABLE_1 where FIELD_1 = "XXX_CC";
>
>any error from my structure database or whatever


---------------------------------------------------------------------
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