Subject | Re: [firebird-support] Slow query when using ORDER BY |
---|---|
Author | Helen Borrie |
Post date | 2006-02-06T06:27:18Z |
At 03:21 PM 6/02/2006, you wrote:
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
>I'm having trouble with the following query. When I run the followingIf the ordering is essential, how does this one go?
>it returns 14016 record in just over 4 seconds:
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