NYCPHP Meetup

NYPHP.org

[nycphp-talk] Index files in MySQL

Amir Aavani amir.aavani at gmail.com
Thu Jul 28 00:43:20 EDT 2005


Dear Leila,
I misstyped the query, (count(*) must be replaced by * ),

On 7/28/05, Leila Lappin <damovand at yahoo.com> wrote:
> I don't know if this has been answered or not but,
> this select statement simply returns the number of
> records in the table.  Since you're 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 big
> > 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
> _______________________________________________
> New York PHP Talk Mailing List
> AMP Technology
> Supporting Apache, MySQL and PHP
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org
>



More information about the talk mailing list