Comment on @Hubzilla Support Forum If you are under reliatively fresh MySQL 8 then try

<- View Parent
kostikov@zotum.net@zotum.net ⁨1⁩ ⁨week⁩ ago
@Mario Vavti
Here is how EXPLAIN looked like before the index have been added
hz@localhost [hz]> EXPLAIN ANALYZE
    -> SELECT workerq_id, workerq_cmd FROM workerq
    -> WHERE workerq_reservationid IS NULL
    -> ORDER BY workerq_priority DESC, workerq_id ASC
    -> LIMIT 1 FOR UPDATE SKIP LOCKED;
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| EXPLAIN                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| -> Limit: 1 row(s)  (cost=401951 rows=1) (actual time=37560..37560 rows=1 loops=1)
    -> Sort: workerq.workerq_priority DESC, workerq.workerq_id, limit input to 1 row(s) per chunk  (cost=401951 rows=3.12e+6) (actual time=37560..37560 rows=1 loops=1)
        -> Index lookup on workerq using workerq_reservationid (workerq_reservationid=NULL), with index condition: (workerq.workerq_reservationid is null)  (cost=401951 rows=3.12e+6) (actual time=0.245..34819 rows=6.37e+6 loops=1)
 |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (37.63 sec)

original
Sort:hotnewtop