[nycphp-talk] Index files in MySQL
Leila Lappin
damovand at yahoo.com
Wed Jul 27 19:13:32 EDT 2005
I dont know if this has been answered or not but,
this select statement simply returns the number of
records in the table. Since youre not returning id
therefore nothing happens to the order.
--- Amir Aavani <amir.aavani at gmail.com> wrote:
> Dear friends
> I have some problem in getting query from mysql,
> I have table named news in following fornat
> ID Int, sid Int, Title Varchar , .... data DateTime
> I have a query like this
> SELECT count(*) from news where sid in (1, 2, 3, 4,
> 5 ,6, ...) order
> by id LIMIT 0, 10;
> I want to force mysql to use id as index (not sid)
> (because of bug
> size of my table) but I was unsuccessfull in that,
> and always mysql
> use filesort to sort the results.
> Something wonderfull is when I changed the query to
> SELECT count(*) from news where (id< 1000 or id>
> 100000) order by id
> LIMIT 0, 10;
> mysql didn't use id as index.
>
> Thanks in advanced
> Amir Aavani
> _______________________________________________
> New York PHP Talk Mailing List
> AMP Technology
> Supporting Apache, MySQL and PHP
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the talk
mailing list