Hello!

ORDER BY will have to sort the whole table.

I think that using index on QUEUED will be optimal here. What is the
selectivity of this field? If it s boolean, you might as well use UNION
queries.

Have you tried joining JOBS via WHERE EXISTS?

Regards,
-- 
Ilya Kasnacheev



пт, 9 апр. 2021 г. в 01:03, DonTequila <[email protected]>:

> Hi,
>
> I have a SQL performance issue. There are indexes on both fields that are
> used in the ORDER BY clause and the WHERE clause.
>
> The following statement takes about 133941 ms with several warnings from
> IgniteH2Indexing:
>
> SELECT JQ._KEY
> FROM "JobQueue".JOBQUEUE AS JQ
> INNER JOIN "Jobs".JOBS AS J ON JQ.jobid=J._key
> WHERE JQ.STATUS = 2
> ORDER BY JQ.QUEUED ASC
> LIMIT 20
>
> But when I remove the ORDER BY part or the WHERE part from the statement it
> returns in <10ms.
>
> What may I do wrong?
>
> Thanks,
> Thomas.
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Reply via email to