It's best practice to randomise document ids to avoid hotspots in Firebase Firestore. How random does an id need to be to be 'not sequential'?
For example, a bad pattern is Customer1, Customer2, Customer3 because it is sequential. Would it be okay to have ACustomer1, aCustomer2, KCustomer3. ie, what would it take to break the sequentiality; is adding a random letter at the start enough?
Let's take some ids in a collection:
- 123A47652hAShd
- 123A4asdqwafAa
- 123A4ad32a2da2f3
All of the records start 123A<FIRESTORE_RANDOM_ID>. Is it fine that the ids start the same, if there is a good amount of variability overall?
I want to export some Stripe records to firestore, all of which start txn_1234123... and for idempotency and consistency I want to use the same ids in firestore. Will it lead to hotspots since all the records in the collection start with the same 10 characters?
The new Key Visualiser for Firestore is a great way to check for hotspots and analyse Firestore usage patterns on existing data. But I'm trying to get a solid design up front, thanks everyone.