Subject Re: [firebird-support] Slow query when using ORDER BY
Author Helen Borrie
At 03:21 PM 6/02/2006, you wrote:
>I'm having trouble with the following query. When I run the following
>it returns 14016 record in just over 4 seconds:

If the ordering is essential, how does this one go?

SELECT
i.TITLE AS "Title",
i.TITLE2 AS "Title2",
(select if1.CATALOGUENO
from ItemInFormat if1
where if1.ItemID = i.ItemID) AS "Catalogue Number",
(select if2.BARCODE
from ItemInFormat if2
where if1.ItemID = i.ItemID) AS "Barcode",
(select f.DESCRIPTION
from Formats f join ItemInFormat if3
on f.FormatID = if3.FormatID
where if3.ItemID = i.ItemID) AS "Format",
(select d.DESCRIPTION from Distributors d
where d.DistributorID = i.DistributorID) AS "Distributor",
(select g.Description from Genres g
where g.GenreID = i.GenreID) AS "Genre",
i.DISTRIBUTOR_RELEASE_DATE AS "Release Date",
i.ITEMID
FROM ITEM i
ORDER BY i.TITLE ASC

./heLen