0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

MongoEngineの非構造化データ処理が遅い

Posted at

初めに

機械学習の業務でMongoEngineを使用して非構造化データを取り扱う際の注意点です。誰かのお役に立てれば幸いです。

MongoEngineが遅い

class model(Document):
    # 1㎆以上のデータ
    big_data = BinaryField()

以下の二つの方法でアクセスしてみます。

m1 = model.objects.first() # it takes 20 seconds by mongoEngine 
m2 = db.connection.get_connection().find_one() # it takes 0.9 seconds by pymongo

結論

MongoEngine は、ドキュメントデータを Python オブジェクトにマップするために使用されます。非常に大きな非構造化データを取り扱う場合、アンシリアライズにすごく時間かかるので、 MongoEngine は適切なツールではないため、pymongo を使用する方がいいです。

参考資料

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?