"Octavian Rasnita" <[EMAIL PROTECTED]> wrote on 11/07/2005 01:53:06 PM:

> Hi,
> 
> I have tried:
> 
> mysql> select count(*) from table_name where date='2005-11-07' and 
id=11;
> +----------+
> | count(*) |
> +----------+
> |        0 |
> +----------+
> 1 row in set (46.42 sec)
> 
> As you may see, this query took more than 46 seconds and I don't know 
why.
> I am the single person that was using the database in the moment I've 
made
> that query, and there are no programs that use to lock the tables until
> finishing some other queries anyway.
> 
> The table has an index on the data field and another index on the id 
field,
> and usually takes much less time for such a query.
> 
> This database is used in a web site and I see sometimes that it takes a 
very
> long time for displaying some pages and now I know that the problem is 
the
> database.
> 
> The version of MySQL which is installed on the computer I work is:
> 4.1.5-gamma-standard-log
> 
> I know it could be a little older, but this could be the only problem? 
(and
> the fact that is a gamma version?)
> 
> Thank you.
> 
> Teddy
> 

What does using EXPLAIN tell you about this query? Which index (if any) 
does the optimizer choose? What kind of table is it (MyISAM, InnoDB, 
Archive, ...)?

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Reply via email to