Created-order listing reads a whole same-timestamp group per page

Aberta
#16 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
38/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
javascript
Domínio
database, performance

Direção de pesquisa

Start by tracing the GET /Memory/ created-order listing and its cursor handling for after=<createdAt>,<id>; the issue does not name the source file or tests. Reproduce the measured case with a large group of identical createdAt values and a page limit of 50, then check row reads across pages. Done means paging through a group no longer reads the entire group on each page while preserving the documented createdAt, then id ordering.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

GET /Memory/?order=created&after=<createdAt>,<id> sorts by createdAt, then id. Harper's index gives the createdAt order, then sorts each group of rows sharing one createdAt by id after reading the whole group. A page that lands inside such a group therefore reads all of it. Walking a group of T rows costs about T²/limit row reads.

Measured on Harper 5.3 (one node, local): a 2,000-row group cost 27 ms on its worst page at limit 50. Import gives one shared now to each batch of up to 100 rows sent without createdAt, so groups larger than that need source data with coarse or repeated timestamps.

Options if it matters: rely on the [value, primaryKey] order of Harper's secondary index and drop the id post-sort when the createdAt index drives the scan, or ask Harper core for a composite continuation (start a range scan at [t, id]).

Found in the pre-push review of the supersession backfill change (branch feat/supersession-backfill).

Review-Deferral: 65e3d9d0468f865d severity=nit category=performance

🤖 Generated by Anthropic Claude (Opus 5.5) via Claude Code; posted via @kriszyp.

Linguagem predominante
JavaScript
Estrelas
0
Forks
0
Merge médio
20h 29min
PRs com merge (30d)
28

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de HarperFast/agent-memory

Todas as issues de HarperFast/agent-memory

Issues semelhantes

Mais issues de JavaScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.