Skip to content

Collecting objects at a past date recounts the whole result for every memory check #119

Open

Description

@cldellow

Problem

collect_items_by_timestamp (data/collect_items.h) collects objects at a past date ([date:], and the old side of [diff:]). Every 128K objects or indexes, it checks the memory limit by calling eval_map on its whole result maps. eval_map walks every entry. The scan creates an entry for every index it visits, even one where nothing matches, so on wide scans the maps hold hundreds of thousands of entries, and each check walks all of them.

#86 replaced the same recount in collect_items_range for current data with a running total. The past-date path still recounts.

Profiles on the all-changes branch (#12), Nova Scotia full-history database (see #2), warm cache: eval_map and the tree walk under it take about 16% of this query, and about 20% of [date:"2018-01-01T00:00:00Z"][out:json]; nwr[name]; out center;.

[date:"2018-01-01T00:00:00Z"][out:xml]; rel(42,-67.6,47.5,-58); out body;

Fix

Keep the sizes eval_map would report as running totals, updated per index, as #86 does for current data. The check sees the same values, so the same queries fail.


Generated by Claude Code

Activity

  1. added
    query-perf
    on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    query-perf

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions