yii2-queue
yii2-queue copied to clipboard
Make reserve faster on DbQueue
| Q | A |
|---|---|
| Is bugfix? | yes |
| New feature? | no |
| Breaks BC? | no |
| Tests pass? | yes |
| Fixed issues | #280 |
Mkay, this does not fix it... it makes it better, but ultimately it is still slow
Because of ORDER BY clause, it does not use index for some reason even if I add all fields that are used in ORDER BY or WHERE clause.. but I found out that when I change LIMIT 1 to LIMIT 100 it is fast for some bizarre reason(I literally have no idea why it does that)...
so, should I remove this LIMIT 1 and replace it with LIMIT 100 and rely on the fact that one()
That's super-weird. How could it be that selecting 1 record is slower than selecting 100 records?
@samdark my findings there even were wrong. I am still trying to figure out how to make it so that it starts using indexes

It won't use index since it doesn't make sense to use index on two rows. Even full table scan will be faster.
Make it 5000 rows and check again.
That is not the case..
If I remove order by clause then it is fast

I played with this some time ago and I've got much better performance with separate query for each priority (I have 3 priorities, so it was not a big deal) than one query with ORDER BY priority.
@rob006 unfortunately yii2-queue supports more than 3 priorities... I would like to fix it once and for all, just as it should be fixed
unfortunately yii2-queue supports more than 3 priorities...
That depends on driver. Some of them support more priorities, some of them does not support priorities at all. There is no standard here.