I'm a little bit confused about what EXPLAIN is saying about a query
I'm doing with an ORDER BY clause.  I've read and re-read the parts of
the manual about how ORDER BY is optimized, but it won't sink in to my
thick skull for some reason.

I've got an index on a column called price, which is an INT:

    mysql> show columns from homes like 'price' \G
    *************************** 1. row ***************************
      Field: price
       Type: int(11)
       Null: YES
        Key: MUL
    Default: NULL
      Extra: 
    1 row in set (0.00 sec)

which I frequently sort by.  EXPLAIN says that a filesort is necessary
to do this:


    mysql> explain select * from homes order by price \G
    *************************** 1. row ***************************
            table: homes
             type: ALL
    possible_keys: NULL
              key: NULL
          key_len: NULL
              ref: NULL
             rows: 3628
            Extra: Using filesort
    1 row in set (0.00 sec)

even when I do an "ALTER TABLE homes ORDER BY price".

Why is a filesort required to sort these rows?  Is this something I
should worry about as this system goes from 1500 queries/day to 15000
queries/day to 150000 queries/day?  Is there something I can do that
is faster?

Sorry if this is a stupid question; this is the first database I've
designed where I've had to put much thought into performance.

Thanks for any info or pointers to documentation,

-----ScottG.

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