New to Database management. I have a books database and I want to create an index for the ISBN which is 13 characters in length. Example: '9781509825889'
Currently I'm using a string index but I've read conflicting points on whether to store as an int or a string for indexing optimization.
It looks like I have Int32 or Int64 options and I think the above ISBN is too big for Int32 but is it worth switching to an Int64 for query optimization or should I just stick with string? Is there any significant performance gain?
Thanks
MongoDb indexes does not depends on the data type of the fields, so it does not matters you put it into String or Int32 or Int64.
All indexes are hashed that's why it does not depends on the data type you used.
References:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With