简体   繁体   English

SQLITE文件小吗?

[英]SQLITE small in file size?

Okay I am creating an app thats a scrabble cheat basically... I have noticed that all the other apps can work without the internet meaning they must store their data(words) in an sql database or sorts. 好的,我正在创建一个基本是拼字游戏的应用程序...我注意到所有其他应用程序都可以在没有互联网的情况下工作,这意味着它们必须将其数据(单词)存储在sql数据库中或进行排序。 I was planning on doing the same thing. 我正计划做同样的事情。 I exported my mysql database which is on my mac and it was 13.2 mb which i believe is quite alot. 我导出了在我的mac上的mysql数据库,它的大小为13.2 mb,我认为这是很多的。 Anyhow when I looked at the other apps on the market that do the same thing as mine they all had sizes in the kb's. 无论如何,当我查看市场上与我的应用程序具有相同功能的其他应用程序时,它们都具有kb的大小。 Is there a big difference between mysql sizes compared to sqlite. 与sqlite相比,mysql大小之间是否有较大差异。 And I don't know if I am viewing app sizes right. 而且我不知道我是否在正确查看应用程序尺寸。 Here is how i do it. 这是我的方法。 Setting> Application> Manage Application and under each package it says the size. 设置>应用程序>管理应用程序,并在每个软件包下注明大小。 Is that where I should look for the size of the app. 那是我应该寻找应用程序大小的地方。 How can I scale my db into my app. 如何将数据库扩展到我的应用程序中。

If you're willing to trade time for space, you could store the word list as a compressed text file with your app. 如果您愿意用时间来换取空间,可以将单词列表存储为应用程序中的压缩文本文件。 Then, on first launch, create a new database and copy the word list in. 然后,在首次启动时,创建一个新数据库并复制单词列表。

If you did this on a background thread as soon as the app launched, you could probably be done before the user did their first word search (though of course you should have some mechanism to signal the main thread you are done, and ask the user to please wait if you are not). 如果您在应用启动后立即在后台线程上执行此操作,则可以在用户进行第一个单词搜索之前完成操作(尽管您当然应该具有某种机制来向主线程发出信号,然后询问用户)请您稍等一下。)

There are a number of factors that could be affecting the size of the apps you're seeing in the market vs. your mysql dump. 有很多因素可能会影响您在市场上看到的应用程序大小以及mysql dump。

1) The size of their databases / schemas and the number of words they include. 1)它们的数据库/模式的大小以及它们包含的单词数。 Every time you add a column of data to your database, you're effectively increasing the size of the database geometrically (that is, if you add one row in a 2x3 database, you're actually adding 3 more cells (1col x 3 rows). If you have 10,000 words in your dictionary, you can see how that would increase the size of your database very quickly. Step 1: Remove all unnecessary columns from the database 每次向数据库中添加一列数据时,实际上都是在以几何方式增加数据库的大小(也就是说,如果在2x3数据库中添加一行,则实际上是在增加3个单元(1col x 3行) )。如果您的词典中有10,000个单词,您会发现这将如何迅速增加数据库的大小:步骤1:从数据库中删除所有不必要的列

2) The files on the Android market are .apk files, which are essentially very compressed archive files. 2)Android市场上的文件是.apk文件,它们本质上是非常压缩的存档文件。 Since SQLite databases are basically just fancy text files, the compression algorithms used to create the package are very good at compressing this data. 由于SQLite数据库基本上只是精美的文本文件,因此用于创建程序包的压缩算法非常擅长压缩此数据。 Once you create your .apk, you'll see the size of the application drop dramatically (our game Zomblings went from 60MB uncompressed to a 10M .apk file). 创建.apk之后,您会看到应用程序的大小急剧下降(我们的游戏Zomblings从60MB未压缩变为10M .apk文件)。 Step 2: generate the apk and see what files size you actually get. 第2步:生成apk,然后查看实际获得的文件大小。

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

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