Skip to content

BE-702: Compile sorted entity reads as keys-first statements#9048

Open
TimDiekmann wants to merge 6 commits into
t/be-641-extend-the-sql-astfrom
t/be-598-investigate-fetch-keys-then-hydrate-projection-for-the
Open

BE-702: Compile sorted entity reads as keys-first statements#9048
TimDiekmann wants to merge 6 commits into
t/be-641-extend-the-sql-astfrom
t/be-598-investigate-fetch-keys-then-hydrate-projection-for-the

Conversation

@TimDiekmann

Copy link
Copy Markdown
Member

🌟 What is the purpose of this PR?

Sorted and limited entity reads now compile as a keys-first statement: a narrow key query carries the filters, cursor, and sort, and the wide projection is hydrated only for the rows that survive the LIMIT. This keeps the planner's ability to serve the ordering from an index while it sorts and spools far narrower rows, and it is the structural groundwork for optimizing the entity read path against known query shapes.

Grounded in the created-at sort incident: the pathological plan was reproduced locally against a 700k-entity seed and the shape trade-offs were measured with result-set-equivalence checks on every variant (see the Slack thread for the discussion).

Stacked on #9033; only the commits of this branch are new.

🔗 Related links

🚫 Blocked by

🔍 What does this change?

  • StatementShape on the SelectCompiler: SinglePass (default, unchanged) | KeysFirst | FencedKeysFirst. The keys-first shapes compile into a key CTE (filters + cursor + sort columns), a page CTE (ORDER BY + LIMIT), and a hydration SELECT with all key-table references rewritten; the fenced variant adds AS MATERIALIZED to shield the key query from the outer ordering demand.
  • Join classification by use (filters/cursor/sort keys, closed transitively over the join conditions) splits the collected joins into the key query's and the hydration's share; the FROM tree is now assembled in compile() from that bookkeeping.
  • Statements that cannot be split degrade to SinglePass with a logged ShapeFallback reason; the effective shape is recorded on the compile span as statement.shape.
  • Pre-order Expression::visit/visit_mut walkers on the AST, used by the classification and reference rewriting.
  • read_entities_impl opts into KeysFirst for sorted entity reads; embedding-distance queries stay on SinglePass (TODO(BE-618)).
  • A note on AsClient for Object documents that bypassing the pool's statement cache keeps every query on a custom plan — the shape strategy relies on parameter-aware planning.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

⚠️ Known issues

  • FencedKeysFirst has no production caller yet; it is exercised by the compile tests and reserved as an escalation shape.
  • Statement texts for sorted entity reads change shape, so pg_stat_statements fingerprints reset for those queries.

🐾 Next steps

  • Distinguish include- from exclude-type filters on the entity read path: inclusion lists are GIN-indexable and estimable, and the entities page can derive them from the type summary it already fetches (see the Slack thread).

🛡 What tests cover this?

  • Golden compile tests for both keys-first shapes: sort keys across joins, cursor continuation inside the key CTE, embedding-distance queries, carried CTEs, and filter-joined tables staying out of the key projection
  • Fallback tests asserting the specific ShapeFallback reason plus byte-equality with the single-pass output
  • The full hash-graph-integration postgres suite (including all sorting/pagination tests) against a migrated database with KeysFirst active
  • Result-set-equivalence checks (row-set fingerprints) of every measured variant against a 700k-entity seed

❓ How to test this?

  1. cargo nextest run --package hash-graph-postgres-store --lib
  2. With a migrated local database: cargo nextest run --package hash-graph-integration --test postgres

📹 Demo

WITH "roots" AS (SELECT "entity_ids_0_1_0"."created_at_transaction_time", "entity_temporal_metadata_0_0_0"."entity_uuid", "entity_temporal_metadata_0_0_0"."entity_edition_id"
FROM "entity_temporal_metadata" AS "entity_temporal_metadata_0_0_0"
INNER JOIN "entity_ids" AS "entity_ids_0_1_0" ON ...
WHERE ...),
"limited" AS (SELECT * FROM "roots" ORDER BY "created_at_transaction_time" ASC LIMIT 500)
SELECT DISTINCT ON("limited"."created_at_transaction_time", ...) ..., "entity_editions_1_1_0"."properties"
FROM "limited"
INNER JOIN "entity_editions" AS "entity_editions_1_1_0" ON "entity_editions_1_1_0"."entity_edition_id" = "limited"."entity_edition_id"
ORDER BY "limited"."created_at_transaction_time" ASC LIMIT 500

