开发者

Huge table in a Django?

if you have millions of entries in a mysql table, you often want to manipulate it with a hexadecimal primary key (in practice you do a md5(name)). The queries are then much faster.

Is there a way to do this with Django? If not, the usual int primary key isn't limitating? How to specify that y开发者_如何学JAVAou want a big integer?


You can use whatever you like as the primary key in Django. Just add primary_key=True to the model arguments. E.g.

foo = models.CharField(max_length=36, primary_key=True)

Here are the Django docs on this topic.

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