Skip to content

Slow query when updating a lot of path tokens #316

Description

@vnugent

When working on PR #314 my laptop CPUs peaked for about 1 minute when updating a large tree.

Steps to reproduce:

  1. Rename a US state
  2. Watch mongo log (docker logs -f <mongo container id>)

While the update will take around 2-3s, I think the change history code causes CPUs to peak and fan running at high speed for about 1 minute.

async record (changeRecord: BaseChangeRecordType): Promise<this> {

mongo complains about Slow query

{"t":{"$date":"2023-06-14T04:55:16.739+00:00"},"s":"I",  "c":"COMMAND",  "id":51803,   "ctx":"conn1744","msg":"Slow query","attr":{"type":"command","ns":"openbeta.$cmd","command":{"update":"change_logs","updates":[{"q":{"_id":{"$oid":"64894824fd36d9b6032697e2"}},"u":{"$setOnInsert":{"createdAt":{"$date":"2023-06-14T04:55:05.320Z"}},"$push":{"changes":{"$each":[{"_id":{"_data":"8264894828000000012B022C01002C01EC6E5A1004A1760F9BEFF84607B0673B9FB1CC630946645F696400646467AA00E622317BDB3C18AE0004"},"dbOp":"update","fullDocument":{"_id":{"$oid":"6467aa00e622317bdb3c18ae"},"area_name":"Átya tpísh (North face)","shortCode":"","climbs":[{"$uuid":"5db94c91-4482-529a-a113-30c2d969a9d6"},{"$uuid":"34f74ebd-3d80-5a5e-b571-532d173526a6"},{"$uuid":"5ecc5de6-c6d9-57c6-870a-348bc80f14ee"},

...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions