Skip to content

Add index to session query #175

@birme

Description

@birme

This query:

const toInactivate = await this.dbManager.getSessionsByQuery({
        isWhip: { $ne: true } as any,
        isExpired: false,
        isActive: true,
        lastSeenAt: { $gte: expiredCutoff, $lt: inactiveCutoff } as any
      });

can be optimized for CouchDb databases by adding index. Following warning is received from CouchDb:

% curl -X POST https://XXXXX:XXXXX@eyevinnlab-intercom.apache-couchdb.auto.prod.osaas.io/intercom/_find \
  -H "Content-Type: application/json" \
  -d '{"selector": {"isExpired": false, "isActive": true}, "limit": 10}'
{
...,
"warning": "No matching index found, create an index to optimize query time."
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions