Set Index Priority Operation
-
In RavenDB, each index has its own dedicated thread for all indexing work.
By default, RavenDB prioritizes processing requests over indexing,
so indexing threads start with a lower priority than request-processing threads. -
Use
SetIndexesPriorityOperation
to raise or lower the index thread priority. -
Indexes scope:
Index priority can be set for both static and auto indexes. -
Nodes scope:
The priority will be updated on all nodes in the database group. -
Setting the priority can also be done from the indexes list view in the Studio.
-
In this page:
Index priority
Setting the priority will affect the indexing thread priority at the operating system level:
Priority value | Indexing thread priority at OS level |
|
---|---|---|
LOW | Lowest |
|
NORMAL (default) | Below normal |
|
HIGH | Normal |
|
Set priority - single index
# Define the set priority operation
# Pass index name & priority
set_priority_op = SetIndexesPriorityOperation(IndexPriority.HIGH, "Orders/Totals")
# Execute the operation by passing it to maintenance.send
# An exception will be thrown if index does not exist
store.maintenance.send(set_priority_op)
Set priority - multiple indexes
# Define the set priority operation, pass multiple index names
set_priority_op = SetIndexesPriorityOperation(IndexPriority.LOW, "Orders/Totals", "Orders/ByCompany")
# Execute the operation by passing it to maintenance.send
# An exception will be thrown if any of the specified indexes do not exist
store.maintenance.send(set_priority_op)
Syntax
class SetIndexesPriorityOperation(VoidMaintenanceOperation):
def __init__(self, priority: IndexPriority, *index_names: str): ...
Parameters | ||
---|---|---|
*index_names | str |
Index name for which to change priority |
priority | IndexingPriority |
Priority to set |
class IndexPriority(Enum):
LOW = "Low"
NORMAL = "Normal"
HIGH = "High"