Android Performance : Flat file vs SQLite

走远了吗. 提交于 2019-11-28 00:39:11

Aside from performance benefits, here's a simple list of advantages of using SQLite rather than flat file:

  • You can query items as you wish -- don't need to load all of them and select which ones you need.
  • Deleting records is a much less painful process. No rewriting of whole files into wherever.
  • Updating a record is as easy as removing or creating one.
  • Have you ever tried doing cross-referencing lookups on a flat file? Not worth it.

To summarize, it's every advantage a Database has over a text file.

Lucifer

It depends on your requirement.

If your storage data size is structured-bulky in size then i suggest you for SQLite. On the other hand if the data size is just a single or few lines then flat file is best option.

What makes difference between them is, SQLite stores data in structured format, so it will be easier to find a record from multiple set of records which is very tedious process in case of flat file.

However when if you are storing blob kind of data then it is suggested to use combination of both, SQLite and file system both. i.e. store the image/sound/video data as file format and store their path in SQLite.

Also visit this accessing performance.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!