Skip to content

BE-597: Array-based type filtering in the SelectCompiler#8866

Open
TimDiekmann wants to merge 2 commits into
t/be-599-compute-the-entity-summary-aggregations-in-sql-instead-offrom
t/be-597-array-based-type-filtering-in-selectcompiler
Open

BE-597: Array-based type filtering in the SelectCompiler#8866
TimDiekmann wants to merge 2 commits into
t/be-599-compute-the-entity-summary-aggregations-in-sql-instead-offrom
t/be-597-array-based-type-filtering-in-selectcompiler

Conversation

@TimDiekmann

@TimDiekmann TimDiekmann commented Jun 12, 2026

Copy link
Copy Markdown
Member

🌟 What is the purpose of this PR?

Type filters (type.versionedUrl / type.baseUrl without an inheritance depth) compiled to one entity_is_of_type → ontology_temporal_metadata → ontology_ids join chain per predicate. On the trace that started this investigation (7 type exclusions), that meant 7 multiplying join groups, a planner misestimate, and a row-explosion the query had to DISTINCT away again.

This PR compiles those filters to array predicates (@> / &&) on the entity_edition_cache type arrays (from #8854) instead. Equality filters in the same All/Any group bundle into a single predicate over one parameter array, which the GIN index on the cache columns can serve.

🔗 Related links

🚫 Blocked by

🔍 What does this change?

  • BinaryOperator::ArrayContains (@>) in the expression AST; && (overlap) already existed.
  • Path mapping (query/entity.rs): EntityTypeEdge { IsOfType, BaseUrl | VersionedUrl, inheritance_depth: None } resolves directly to the entity_edition_cache array columns. Explicit inheritance depths keep the join chain (the cache arrays are all-depth).
  • The redundant EntityQueryPath::TypeBaseUrls / TypeVersionedUrls variants are deleted; the edge form is the single canonical path (they were documented as not queryable from the API, so no public surface changes).
  • Compiler rewrite (query/compile.rs), type-driven via the column's declared ParameterType rather than hardcoded paths:
    • Equal/NotEqual/In(parameter, path) on text-array columns compile to containment predicates.
    • All/Any groups bundle same-column equality filters: All+equals → @>, Any+equals → &&, All+notEquals → NOT(&&), Any+notEquals → NOT(@>) — each an exact logical equivalent of the unbundled forms.
    • Bundles are keyed on the aliased column, so an entity's own type and a linked entity's type (same column, different join chain) stay separate predicates.
    • StartsWith/EndsWith/ContainsSegment on array-backed paths fail at compile time (UnsupportedTextArrayOperation) instead of producing a Postgres type error.
  • Filter::for_entity_by_type_id builds a single versionedUrl equality instead of All[baseUrl, version] (the old shape was only correct through shared join aliases). All IsOfType/IsOfBaseType policy filters now go through the array path.
  • The property-protection filters (In(param, type base URLs)) compile to base_urls @> ARRAY[$n] instead of $n = ANY(base_urls) — semantically equivalent, but GIN-indexable.

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

  • Intentional behaviour change: notEqual on type paths now uses set semantics — "the entity has no such type" — instead of the old per-join-row semantics, under which a multi-typed entity matched notEqual(A) as long as it had any other type. The old behaviour made type exclusions effectively useless for multi-typed entities (an entity with types {notification, X} stayed visible despite a notEqual(notification) filter); the new behaviour is what the filters are meant to express. The same set semantics applies to separate baseUrl/version equality filters within one all block.
  • Nested paths through link edges (leftEntity.type.versionedUrl etc.) intentionally keep the join chain for the link traversal; only the terminal type lookup uses the cache.

🐾 Next steps

  • BE-598: keys-then-hydrate split (the remaining cost is the label-sort scan, not the type predicates).
  • Integration test pinning the notEqual exclusion semantics on a multi-typed entity.
  • Filter normalization pass (flattening nested All/Any, sibling dedup) to widen bundling across artificial nesting and improve planner estimates — separate ticket.

🛡 What tests cover this?

  • New compiler snapshot tests in statement/select.rs: single equality (constructor + raw filter forms), Any/All bundling, bundled NOT(&&) exclusion, base-URL policy form, and the own-type vs. linked-type alias-separation regression test.
  • Updated property-masking snapshot (= ANY@>).
  • email_filter_protection.rs integration tests cover the rewritten protection-filter path in CI.
  • Manually validated against an 8.8M-entity dataset: counts and all summary maps byte-identical to the join-based compilation.

❓ How to test this?

  1. Checkout the branch, start the graph with a seeded database.
  2. Run a queryEntities request with type filters (equal/notEqual on ["type", "versionedUrl"], with and without an any/all group).
  3. Confirm the compiled SQL (debug logs) contains entity_edition_cache array predicates instead of entity_is_of_type joins, and results match the base branch — except multi-typed entities under notEqual, which are now correctly excluded.

Copilot AI review requested due to automatic review settings June 12, 2026 17:13
@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

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

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
hash Ignored Ignored Preview Jun 12, 2026 6:54pm
hashdotdesign-tokens Ignored Ignored Preview Jun 12, 2026 6:54pm
petrinaut Skipped Skipped Jun 12, 2026 6:54pm

@cursor

cursor Bot commented Jun 12, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes core query compilation and filter semantics for type exclusions on multi-typed entities; behavior is intentional but can alter production query results versus the join-based compiler.

Overview
Entity type filters now hit entity_edition_cache array columns instead of one entity_is_of_type join chain per predicate. The Postgres SelectCompiler recognizes equality/In on materialized text[] type paths and emits @> / && (and negated forms), with All/Any bundling multiple type equalities into a single array predicate so GIN indexes can be used.

EntityQueryPath::TypeBaseUrls / TypeVersionedUrls are removed in favor of EntityTypeEdge { IsOfType, BaseUrl | VersionedUrl, inheritance_depth: None } for selections, summaries, and property protection. Filter::for_entity_by_type_id is a single versionedUrl equality instead of All[baseUrl, version].

notEqual on type paths uses set semantics (entity has no matching type in the array), which fixes multi-typed entities under exclusions. String ops on array-backed paths fail at compile time with UnsupportedTextArrayOperation. Tests add SQL snapshot coverage; friendship integration filter switches from startsWith on type.baseUrl to equal.

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

@github-actions github-actions Bot added area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team area/tests New or updated tests labels Jun 12, 2026

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.

Pull request overview

This PR optimizes entity type filtering in the Postgres SelectCompiler by compiling type predicates into GIN-indexable array operations over entity_edition_cache (instead of generating one type-join chain per predicate), reducing join multiplication and planner misestimates.

Changes:

  • Introduces an ArrayContains (@>) binary operator and compiles eligible type/base-url filters into @> / && predicates (with bundling inside All/Any groups).
  • Updates query-path resolution so EntityTypeEdge { IsOfType, BaseUrl|VersionedUrl, inheritance_depth: None } maps directly to entity_edition_cache type arrays; removes redundant TypeBaseUrls/TypeVersionedUrls paths.
  • Adds/updates snapshot & integration coverage to pin the new compilation output and alias-separation behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/graph/integration/postgres/email_filter_protection.rs Updates protection-filter paths to the canonical EntityTypeEdge form (depth None) used by array-backed compilation.
libs/@local/graph/store/src/filter/protection.rs Switches protection config/type-path usage to EntityTypeEdge and removes references to deleted Type*Urls paths.
libs/@local/graph/store/src/filter/mod.rs Rewrites for_entity_by_type_id to a single versionedUrl equality filter suited to array-backed compilation.
libs/@local/graph/store/src/entity/query.rs Removes TypeBaseUrls/TypeVersionedUrls query paths and updates docs for DirectTypeCount semantics with EntityTypeEdge.
libs/@local/graph/postgres-store/src/store/postgres/query/statement/select.rs Adds snapshot tests covering single predicates, All/Any bundling, negated bundling, and alias-separation regression cases.
libs/@local/graph/postgres-store/src/store/postgres/query/expression/conditional.rs Adds Expression::array_contains helper constructing BinaryOperator::ArrayContains.
libs/@local/graph/postgres-store/src/store/postgres/query/expression/binary.rs Adds BinaryOperator::ArrayContains and transpilation support (@>).
libs/@local/graph/postgres-store/src/store/postgres/query/entity.rs Maps EntityTypeEdge (IsOfType + BaseUrl/VersionedUrl + no depth) to entity_edition_cache relations/columns.
libs/@local/graph/postgres-store/src/store/postgres/query/compile.rs Implements text-array predicate compilation and All/Any bundling; rejects string ops on array-backed paths at compile time.
libs/@local/graph/postgres-store/src/store/postgres/knowledge/entity/summary.rs Updates summary selection to use EntityTypeEdge(...VersionedUrl, depth None) for type IDs/titles plumbing.
libs/@local/graph/postgres-store/src/store/postgres/knowledge/entity/query.rs Updates entity record selection to use the new canonical type path (EntityTypeEdge to cached versioned_urls).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vercel vercel Bot temporarily deployed to Preview – petrinaut June 12, 2026 18:54 Inactive
@github-actions github-actions Bot added the area/tests > integration New or updated integration tests label Jun 12, 2026
@TimDiekmann TimDiekmann requested a review from a team June 12, 2026 19:17
@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 $$27.2 \mathrm{ms} \pm 207 \mathrm{μs}\left({\color{gray}-1.757 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.53 \mathrm{ms} \pm 24.7 \mathrm{μs}\left({\color{gray}3.54 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1001 $$12.2 \mathrm{ms} \pm 101 \mathrm{μs}\left({\color{gray}-1.712 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 3314 $$42.7 \mathrm{ms} \pm 479 \mathrm{μs}\left({\color{gray}-2.277 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$14.9 \mathrm{ms} \pm 135 \mathrm{μs}\left({\color{gray}2.40 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 1526 $$23.7 \mathrm{ms} \pm 245 \mathrm{μs}\left({\color{gray}-3.304 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 2078 $$27.9 \mathrm{ms} \pm 215 \mathrm{μs}\left({\color{gray}-1.907 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.80 \mathrm{ms} \pm 24.5 \mathrm{μs}\left({\color{gray}2.04 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 1033 $$13.6 \mathrm{ms} \pm 131 \mathrm{μs}\left({\color{gray}0.658 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_medium

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 102 $$3.99 \mathrm{ms} \pm 36.0 \mathrm{μs}\left({\color{gray}2.56 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.22 \mathrm{ms} \pm 35.6 \mathrm{μs}\left({\color{red}6.69 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 51 $$3.54 \mathrm{ms} \pm 28.4 \mathrm{μs}\left({\color{gray}4.71 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 269 $$5.35 \mathrm{ms} \pm 45.7 \mathrm{μs}\left({\color{gray}3.59 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$3.51 \mathrm{ms} \pm 22.5 \mathrm{μs}\left({\color{gray}-1.331 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 107 $$4.09 \mathrm{ms} \pm 23.3 \mathrm{μs}\left({\color{gray}-2.287 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 133 $$4.50 \mathrm{ms} \pm 33.8 \mathrm{μs}\left({\color{gray}-0.121 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.64 \mathrm{ms} \pm 26.8 \mathrm{μs}\left({\color{gray}4.45 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 63 $$4.13 \mathrm{ms} \pm 30.7 \mathrm{μs}\left({\color{gray}-0.795 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_none

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2 $$2.73 \mathrm{ms} \pm 22.8 \mathrm{μs}\left({\color{gray}2.32 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.74 \mathrm{ms} \pm 26.0 \mathrm{μs}\left({\color{red}8.44 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1 $$2.75 \mathrm{ms} \pm 21.1 \mathrm{μs}\left({\color{red}5.35 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 8 $$3.08 \mathrm{ms} \pm 29.0 \mathrm{μs}\left({\color{red}8.16 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.78 \mathrm{ms} \pm 19.1 \mathrm{μs}\left({\color{gray}2.40 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 3 $$2.89 \mathrm{ms} \pm 22.8 \mathrm{μs}\left({\color{gray}0.974 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_small

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 52 $$3.03 \mathrm{ms} \pm 21.7 \mathrm{μs}\left({\color{gray}-1.940 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.72 \mathrm{ms} \pm 16.8 \mathrm{μs}\left({\color{gray}-2.503 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 25 $$2.96 \mathrm{ms} \pm 15.1 \mathrm{μs}\left({\color{gray}-1.631 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 94 $$3.41 \mathrm{ms} \pm 20.5 \mathrm{μs}\left({\color{gray}-1.223 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$2.95 \mathrm{ms} \pm 29.7 \mathrm{μs}\left({\color{gray}-0.829 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 26 $$3.25 \mathrm{ms} \pm 19.3 \mathrm{μs}\left({\color{gray}-1.801 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 66 $$3.32 \mathrm{ms} \pm 19.6 \mathrm{μs}\left({\color{gray}-2.035 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.90 \mathrm{ms} \pm 14.8 \mathrm{μs}\left({\color{gray}-1.372 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 29 $$3.39 \mathrm{ms} \pm 30.0 \mathrm{μs}\left({\color{gray}0.650 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_complete

Function Value Mean Flame graphs
entity_by_id;one_depth 1 entities $$42.0 \mathrm{ms} \pm 301 \mathrm{μs}\left({\color{lightgreen}-29.851 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 10 entities $$32.4 \mathrm{ms} \pm 305 \mathrm{μs}\left({\color{lightgreen}-35.930 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 25 entities $$34.9 \mathrm{ms} \pm 182 \mathrm{μs}\left({\color{lightgreen}-34.964 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 5 entities $$31.1 \mathrm{ms} \pm 173 \mathrm{μs}\left({\color{lightgreen}-36.863 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 50 entities $$40.4 \mathrm{ms} \pm 230 \mathrm{μs}\left({\color{lightgreen}-37.645 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 1 entities $$48.6 \mathrm{ms} \pm 265 \mathrm{μs}\left({\color{lightgreen}-26.983 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 10 entities $$39.3 \mathrm{ms} \pm 201 \mathrm{μs}\left({\color{lightgreen}-31.543 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 25 entities $$91.7 \mathrm{ms} \pm 559 \mathrm{μs}\left({\color{lightgreen}-14.828 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 5 entities $$33.0 \mathrm{ms} \pm 226 \mathrm{μs}\left({\color{lightgreen}-38.081 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 50 entities $$280 \mathrm{ms} \pm 1.00 \mathrm{ms}\left({\color{lightgreen}-7.139 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 1 entities $$10.6 \mathrm{ms} \pm 70.6 \mathrm{μs}\left({\color{lightgreen}-51.089 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 10 entities $$10.5 \mathrm{ms} \pm 71.9 \mathrm{μs}\left({\color{lightgreen}-54.135 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 25 entities $$10.6 \mathrm{ms} \pm 68.8 \mathrm{μs}\left({\color{lightgreen}-53.165 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 5 entities $$10.4 \mathrm{ms} \pm 61.8 \mathrm{μs}\left({\color{lightgreen}-53.302 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 50 entities $$10.5 \mathrm{ms} \pm 72.2 \mathrm{μs}\left({\color{lightgreen}-61.683 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$10.4 \mathrm{ms} \pm 56.0 \mathrm{μs}\left({\color{lightgreen}-52.838 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$10.6 \mathrm{ms} \pm 66.7 \mathrm{μs}\left({\color{lightgreen}-51.672 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$10.5 \mathrm{ms} \pm 59.9 \mathrm{μs}\left({\color{lightgreen}-52.238 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$10.4 \mathrm{ms} \pm 60.6 \mathrm{μs}\left({\color{lightgreen}-51.909 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$10.6 \mathrm{ms} \pm 62.8 \mathrm{μs}\left({\color{lightgreen}-54.320 \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 $$11.0 \mathrm{ms} \pm 71.8 \mathrm{μs}\left({\color{lightgreen}-59.286 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$10.8 \mathrm{ms} \pm 55.4 \mathrm{μs}\left({\color{lightgreen}-56.752 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$10.8 \mathrm{ms} \pm 80.6 \mathrm{μs}\left({\color{lightgreen}-57.250 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$10.8 \mathrm{ms} \pm 67.4 \mathrm{μs}\left({\color{lightgreen}-56.502 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$10.8 \mathrm{ms} \pm 65.1 \mathrm{μs}\left({\color{lightgreen}-56.592 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$10.8 \mathrm{ms} \pm 60.7 \mathrm{μs}\left({\color{lightgreen}-57.466 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$11.1 \mathrm{ms} \pm 92.0 \mathrm{μs}\left({\color{lightgreen}-55.474 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$10.8 \mathrm{ms} \pm 57.8 \mathrm{μs}\left({\color{lightgreen}-57.977 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$10.8 \mathrm{ms} \pm 67.2 \mathrm{μs}\left({\color{lightgreen}-60.322 \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 $$8.65 \mathrm{ms} \pm 68.5 \mathrm{μs}\left({\color{gray}-1.992 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property traversal_paths=0 0 $$57.9 \mathrm{ms} \pm 395 \mathrm{μs}\left({\color{lightgreen}-8.961 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$109 \mathrm{ms} \pm 610 \mathrm{μs}\left({\color{lightgreen}-7.480 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$62.9 \mathrm{ms} \pm 417 \mathrm{μs}\left({\color{lightgreen}-10.047 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$73.1 \mathrm{ms} \pm 541 \mathrm{μs}\left({\color{lightgreen}-9.124 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$81.6 \mathrm{ms} \pm 501 \mathrm{μs}\left({\color{lightgreen}-11.186 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$88.6 \mathrm{ms} \pm 601 \mathrm{μs}\left({\color{lightgreen}-7.248 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=0 0 $$43.1 \mathrm{ms} \pm 272 \mathrm{μs}\left({\color{lightgreen}-47.422 \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 $$72.5 \mathrm{ms} \pm 429 \mathrm{μs}\left({\color{lightgreen}-35.119 \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 $$49.8 \mathrm{ms} \pm 297 \mathrm{μs}\left({\color{lightgreen}-45.140 \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 $$60.0 \mathrm{ms} \pm 523 \mathrm{μs}\left({\color{lightgreen}-39.114 \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 $$61.6 \mathrm{ms} \pm 397 \mathrm{μs}\left({\color{lightgreen}-38.330 \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 $$61.7 \mathrm{ms} \pm 426 \mathrm{μs}\left({\color{lightgreen}-37.960 \mathrm{\%}}\right) $$

scenarios

Function Value Mean Flame graphs
full_test query-limited $$118 \mathrm{ms} \pm 702 \mathrm{μs}\left({\color{lightgreen}-16.011 \mathrm{\%}}\right) $$ Flame Graph
full_test query-unlimited $$129 \mathrm{ms} \pm 692 \mathrm{μs}\left({\color{lightgreen}-14.286 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-limited $$23.6 \mathrm{ms} \pm 191 \mathrm{μs}\left({\color{lightgreen}-45.578 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-unlimited $$548 \mathrm{ms} \pm 1.42 \mathrm{ms}\left({\color{gray}-2.750 \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) area/tests > integration New or updated integration tests area/tests New or updated tests type/eng > backend Owned by the @backend team

Development

Successfully merging this pull request may close these issues.

2 participants