@github-actions github-actions Bot added area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team labels Jul 17, 2026
@vercel

vercel Bot commented Jul 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview, Comment Jul 17, 2026 2:29pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview Jul 17, 2026 2:29pm
petrinaut Skipped Skipped Jul 17, 2026 2:29pm

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.06338% with 153 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.37%. Comparing base (6753875) to head (c2b189e).

Files with missing lines Patch % Lines
...rc/store/postgres/query/ast/expression/function.rs 0.00% 72 Missing ⚠️
...ore/src/store/postgres/query/ast/expression/mod.rs 32.97% 63 Missing ⚠️
...gres-store/src/store/postgres/query/compile/mod.rs 95.52% 10 Missing and 8 partials ⚠️
Additional details and impacted files
@@                       Coverage Diff                       @@
##           t/be-641-extend-the-sql-ast    #9048      +/-   ##
===============================================================
+ Coverage                        59.31%   59.37%   +0.06%     
===============================================================
  Files                             1393     1393              
  Lines                           135212   135737     +525     
  Branches                          6183     6205      +22     
===============================================================
+ Hits                             80196    80590     +394     
- Misses                           54086    54212     +126     
- Partials                           930      935       +5     
Flag Coverage Δ
apps.hash-ai-worker-ts 1.92% <ø> (ø)
apps.hash-api 7.59% <ø> (ø)
local.hash-backend-utils 1.88% <ø> (ø)
local.hash-graph-sdk 10.02% <ø> (ø)
local.hash-isomorphic-utils 0.17% <ø> (ø)
rust.hash-graph-api 7.41% <ø> (ø)
rust.hash-graph-postgres-store 27.40% <73.06%> (+1.36%) ⬆️
rust.hashql-compiletest 28.39% <ø> (ø)
rust.hashql-eval 79.82% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vercel
vercel Bot temporarily deployed to Preview – petrinaut July 17, 2026 14:16 Inactive
@TimDiekmann
TimDiekmann marked this pull request as ready for review July 17, 2026 14:16
@cursor

cursor Bot commented Jul 17, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes core entity list SQL shape and pagination semantics if keys-first preconditions are violated; fallbacks mitigate but wrong pages are possible in edge cases. Embedding searches stay on single-pass.

Overview
Sorted, limited entity reads can now compile as a keys-first plan instead of one wide SELECT: narrow roots / limited CTEs apply filters, cursor, sort, and LIMIT, then a hydration SELECT joins back only for the page (optional MATERIALIZED via FencedKeysFirst).

SelectCompiler gains StatementShape, join bookkeeping (CompiledJoin with join type, subquery sources, per-join to_many), classification of key vs hydration joins, KeyColumnRewriter, and safe fallback to SinglePass with logged ShapeFallback reasons; effective shape is traced as statement.shape. Expression AST adds visit / visit_mut for that analysis.

Production: read_entities_impl opts into KeysFirst when there is no embeddings distance filter. Pool: docs note that AsClient for Object deref bypasses statement caching so Postgres can plan with real parameters.

Reviewed by Cursor Bugbot for commit c2b189e. Bugbot is set up for automated code reviews on this repo. Configure here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark results

@rust/hash-graph-benches – Integrations

