Subject | Re: [firebird-support] ORDER BY too slow |
---|---|
Author | liviuslivius |
Post date | 2019-03-21T07:35:47Z |
Hi
yes, slowdown is because of sort as engine must sort the table first and then retrieve 10 records.
But you can try to speed this up by:
SELECT
FIRST 10 SKIP 0
msg.OBJ_GUID AS "MSG_GUID", msg.PRTY, msg.TTL,
pst.OBJ_GUID AS "PST_GUID", pst.MSTB_DTS
FROM
(Select * from MSGS m order by m.PRTY) msg
JOIN MSG_PSTS pst ON msg.OBJ_GUID = pst.MSG_GUID
JOIN MSG_USRS meu ON msg.OBJ_GUID = meu.MSG_GUID
JOIN USRS usr ON msg.USR_GUID = usr.OBJ_GUID
WHERE
meu.USR_GUID = '12A61B0FAE3046B6AEDEEDF6B4FE0E78'
ORDER BY
msg.PRTY, pst.MSTB
Please include results: timing and fetching stats. I am interested self in the results. I suppose that this should be faster then your oryginal query.
Regards,
Karol Bieniaszewski