Skip to content

Commit 5cd3819

Browse files
committed
Update web.rst
1 parent 460a4c0 commit 5cd3819

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

docs/book/src/usage/web.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,3 +474,44 @@ an error like ``django.db.utils.OperationalError: no such table: auth_user``
474474
may be raised. In order to solve it just execute the ``web/manage.py`` utility with the ``migrate`` option::
475475

476476
$ sudo -u cape poetry run python3 web/manage.py migrate
477+
478+
479+
Slow web/API searches when using MongoDB as backend
480+
---------------------------------------------------
481+
482+
* Check server lack of resources as memory ram, cpu or even slow hard drive.
483+
* Possible issue is the lack of proper indexes.
484+
* List your MongoDB indexes:
485+
486+
.. code-block:: bash
487+
488+
db.analysis.getIndexes()
489+
490+
* Test your query with explaination. Replace with your search patterns:
491+
492+
.. code-block:: bash
493+
494+
db.analysis.find({"target.file.name": "<name>"}).explain("executionStats")
495+
496+
* Pay attention to stage value:
497+
498+
.. code-block:: bash
499+
500+
executionStages: {
501+
stage: 'COLLSCAN', # <--- Full collection scan instead of index usage
502+
503+
If you expect it to search in index, expected output should be like this:
504+
505+
.. code-block:: bash
506+
507+
executionStages: {
508+
stage: 'FETCH',
509+
<stripped>
510+
inputStage: {
511+
stage: 'IXSCAN', # <--- Index usage
512+
513+
* How to delete index
514+
515+
.. code-block:: bash
516+
517+
db.collection.dropIndexes("<index name>")

0 commit comments

Comments
 (0)