[SERVER-44478] Allow $indexStats access counters to be manually reset Created: 07/Nov/19 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Alex Bevilacqua | Assignee: | Backlog - Query Optimization |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | qopt-team | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query Optimization
|
| Participants: | |
| Case: | (copied to CRM) |
| Description |
|
Index access counters can only be reset by recreating the index or restarting the mongod. Under certain circumstances such as maintenance activities it is desirable to begin measuring anew how indexes are being accessed. Currently this can be accomplished by dropping/recreating the index:
This is undesirable as while the index is being recreated operations that used that index may resort to COLLSCANs instead. An alternate approach of recreating the index with a "dummy" field could be done as well, but this would still incur the cost of building a new index. If resetting counters is needed, a new command and shell helper (command: resetIndexCounters / collection helper: db.collection.resetIndexCounters(indexName)) could be introduced to handle this functionality. |
| Comments |
| Comment by Taras Mykhailovych [ 29/May/21 ] |
|
> Isn't it incredibly easy just to get the delta of the counter before the index creation and after? |
| Comment by Carl Champain (Inactive) [ 08/Nov/19 ] |
|
Passing this ticket along to the Query team. |
| Comment by Alex Bevilacqua [ 07/Nov/19 ] |
|
That would be the currently recommended method. The goal here is to remove the need for external tracking of changes (though this could technically just be written to a collection within the database for stats ...). |
| Comment by Danny Hatcher (Inactive) [ 07/Nov/19 ] |
|
Isn't it incredibly easy just to get the delta of the counter before the index creation and after? |