Skip to content

Conversation

antoniofilipovic
Copy link
Contributor

@antoniofilipovic antoniofilipovic commented Aug 7, 2023

This PR adds caching of name id mapper for property creation. If name_id_mapper proves to be a deadlock in other queries, we can think about how to add caching per storage accessor level. Thread local caching for name_id_mapper didn't yield so much better results.

Short benchmark.
The following queries were executed:

  1. FOREACH (i in range(0, 1000000) | CREATE (n:Label {id:i}));
  2. CREATE INDEX ON :Label(id);
  3. FOREACH (i IN range(0, 1000000 , 3) | MERGE (n:Label {id:i}) SET n += {prop2:"nmrtRnZQzm", prop3:"bielFtyXca", prop4:"AoCYiwqjuu", prop5:"GqyKUebYyi", prop6:"spdWPDdyiY", prop7:"dzpACFXOal", prop8:"NchfJxgMHL", prop9:"JKbOEGOhkl", prop10:"ftmaTyKESy", prop11:"cIgjUrbHcF"});

Execution for last query:

  • baseline:
  • this PR: 2.4 sec
  • thread local caching (also this PR but two bugy reverted commits): 2.6 sec

[master < Task] PR

  • Check, and update documentation if necessary
  • Provide the full content or a guide for the final git message

To keep docs changelog up to date, one more thing to do:

  • Write a release note here, including added/changed clauses
  • Tag someone from docs team in the comments
@antoniofilipovic antoniofilipovic changed the title [master < T ] Improve name to id in set properties [master < T1147 ] Improve NameToId mapper on set properties Aug 7, 2023
@antoniofilipovic antoniofilipovic marked this pull request as ready for review August 8, 2023 10:32
@antoniofilipovic antoniofilipovic self-assigned this Aug 9, 2023
@antoniofilipovic antoniofilipovic added the Ready for review PR is ready for review label Aug 9, 2023
@gitbuda gitbuda added this to the mg-v2.11.0 milestone Sep 1, 2023
@antoniofilipovic antoniofilipovic merged commit 93992a2 into master Sep 5, 2023
@antoniofilipovic antoniofilipovic deleted the improve-name-to-id-getter branch September 5, 2023 22:12
@vpavicic vpavicic added the Docs - changelog only Docs - changelog only label Sep 12, 2023
@vpavicic
Copy link
Contributor

@antoniofilipovic please can you give me a release note (RN)?

@antoniofilipovic
Copy link
Contributor Author

@vpavicic yes, sorry. Performance on set properties is additionally improved by caching mappings from property name to internal property id

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

4 participants