Subject Re: Problem slow sorting/distinct in Firebird
Author vanderlinde81
Hello Dimitry,

Yes, that's right! I use MySQL / InnoDB. With the query:

SELECT distinct tr.IdLink, tr.IdTargetLink, tr.IdItem, tr.NodePosition
FROM Tree3 tr
inner join article3_1 art on art.idarticle = Tr.iditem
WHERE tr.ItemType = 2 AND tr.Market1 = 1
AND ((art.IDARTICLE > 0) AND ( (LCASE(art.Artikelnummer) like '%a4 papier%' ) OR ( (LCASE(art.Artikelnummer) like '%a4%' )
AND (LCASE(art.Artikelnummer) like '%papier%')) OR (LCASE(art.Artikelnaam1) like '%a4 papier%' ) OR ( (LCASE(art.Artikelnaam1) like '%a4%' )
AND (LCASE(art.Artikelnaam1) like '%papier%')) OR (LCASE(art.Artikelnaam2) like '%a4 papier%' ) OR ( (LCASE(art.Artikelnaam2) like '%a4%' )
AND (LCASE(art.Artikelnaam2) like '%papier%')) OR (LCASE(art.Artikelnr_leverancier) like '%a4 papier%' ) OR ( (LCASE(art.Artikelnr_leverancier) like '%a4%' )
AND (LCASE(art.Artikelnr_leverancier) like '%papier%')) OR (LCASE(art.Merk) like '%a4 papier%' ) OR ( (LCASE(art.Merk) like '%a4%' )
AND (LCASE(art.Merk) like '%papier%')) OR (LCASE(art.EAN) like '%a4 papier%' ) OR ( (LCASE(art.EAN) like '%a4%' )
AND (LCASE(art.EAN) like '%papier%')) OR (LCASE(art.AltArtnr1) like '%a4 papier%' ) OR ( (LCASE(art.AltArtnr1) like '%a4%' )
AND (LCASE(art.AltArtnr1) like '%papier%')) OR (LCASE(art.AltArtnr2) like '%a4 papier%' ) OR ( (LCASE(art.AltArtnr2) like '%a4%' )
AND (LCASE(art.AltArtnr2) like '%papier%')) ))
AND tr.NODELEVEL =5 and tr.LINKTYPE <> 5
ORDER BY tr.NodePosition LIMIT 30;

Thanks!

--- In firebird-support@yahoogroups.com, Dmitry Yemanov <dimitr@...> wrote:
>
> 19.11.2012 14:52, vanderlinde81 wrote:
> >
> > Thanks for your reply! I've tried your query and it is indeed a bit
> > faster. But there is still a big difference between MySQL and Firebird.
> > The difference now is 900ms. What could be the cause?
>
> I hope you're comparing Firebird with MySql/InnoDB and not with
> MySql/MyISAM, right?
>
>
> Dmitry
>