我应该将什么作为我的索引存储在客户端代码中? [英] What should I store as my index in client code?

查看:111
本文介绍了我应该将什么作为我的索引存储在客户端代码中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google App Engine并存储用户。以前,我使用MySQL和自动递增int为我的userId字段,但现在GAE自动生成一个键为我存储的每个新实体,如 g5kZXZ-aGVsbG93b3JsZHIKCxIEVXNlchgNDA 但它们也自动生成自动递增ID int。

I'm using Google App Engine and storing users. Before, I was using MySQL with an auto-incrementing int for my userId field, but now GAE auto generates a key for each new entity I store, such as g5kZXZ-aGVsbG93b3JsZHIKCxIEVXNlchgNDA, but they also automatically generate an auto-incrementing ID int too.

我应该在客户端代码中使用哪一个来存储userId?使用GAE生成的长键有什么优点,或者在性能和查找方面使用小int ID同样的东西吗?

Which one should I use in my client code to store as the userId? Are there any advantages to using the long key that GAE generates, or is using the small int ID the same thing in terms of performance and look ups? Are there any advantages to one over the other, or is there practically no difference?

编辑:对不起,我的问题不够清楚。这里是我问:
这不是关于长度,但有查找键让我一步领先于没有它吗?因为如果我想查找一个用户,我必须通过电子邮件查找他,但现在我有在表中的行的键,这是否给我任何优势?

Sorry my question was not clear enough. Here's what I'm asking: It's not about length, but does having the lookup key put me a step ahead of not having it? Because if I wanted to look up a user, I'd have to look him up by email, but now that I have the key for that row in the "table", does this give me any sort of advantage?

推荐答案

无论是使用长字母字符串还是短字符串来识别用户,都没有性能差异。

Either one is fine, there's no performance difference between using a long string of letters or a short one to identify users.

这篇关于我应该将什么作为我的索引存储在客户端代码中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