hashintel / hash

🚀 The open-source, multi-tenant, self-building knowledge graph
https://hash.dev
Other
1.08k stars 83 forks source link

H-3581: Create crate for graph-migrations #5640

Closed TimDiekmann closed 3 days ago

TimDiekmann commented 4 days ago

🌟 What is the purpose of this PR?

Setting up a new crate always comes with boilerplate which should be reviewed standalone.

🔍 What does this change?

Create the hash-graph-migration crate

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

📜 Does this require a change to the docs?

The changes in this PR:

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

The changes in this PR:

github-advanced-security[bot] commented 4 days ago

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

github-actions[bot] commented 4 days ago

Benchmark results

@rust/hash-graph-benches – Integrations

## scaling_read_entity_complete_one_depth | Function | Value | Mean | Flame graphs | |----------|-------|------|--------------| | entity_by_id | 25 entities | $$72.1 \mathrm{ms} \pm 369 \mathrm{μs}\left({\color{gray}-0.172 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/scaling_read_entity_complete_one_depth/entity_by_id/25+entities/flamegraph.svg) | | entity_by_id | 5 entities | $$25.5 \mathrm{ms} \pm 307 \mathrm{μs}\left({\color{gray}1.49 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/scaling_read_entity_complete_one_depth/entity_by_id/5+entities/flamegraph.svg) | | entity_by_id | 1 entities | $$20.2 \mathrm{ms} \pm 92.9 \mathrm{μs}\left({\color{gray}0.923 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/scaling_read_entity_complete_one_depth/entity_by_id/1+entities/flamegraph.svg) | | entity_by_id | 10 entities | $$50.2 \mathrm{ms} \pm 648 \mathrm{μs}\left({\color{gray}-2.747 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/scaling_read_entity_complete_one_depth/entity_by_id/10+entities/flamegraph.svg) | | entity_by_id | 50 entities | $$553 \mathrm{ms} \pm 5.59 \mathrm{ms}\left({\color{red}113 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/scaling_read_entity_complete_one_depth/entity_by_id/50+entities/flamegraph.svg) | ## representative_read_entity | Function | Value | Mean | Flame graphs | |----------|-------|------|--------------| | entity_by_id | entity type ID: `https://blockprotocol.org/@alice/types/entity-type/organization/v/1` | $$16.6 \mathrm{ms} \pm 186 \mathrm{μs}\left({\color{gray}1.91 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_entity/entity_by_id/entity+type+ID_+`https___blockprotocol.org_@alice_types_entity-t_9/flamegraph.svg) | | entity_by_id | entity type ID: `https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1` | $$17.5 \mathrm{ms} \pm 202 \mathrm{μs}\left({\color{gray}3.97 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_entity/entity_by_id/entity+type+ID_+`https___blockprotocol.org_@alice_types_entity-t_5/flamegraph.svg) | | entity_by_id | entity type ID: `https://blockprotocol.org/@alice/types/entity-type/person/v/1` | $$17.0 \mathrm{ms} \pm 206 \mathrm{μs}\left({\color{gray}3.07 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_entity/entity_by_id/entity+type+ID_+`https___blockprotocol.org_@alice_types_entity-t_6/flamegraph.svg) | | entity_by_id | entity type ID: `https://blockprotocol.org/@alice/types/entity-type/book/v/1` | $$18.9 \mathrm{ms} \pm 249 \mathrm{μs}\left({\color{red}15.2 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_entity/entity_by_id/entity+type+ID_+`https___blockprotocol.org_@alice_types_entity-t_3/flamegraph.svg) | | entity_by_id | entity type ID: `https://blockprotocol.org/@alice/types/entity-type/block/v/1` | $$16.7 \mathrm{ms} \pm 223 \mathrm{μs}\left({\color{red}6.64 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_entity/entity_by_id/entity+type+ID_+`https___blockprotocol.org_@alice_types_entity-t_7/flamegraph.svg) | | entity_by_id | entity type ID: `https://blockprotocol.org/@alice/types/entity-type/song/v/1` | $$17.6 \mathrm{ms} \pm 241 \mathrm{μs}\left({\color{gray}4.43 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_entity/entity_by_id/entity+type+ID_+`https___blockprotocol.org_@alice_types_entity-t_8/flamegraph.svg) | | entity_by_id | entity type ID: `https://blockprotocol.org/@alice/types/entity-type/building/v/1` | $$16.0 \mathrm{ms} \pm 194 \mathrm{μs}\left({\color{gray}-2.486 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_entity/entity_by_id/entity+type+ID_+`https___blockprotocol.org_@alice_types_entity-t_4/flamegraph.svg) | | entity_by_id | entity type ID: `https://blockprotocol.org/@alice/types/entity-type/playlist/v/1` | $$16.8 \mathrm{ms} \pm 216 \mathrm{μs}\left({\color{red}8.90 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_entity/entity_by_id/entity+type+ID_+`https___blockprotocol.org_@alice_types_entity-t/flamegraph.svg) | | entity_by_id | entity type ID: `https://blockprotocol.org/@alice/types/entity-type/page/v/2` | $$16.3 \mathrm{ms} \pm 218 \mathrm{μs}\left({\color{gray}0.906 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_entity/entity_by_id/entity+type+ID_+`https___blockprotocol.org_@alice_types_entity-t_2/flamegraph.svg) | ## scaling_read_entity_complete_zero_depth | Function | Value | Mean | Flame graphs | |----------|-------|------|--------------| | entity_by_id | 25 entities | $$3.33 \mathrm{ms} \pm 20.0 \mathrm{μs}\left({\color{gray}-0.969 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/scaling_read_entity_complete_zero_depth/entity_by_id/25+entities/flamegraph.svg) | | entity_by_id | 5 entities | $$1.90 \mathrm{ms} \pm 8.86 \mathrm{μs}\left({\color{gray}-0.354 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/scaling_read_entity_complete_zero_depth/entity_by_id/5+entities/flamegraph.svg) | | entity_by_id | 1 entities | $$1.89 \mathrm{ms} \pm 9.88 \mathrm{μs}\left({\color{gray}0.835 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/scaling_read_entity_complete_zero_depth/entity_by_id/1+entities/flamegraph.svg) | | entity_by_id | 10 entities | $$2.13 \mathrm{ms} \pm 12.4 \mathrm{μs}\left({\color{gray}0.315 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/scaling_read_entity_complete_zero_depth/entity_by_id/10+entities/flamegraph.svg) | | entity_by_id | 50 entities | $$5.31 \mathrm{ms} \pm 18.1 \mathrm{μs}\left({\color{red}24.5 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/scaling_read_entity_complete_zero_depth/entity_by_id/50+entities/flamegraph.svg) | ## scaling_read_entity_linkless | Function | Value | Mean | Flame graphs | |----------|-------|------|--------------| | entity_by_id | 1 entities | $$1.86 \mathrm{ms} \pm 5.24 \mathrm{μs}\left({\color{gray}-0.875 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/scaling_read_entity_linkless/entity_by_id/1+entities/flamegraph.svg) | | entity_by_id | 10000 entities | $$13.5 \mathrm{ms} \pm 62.6 \mathrm{μs}\left({\color{gray}-0.367 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/scaling_read_entity_linkless/entity_by_id/10000+entities/flamegraph.svg) | | entity_by_id | 100 entities | $$2.05 \mathrm{ms} \pm 10.7 \mathrm{μs}\left({\color{gray}-0.176 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/scaling_read_entity_linkless/entity_by_id/100+entities/flamegraph.svg) | | entity_by_id | 1000 entities | $$2.91 \mathrm{ms} \pm 15.8 \mathrm{μs}\left({\color{gray}-1.107 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/scaling_read_entity_linkless/entity_by_id/1000+entities/flamegraph.svg) | | entity_by_id | 10 entities | $$1.92 \mathrm{ms} \pm 8.01 \mathrm{μs}\left({\color{gray}-0.110 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/scaling_read_entity_linkless/entity_by_id/10+entities/flamegraph.svg) | ## representative_read_multiple_entities | Function | Value | Mean | Flame graphs | |----------|-------|------|--------------| | link_by_source_by_property | depths: DT=255, PT=255, ET=255, E=255 | $$109 \mathrm{ms} \pm 665 \mathrm{μs}\left({\color{gray}0.741 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_multiple_entities/link_by_source_by_property/depths_+DT=255,+PT=255,+ET=255,+E=255/flamegraph.svg) | | link_by_source_by_property | depths: DT=0, PT=0, ET=2, E=2 | $$88.6 \mathrm{ms} \pm 323 \mathrm{μs}\left({\color{gray}-1.039 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_multiple_entities/link_by_source_by_property/depths_+DT=0,+PT=0,+ET=2,+E=2/flamegraph.svg) | | link_by_source_by_property | depths: DT=2, PT=2, ET=2, E=2 | $$97.9 \mathrm{ms} \pm 459 \mathrm{μs}\left({\color{gray}0.301 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_multiple_entities/link_by_source_by_property/depths_+DT=2,+PT=2,+ET=2,+E=2/flamegraph.svg) | | link_by_source_by_property | depths: DT=0, PT=0, ET=0, E=0 | $$42.5 \mathrm{ms} \pm 263 \mathrm{μs}\left({\color{gray}0.587 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_multiple_entities/link_by_source_by_property/depths_+DT=0,+PT=0,+ET=0,+E=0/flamegraph.svg) | | link_by_source_by_property | depths: DT=0, PT=2, ET=2, E=2 | $$93.4 \mathrm{ms} \pm 527 \mathrm{μs}\left({\color{gray}0.422 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_multiple_entities/link_by_source_by_property/depths_+DT=0,+PT=2,+ET=2,+E=2/flamegraph.svg) | | link_by_source_by_property | depths: DT=0, PT=0, ET=0, E=2 | $$80.8 \mathrm{ms} \pm 411 \mathrm{μs}\left({\color{gray}-0.954 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_multiple_entities/link_by_source_by_property/depths_+DT=0,+PT=0,+ET=0,+E=2/flamegraph.svg) | | entity_by_property | depths: DT=255, PT=255, ET=255, E=255 | $$70.6 \mathrm{ms} \pm 697 \mathrm{μs}\left({\color{gray}2.22 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_multiple_entities/entity_by_property/depths_+DT=255,+PT=255,+ET=255,+E=255/flamegraph.svg) | | entity_by_property | depths: DT=0, PT=0, ET=2, E=2 | $$51.5 \mathrm{ms} \pm 519 \mathrm{μs}\left({\color{gray}0.464 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_multiple_entities/entity_by_property/depths_+DT=0,+PT=0,+ET=2,+E=2/flamegraph.svg) | | entity_by_property | depths: DT=2, PT=2, ET=2, E=2 | $$60.2 \mathrm{ms} \pm 474 \mathrm{μs}\left({\color{gray}0.430 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_multiple_entities/entity_by_property/depths_+DT=2,+PT=2,+ET=2,+E=2/flamegraph.svg) | | entity_by_property | depths: DT=0, PT=0, ET=0, E=0 | $$40.2 \mathrm{ms} \pm 186 \mathrm{μs}\left({\color{gray}-1.103 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_multiple_entities/entity_by_property/depths_+DT=0,+PT=0,+ET=0,+E=0/flamegraph.svg) | | entity_by_property | depths: DT=0, PT=2, ET=2, E=2 | $$55.9 \mathrm{ms} \pm 427 \mathrm{μs}\left({\color{gray}1.02 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_multiple_entities/entity_by_property/depths_+DT=0,+PT=2,+ET=2,+E=2/flamegraph.svg) | | entity_by_property | depths: DT=0, PT=0, ET=0, E=2 | $$45.6 \mathrm{ms} \pm 307 \mathrm{μs}\left({\color{gray}1.65 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_multiple_entities/entity_by_property/depths_+DT=0,+PT=0,+ET=0,+E=2/flamegraph.svg) | ## representative_read_entity_type | Function | Value | Mean | Flame graphs | |----------|-------|------|--------------| | get_entity_type_by_id | Account ID: `d4e16033-c281-4cde-aa35-9085bf2e7579` | $$1.43 \mathrm{ms} \pm 17.8 \mathrm{μs}\left({\color{gray}3.61 \mathrm{\\%}}\right) $$ | [Flame Graph](https://benchmarks.hash.dev/ff19020fba7878e640e0734ff47a8d7941dcd297/representative_read_entity_type/get_entity_type_by_id/Account+ID_+`d4e16033-c281-4cde-aa35-9085bf2e7579`/flamegraph.svg) |