List:General Discussion« Previous MessageNext Message »
From:Jim Faucette Date:January 11 2000 8:19pm
Subject:Re: why isn't this key used
View as plain text  
Mike Wexler wrote:
> 
> Why isn't the key on the 'active' field used for the query?
> 
> EXPLAIN SELECT storeId FROM accounts WHERE active=1;
> +----------+------+---------------+------+---------+------+------+------------+
> | table    | type | possible_keys | key  | key_len | ref  | rows | Extra      |
> +----------+------+---------------+------+---------+------+------+------------+
> | accounts | ALL  | active        | NULL |    NULL | NULL |  797 | where used |
> +----------+------+---------------+------+---------+------+------+------------+
> 1 row in set (0.00 sec)
> 

What does this show?
SELECT COUNT(*) FROM accounts;
Depending on the total number of rows, MySQL may decide a full table
scan will be more efficent than using an index.

  jim...
Thread
why isn't this key usedMike Wexler11 Jan
  • Re: why isn't this key usedJim Faucette11 Jan
    • Re: why isn't this key usedMike Wexler12 Jan
  • Re: why isn't this key usedSasha Pachev12 Jan
  • Re: why isn't this key usedSasha Pachev12 Jan
    • Re: why isn't this key usedMichael Widenius12 Jan
      • Re: why isn't this key usedMike Wexler12 Jan
        • Re: why isn't this key usedBenjamin Pflugmann12 Jan
    • image map queryChris Mason14 Mar
      • Re: image map querySergei A. Golubchik14 Mar