Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H-3702: Add edition ID index on entity table #6086

Merged
merged 1 commit into from
Jan 8, 2025

Conversation

TimDiekmann
Copy link
Member

🌟 What is the purpose of this PR?

In normal entity queries the index often helps performance. See the relevant slack thread (internal).

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

Copy link
Contributor

github-actions bot commented Jan 7, 2025

Benchmark results

@rust/hash-graph-benches – Integrations

representative_read_entity

Function Value Mean Flame graphs
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$15.6 \mathrm{ms} \pm 221 \mathrm{μs}\left({\color{lightgreen}-30.827 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$16.2 \mathrm{ms} \pm 172 \mathrm{μs}\left({\color{gray}0.186 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$16.9 \mathrm{ms} \pm 216 \mathrm{μs}\left({\color{red}5.55 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$16.4 \mathrm{ms} \pm 167 \mathrm{μs}\left({\color{gray}-0.082 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$15.9 \mathrm{ms} \pm 152 \mathrm{μs}\left({\color{lightgreen}-5.442 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$16.2 \mathrm{ms} \pm 167 \mathrm{μs}\left({\color{gray}-0.116 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$16.5 \mathrm{ms} \pm 185 \mathrm{μs}\left({\color{gray}0.567 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$16.5 \mathrm{ms} \pm 136 \mathrm{μs}\left({\color{lightgreen}-27.631 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/block/v/1 $$16.1 \mathrm{ms} \pm 166 \mathrm{μs}\left({\color{gray}0.943 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property depths: DT=255, PT=255, ET=255, E=255 $$65.2 \mathrm{ms} \pm 258 \mathrm{μs}\left({\color{gray}-3.219 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=0, E=0 $$36.8 \mathrm{ms} \pm 316 \mathrm{μs}\left({\color{lightgreen}-9.080 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=2, PT=2, ET=2, E=2 $$55.5 \mathrm{ms} \pm 200 \mathrm{μs}\left({\color{gray}-3.734 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=0, E=2 $$41.2 \mathrm{ms} \pm 194 \mathrm{μs}\left({\color{lightgreen}-8.950 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=2, E=2 $$46.8 \mathrm{ms} \pm 359 \mathrm{μs}\left({\color{lightgreen}-6.207 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=2, ET=2, E=2 $$52.3 \mathrm{ms} \pm 342 \mathrm{μs}\left({\color{gray}-4.434 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=255, PT=255, ET=255, E=255 $$100 \mathrm{ms} \pm 446 \mathrm{μs}\left({\color{gray}-4.497 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=0, E=0 $$37.6 \mathrm{ms} \pm 273 \mathrm{μs}\left({\color{lightgreen}-5.251 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=2, PT=2, ET=2, E=2 $$92.3 \mathrm{ms} \pm 717 \mathrm{μs}\left({\color{gray}-3.270 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=0, E=2 $$73.7 \mathrm{ms} \pm 306 \mathrm{μs}\left({\color{lightgreen}-5.953 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=2, E=2 $$82.2 \mathrm{ms} \pm 335 \mathrm{μs}\left({\color{gray}-4.455 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=2, ET=2, E=2 $$86.9 \mathrm{ms} \pm 500 \mathrm{μs}\left({\color{gray}-4.118 \mathrm{\%}}\right) $$ Flame Graph

representative_read_entity_type

Function Value Mean Flame graphs
get_entity_type_by_id Account ID: d4e16033-c281-4cde-aa35-9085bf2e7579 $$2.11 \mathrm{ms} \pm 6.44 \mathrm{μs}\left({\color{gray}-0.240 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_complete_one_depth

Function Value Mean Flame graphs
entity_by_id 50 entities $$5.63 \mathrm{s} \pm 286 \mathrm{ms}\left({\color{gray}4.04 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 5 entities $$27.3 \mathrm{ms} \pm 236 \mathrm{μs}\left({\color{gray}1.67 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$20.7 \mathrm{ms} \pm 69.2 \mathrm{μs}\left({\color{gray}-0.213 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$57.3 \mathrm{ms} \pm 175 \mathrm{μs}\left({\color{gray}-1.117 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 25 entities $$178 \mathrm{ms} \pm 813 \mathrm{μs}\left({\color{gray}2.19 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$1.99 \mathrm{ms} \pm 8.26 \mathrm{μs}\left({\color{gray}3.44 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$2.21 \mathrm{ms} \pm 7.20 \mathrm{μs}\left({\color{gray}3.85 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$2.00 \mathrm{ms} \pm 6.51 \mathrm{μs}\left({\color{gray}2.97 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$2.90 \mathrm{ms} \pm 10.5 \mathrm{μs}\left({\color{gray}-0.040 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$9.15 \mathrm{ms} \pm 89.5 \mathrm{μs}\left({\color{lightgreen}-9.495 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_complete_zero_depth

Function Value Mean Flame graphs
entity_by_id 50 entities $$4.13 \mathrm{ms} \pm 23.2 \mathrm{μs}\left({\color{gray}0.469 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 5 entities $$2.00 \mathrm{ms} \pm 7.70 \mathrm{μs}\left({\color{gray}2.55 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$1.99 \mathrm{ms} \pm 9.84 \mathrm{μs}\left({\color{gray}1.67 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$2.21 \mathrm{ms} \pm 15.8 \mathrm{μs}\left({\color{gray}4.69 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 25 entities $$3.35 \mathrm{ms} \pm 14.4 \mathrm{μs}\left({\color{gray}2.83 \mathrm{\%}}\right) $$ Flame Graph

@TimDiekmann TimDiekmann added this pull request to the merge queue Jan 8, 2025
Merged via the queue into main with commit 9eb59d7 Jan 8, 2025
88 checks passed
@TimDiekmann TimDiekmann deleted the t/h-3702-add-more-indices-to-postgres-tables branch January 8, 2025 10:43
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