File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -474,3 +474,44 @@ an error like ``django.db.utils.OperationalError: no such table: auth_user``
474474may 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>" )
You can’t perform that action at this time.
0 commit comments