SQLite などではデータやテーブルの増減があると不要な領域が発生するために、DBの最適化ができる機能(コマンド)があるようなのですが、Realm にも最適化する機能やコマンドはあるのでしょうか?
もしくは Realm の構造上、最適化する必要がないのでしょうか?
ご教授の程、よろしくお願いいたします。
スタック・オーバーフローはプログラマーとプログラミングに熱心な人のためのQ&Aサイトです。すぐ登録できます。
登録してこのコミュニティに参加するROS 3.6.0 以降であれば "vacuum" が可能だと以下リンク先に記載されていました。
Vacuum Utility- Realm Sync Docs
Realm stores its transactions within files on the server. Over time, these files can become fragmented as new transactions are too large to fit into previously allocated space in the file. When this happens, the file allocates more free disk space for the transaction and as a result a small amount of space may go unused in the original file. Over time, this unused space can add up and be wasteful as well as decrease performance. As a result, we offer a "vacuum" utility in ROS version 3.6.0 and newer. This utility removes the unused space and effectively compacts the transaction logs and state.
実行方法は以下の通りです。
realm-vacuum <path-to-your-big-server-file>