Sqlite 还是 MySql?如何决定?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4813890/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Sqlite or MySql? How to decide?
提问by Mawg says reinstate Monica
Any good rules of thumb on how to decide which of the two to use?
关于如何决定使用两者中的哪一个的任何好的经验法则?
And, if you take over an Sqlite database, and the system is expected to "get much larger", how to decide whether to stick with it or move to MySql?
而且,如果你接管了一个 Sqlite 数据库,并且系统预计会“变得更大”,那么如何决定是坚持还是转向 MySql?
回答by MarkR
Their feature sets are not at all the same. Sqlite is an embedded database which has no network capabilities (unless you add them). So you can't use it on a network.
它们的功能集完全不同。Sqlite 是一个嵌入式数据库,没有网络功能(除非你添加它们)。所以你不能在网络上使用它。
If you need
如果你需要
- Network access - for example accessing from another machine;
- Any real degree of concurrency - for example, if you think you are likely to want to run several queries at once, or run a workload that has lots of selects and a few updates, and want them to go smoothly etc.
- a lot of memory usage, for example, to buffer parts of your 1Tb database in your 32G of memory.
- 网络访问 - 例如从另一台机器访问;
- 任何真正的并发程度 - 例如,如果您认为您可能想要一次运行多个查询,或者运行具有大量选择和一些更新的工作负载,并希望它们顺利进行等。
- 大量内存使用,例如,在 32G 内存中缓冲 1Tb 数据库的部分内容。
You need to use mysql or some other server-based RDBMS.
您需要使用 mysql 或其他一些基于服务器的 RDBMS。
Note that MySQL is not the only choice and there are plenty of others which might be better for new applications (for example pgSQL).
请注意,MySQL 不是唯一的选择,还有很多其他选择可能更适合新应用程序(例如 pgSQL)。
Sqlite is a very, very nice piece of software, but it has never made claims to do any of these things that RDBMS servers do. It's a small library which runs SQL on local files (using locking to ensure that multiple processes don't screw the file up). It's really well tested and I like it a lot.
Sqlite 是一个非常非常好的软件,但它从未声称可以做 RDBMS 服务器所做的任何这些事情。这是一个在本地文件上运行 SQL 的小型库(使用锁定来确保多个进程不会把文件搞砸)。它经过了很好的测试,我非常喜欢它。
Also, if you aren't able to choose this correctly by yourself, you probably need to hire someone on your team who can.
此外,如果您自己无法正确选择此选项,您可能需要在团队中聘请可以做到的人。
回答by Josue
The sqlite team published an article explaining when to use sqlitethat is great read. Basically, you want to avoid using sqlite when you have a lot of write concurrency or need to scale to terabytes of data. In many other cases, sqlite is a surprisingly good alternative to a "traditional" database such as MySQL.
sqlite 团队发表了一篇解释何时使用 sqlite的文章,值得一读。基本上,当您有大量写入并发或需要扩展到 TB 级数据时,您希望避免使用 sqlite。在许多其他情况下,sqlite 是 MySQL 等“传统”数据库的绝佳替代品。
回答by Jerome WAGNER
SQLite out-of-the-box is not really feature-full regarding concurrency. You will get into trouble if you have hundreds of web requests hitting the same SQLite database.
SQLite 开箱即用的并发性并不是真正的功能齐全。如果您有数百个 Web 请求访问同一个 SQLite 数据库,您就会遇到麻烦。
You should definitely go with MySQL or PostgreSQL.
您绝对应该使用 MySQL 或 PostgreSQL。
If it is for a single-person project, SQLite will be easier to setup though.
如果是单人项目,SQLite 会更容易设置。