简体   繁体   English

使用Pickle vs数据库加载大量数据?

[英]Using Pickle vs database for loading large amount of data?

I have previously saved a dictionary which maps image_name -> list of feature vectors, with the file being ~32 Gb. 我以前保存了一个字典,该字典映射image_name->特征向量列表,文件大小为〜32 Gb。 I have been using cPickle to load the dictionary in, but since I only have 8 GB of RAM, this process takes forever. 我一直在使用cPickle加载字典,但是由于我只有8 GB的RAM,因此此过程将花费很长时间。 Someone suggested using a database to store all the info, and reading from that, but would that be a faster/better solution than reading a file from disk? 有人建议使用数据库存储所有信息,然后从中读取信息,但是,这比从磁盘上读取文件更快或更佳的解决方案吗? Why? 为什么?

Use a database because it allows you to query faster. 使用数据库,因为它使您可以更快地查询。 I've done this before. 我以前做过 I would suggest against using cPickle. 我建议不要使用cPickle。 What specific implementation are you using? 您正在使用什么特定的实现?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM