List:General Discussion« Previous MessageNext Message »
From:Peter Van Dijck Date:June 20 2006 7:08am
Subject:Query question: select * from table where id in (1,2,3) order by date uses FILESORT
View as plain text  
Hi all,
this is a problem I'm running into:

A table has like 400,000 rows, with a primary key index id. I use this query:

SELECT * FROM table WHERE id IN (58, 25, 75, ...) ORDER BY post_date
DESC LIMIT 0, 40

The problem is, it uses the index id and then a FILESORT.

Questions:
1) Am I correct in thinking that a filesort on this large table is
bad? Or is mysql filesorting only the 40-row result set, and itt's not
so bad?

2) Any solutions? Is this a common problem?

Thanks,
Peter

-- 
find videoblogs: http://mefeedia.com
my blog: http://poorbuthappy.com/ease/
my job: http://petervandijck.net
Thread
Query question: select * from table where id in (1,2,3) order by date uses FILESORTPeter Van Dijck20 Jun
  • Re: Query question: select * from table where id in (1,2,3) order by date uses FILESORTBrent Baisley20 Jun
    • Re: Query question: select * from table where id in (1,2,3) orderby date uses FILESORTDan Buettner20 Jun