Hi,

both queries would have the limit on them, so they would only return 10
rows. but yes, there are probably about 10x as many records with true than
with anything else.

If there are only six possible values, and one values occurs ten times as often as the other five values, that means it occurs more than 50% of the time.

As a general rule, an index on such a column will NOT be useful for selecting rows having the often-occurring value. Such an index is only useful if you *only* need to select the non-occurring values.

What you CAN, perhaps do, though, is create a multi-column index instead, so that MySQL doesn't need to scan all rows and order them for you. Your query was:

select *, id as vid, user_id as uid from video where (file_complete =
'true') order by undt desc limit 0,10;

Creating an index on (file_complete, undt) should work nicely:

  ALTER TABLE video ADD INDEX (file_complete, undt);

Regards,

Jeremy

--
high performance mysql consulting
www.provenscaling.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to