Skip to content
This repository was archived by the owner on Nov 21, 2026. It is now read-only.

bindings docs: ordered reads, project the sort property under its own name, and take the first value past a bound with ORDER BY ... LIMIT 1 (26.10.1, upstream #8811, #8812) - #43

Merged
tae898 merged 2 commits into
mainfrom
docs/sql-order-by-projection
Oct 1, 2026
Merged

tae898 merged 2 commits into
mainfrom
docs/sql-order-by-projection

Conversation

@tae898

@tae898 tae898 commented Oct 1, 2026 •

Copy link
Copy Markdown

Closes #42.

The queries guide's 'Ordered reads over an optional property' paragraph gains two conditions, both measured on upstream main 3d5e1a5, 1,000,000 records, Temurin 25 and 21, every answer checked against a query no index serves:

  1. In 26.10.1 SQL serves ORDER BY p LIMIT k from an index on p only when the query projects p under its own name, or the whole record. SELECT title ... ORDER BY createdAt and SELECT createdAt AS t ... ORDER BY t scan and sort: 642-806 ms against 0.4-0.9 ms; openCypher reads the index in every spelling. Upstream: SQL ORDER BY ... LIMIT stops reading the index in order when the sort property is aliased or not projected: SELECT b FROM V ORDER BY a LIMIT 5 scans 1M records (758 ms) where SELECT a ... takes 0.9 ms ArcadeData/arcadedb#8811.
  2. For the first or last value past a bound, ORDER BY ts LIMIT 1 reads one index entry (0.2-0.5 ms), while min(ts) ... WHERE ts > ? reads the whole range (136-145 ms in SQL, about 800 ms in openCypher). Upstream: min()/max() of an indexed property under a range on it read the whole range: SELECT min(a) FROM V WHERE a > ? takes 145 ms (openCypher 795 ms) where ORDER BY a LIMIT 1 takes 0.2-0.5 ms ArcadeData/arcadedb#8812.

No example or harness query uses either slow spelling (checked by a scan of every SQL ORDER BY in bindings/python and benchmarks/experiments, and a grep for ranged min/max).

🤖 Generated with Claude Code

https://claude.ai/code/session_01WWcDr7TwvcfMsQkeYQVHZr

tae898 and others added 2 commits October 1, 2026 19:38
…y is projected under its own name (26.10.1, upstream ArcadeData#8811) (#42)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WWcDr7TwvcfMsQkeYQVHZr
…T 1, not a ranged min()/max() (26.10.1, upstream ArcadeData#8812) (#42)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WWcDr7TwvcfMsQkeYQVHZr
@tae898 tae898 changed the title bindings docs: SQL reads an index in order only when the sort property is projected under its own name (26.10.1, upstream #8811) bindings docs: ordered reads, project the sort property under its own name, and take the first value past a bound with ORDER BY ... LIMIT 1 (26.10.1, upstream #8811, #8812) Oct 1, 2026
@tae898
tae898 merged commit 43d6c80 into main Oct 1, 2026
48 checks passed
@tae898
tae898 deleted the docs/sql-order-by-projection branch October 1, 2026 11:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bindings docs: ordered reads in 26.10.1, a projected sort key and ORDER BY ... LIMIT 1 for a bound (upstream #8811, #8812)

1 participant