|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hello i use this query:
select i.item_id from orders o INNER JOIN item i ON i.nr=i.nr INNER JOIN user_cart u ON u.nr=i.nr where (i.count !=0 or i.count!=NULL) and i.isactive=1 and i.kolWo>0 order by i.count DESC LIMIT 5 It works quickly without ORDER BY With ORDER BY, CPU goes to 100% and I have to wait. i.count has Btree Index Allways if I use order by is the query very slow also ORDER BY i.item_id is slow to. i.item_id, i.nr has Btree indexes. Mysql version 5.0.45-5 Any Ideas? -- Best Regards Vlad Vorobiev http://www.mymir.org |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
> > Hello i use this query: > > select i.item_id > from orders o > INNER JOIN item i ON i.nr=i.nr Should the line above not be .... ON i.nr = o.nr ? > INNER JOIN user_cart u ON u.nr=i.nr > where (i.count !=0 or i.count!=NULL) and i.isactive=1 and i.kolWo>0 > order by i.count DESC > LIMIT 5 > > It works quickly without ORDER BY > With ORDER BY, CPU goes to 100% and I have to wait. > i.count has Btree Index > Allways if I use order by is the query very slow also ORDER BY > i.item_id is slow to. > i.item_id, i.nr has Btree indexes. > > Mysql version 5.0.45-5 > > Any Ideas? |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
2008/1/2, Edward Kay <edward@labhut.com>:
> > > > > Hello i use this query: > > > > select i.item_id > > from orders o > > INNER JOIN item i ON i.nr=i.nr > > Should the line above not be > ... ON i.nr = o.nr ? Autch..... thank you! It works now. -- Best Regards Vlad Vorobiev http://www.mymir.org |
|
![]() |
| Outils de la discussion | |
|
|