policy_resolution_large

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2002 $$21.4 \mathrm{ms} \pm 112 \mathrm{μs}\left({\color{gray}-1.476 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.49 \mathrm{ms} \pm 11.1 \mathrm{μs}\left({\color{gray}-0.655 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1002 $$9.74 \mathrm{ms} \pm 68.7 \mathrm{μs}\left({\color{gray}-0.693 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 3314 $$30.6 \mathrm{ms} \pm 212 \mathrm{μs}\left({\color{lightgreen}-5.892 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$9.63 \mathrm{ms} \pm 69.4 \mathrm{μs}\left({\color{gray}-2.567 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 1527 $$17.5 \mathrm{ms} \pm 118 \mathrm{μs}\left({\color{gray}-0.228 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 2078 $$22.3 \mathrm{ms} \pm 148 \mathrm{μs}\left({\color{gray}0.630 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.75 \mathrm{ms} \pm 12.7 \mathrm{μs}\left({\color{gray}-0.118 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 1033 $$10.6 \mathrm{ms} \pm 73.5 \mathrm{μs}\left({\color{gray}0.256 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_medium

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 102 $$2.83 \mathrm{ms} \pm 18.4 \mathrm{μs}\left({\color{gray}-4.007 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.22 \mathrm{ms} \pm 12.0 \mathrm{μs}\left({\color{gray}-0.746 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 52 $$2.51 \mathrm{ms} \pm 15.1 \mathrm{μs}\left({\color{gray}0.690 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 269 $$3.97 \mathrm{ms} \pm 24.4 \mathrm{μs}\left({\color{gray}-0.745 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$2.62 \mathrm{ms} \pm 15.7 \mathrm{μs}\left({\color{gray}-1.444 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 108 $$3.13 \mathrm{ms} \pm 23.0 \mathrm{μs}\left({\color{gray}0.309 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 133 $$3.37 \mathrm{ms} \pm 23.1 \mathrm{μs}\left({\color{gray}-1.305 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.55 \mathrm{ms} \pm 16.9 \mathrm{μs}\left({\color{gray}-0.063 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 63 $$2.98 \mathrm{ms} \pm 14.8 \mathrm{μs}\left({\color{gray}-3.135 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_none

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2 $$1.99 \mathrm{ms} \pm 9.99 \mathrm{μs}\left({\color{gray}-1.295 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.00 \mathrm{ms} \pm 15.3 \mathrm{μs}\left({\color{gray}1.50 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 2 $$2.04 \mathrm{ms} \pm 12.0 \mathrm{μs}\left({\color{gray}0.135 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 8 $$2.24 \mathrm{ms} \pm 12.2 \mathrm{μs}\left({\color{gray}-2.262 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.11 \mathrm{ms} \pm 11.8 \mathrm{μs}\left({\color{gray}0.908 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 3 $$2.33 \mathrm{ms} \pm 21.0 \mathrm{μs}\left({\color{gray}1.82 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_small

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 52 $$2.23 \mathrm{ms} \pm 11.2 \mathrm{μs}\left({\color{lightgreen}-6.951 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.04 \mathrm{ms} \pm 11.8 \mathrm{μs}\left({\color{gray}-3.210 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 26 $$2.14 \mathrm{ms} \pm 12.5 \mathrm{μs}\left({\color{gray}-3.713 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 94 $$2.55 \mathrm{ms} \pm 13.1 \mathrm{μs}\left({\color{lightgreen}-6.319 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$2.24 \mathrm{ms} \pm 12.0 \mathrm{μs}\left({\color{gray}-1.807 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 27 $$2.46 \mathrm{ms} \pm 12.8 \mathrm{μs}\left({\color{gray}-2.011 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 66 $$2.51 \mathrm{ms} \pm 15.8 \mathrm{μs}\left({\color{gray}-4.023 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.22 \mathrm{ms} \pm 11.2 \mathrm{μs}\left({\color{lightgreen}-6.877 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 29 $$2.44 \mathrm{ms} \pm 13.9 \mathrm{μs}\left({\color{gray}-4.653 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_complete

Function Value Mean Flame graphs
entity_by_id;one_depth 1 entities $$25.5 \mathrm{ms} \pm 130 \mathrm{μs}\left({\color{lightgreen}-5.412 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 10 entities $$55.7 \mathrm{ms} \pm 319 \mathrm{μs}\left({\color{gray}-2.485 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 25 entities $$27.7 \mathrm{ms} \pm 135 \mathrm{μs}\left({\color{gray}-2.317 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 5 entities $$31.7 \mathrm{ms} \pm 154 \mathrm{μs}\left({\color{gray}-3.590 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 50 entities $$32.8 \mathrm{ms} \pm 189 \mathrm{μs}\left({\color{gray}-1.357 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 1 entities $$28.0 \mathrm{ms} \pm 152 \mathrm{μs}\left({\color{gray}0.893 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 10 entities $$340 \mathrm{ms} \pm 827 \mathrm{μs}\left({\color{gray}-1.161 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 25 entities $$71.4 \mathrm{ms} \pm 466 \mathrm{μs}\left({\color{gray}-1.910 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 5 entities $$69.1 \mathrm{ms} \pm 387 \mathrm{μs}\left({\color{gray}-1.880 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 50 entities $$231 \mathrm{ms} \pm 1.26 \mathrm{ms}\left({\color{red}6.68 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 1 entities $$8.80 \mathrm{ms} \pm 49.5 \mathrm{μs}\left({\color{gray}1.18 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 10 entities $$8.73 \mathrm{ms} \pm 46.5 \mathrm{μs}\left({\color{gray}-0.711 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 25 entities $$8.83 \mathrm{ms} \pm 41.6 \mathrm{μs}\left({\color{gray}0.870 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 5 entities $$8.81 \mathrm{ms} \pm 41.4 \mathrm{μs}\left({\color{gray}-2.104 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 50 entities $$8.81 \mathrm{ms} \pm 45.1 \mathrm{μs}\left({\color{gray}-0.746 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$8.69 \mathrm{ms} \pm 52.2 \mathrm{μs}\left({\color{gray}0.860 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$8.75 \mathrm{ms} \pm 45.1 \mathrm{μs}\left({\color{gray}2.13 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$8.68 \mathrm{ms} \pm 54.9 \mathrm{μs}\left({\color{gray}0.535 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$8.81 \mathrm{ms} \pm 40.7 \mathrm{μs}\left({\color{gray}0.553 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$8.98 \mathrm{ms} \pm 48.4 \mathrm{μs}\left({\color{gray}0.125 \mathrm{\%}}\right) $$ Flame Graph

representative_read_entity

Function Value Mean Flame graphs
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/block/v/1 $$9.09 \mathrm{ms} \pm 60.3 \mathrm{μs}\left({\color{gray}0.316 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$9.12 \mathrm{ms} \pm 42.7 \mathrm{μs}\left({\color{gray}0.840 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$8.96 \mathrm{ms} \pm 48.5 \mathrm{μs}\left({\color{gray}-1.012 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$9.09 \mathrm{ms} \pm 57.1 \mathrm{μs}\left({\color{gray}1.93 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$9.19 \mathrm{ms} \pm 51.7 \mathrm{μs}\left({\color{gray}3.16 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$9.15 \mathrm{ms} \pm 47.4 \mathrm{μs}\left({\color{gray}2.18 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$8.96 \mathrm{ms} \pm 50.0 \mathrm{μs}\left({\color{gray}0.480 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$9.16 \mathrm{ms} \pm 52.0 \mathrm{μs}\left({\color{gray}0.581 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$9.10 \mathrm{ms} \pm 58.1 \mathrm{μs}\left({\color{gray}0.281 \mathrm{\%}}\right) $$ Flame Graph

representative_read_entity_type

Function Value Mean Flame graphs
get_entity_type_by_id Account ID: bf5a9ef5-dc3b-43cf-a291-6210c0321eba $$6.52 \mathrm{ms} \pm 30.9 \mathrm{μs}\left({\color{gray}1.32 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property traversal_paths=0 0 $$48.6 \mathrm{ms} \pm 271 \mathrm{μs}\left({\color{gray}-1.880 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$93.9 \mathrm{ms} \pm 445 \mathrm{μs}\left({\color{gray}0.653 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$54.2 \mathrm{ms} \pm 330 \mathrm{μs}\left({\color{lightgreen}-5.251 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$62.5 \mathrm{ms} \pm 381 \mathrm{μs}\left({\color{gray}-3.262 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$71.1 \mathrm{ms} \pm 400 \mathrm{μs}\left({\color{gray}-2.294 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$77.2 \mathrm{ms} \pm 397 \mathrm{μs}\left({\color{gray}1.93 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=0 0 $$38.6 \mathrm{ms} \pm 214 \mathrm{μs}\left({\color{gray}1.30 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$58.3 \mathrm{ms} \pm 311 \mathrm{μs}\left({\color{gray}0.108 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$42.8 \mathrm{ms} \pm 254 \mathrm{μs}\left({\color{gray}0.724 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$50.7 \mathrm{ms} \pm 413 \mathrm{μs}\left({\color{gray}4.09 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$50.7 \mathrm{ms} \pm 277 \mathrm{μs}\left({\color{gray}1.09 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$50.2 \mathrm{ms} \pm 338 \mathrm{μs}\left({\color{gray}0.241 \mathrm{\%}}\right) $$

scenarios

Function Value Mean Flame graphs
full_test query-limited $$89.2 \mathrm{ms} \pm 481 \mathrm{μs}\left({\color{lightgreen}-8.995 \mathrm{\%}}\right) $$ Flame Graph
full_test query-unlimited $$99.3 \mathrm{ms} \pm 514 \mathrm{μs}\left({\color{lightgreen}-6.877 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-limited $$18.2 \mathrm{ms} \pm 94.2 \mathrm{μs}\left({\color{gray}-4.182 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-unlimited $$417 \mathrm{ms} \pm 1.01 \mathrm{ms}\left({\color{gray}-2.128 \mathrm{\%}}\right) $$ Flame Graph

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

Labels

area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team

Development

Successfully merging this pull request may close these issues.

2 participants