Skip to content

Order async indexes by asc attempts, id

Max Orefice requested to merge morefice/order-async-index-by-priority into master

Ref: #495697 (closed)

What does this MR do and why?

This MR orders PostgresAsyncIndex by ascending attempts and ids.

This will allow indexes scheduled to be created/removed without any failures to get pick up first in the queue and prevent this kind of behavior.

Query plans

Before After
Index creation Index creation
Index destruction Index destruction

This should be fine as we have < 10 records in the queue.

gitlabhq_dblab=# select count(*) from postgres_async_indexes;
 count
-------
     7
(1 row)
Edited by Max Orefice

Merge request reports

Loading