MySQL的替代品 [英] Alternatives to MySQL

查看:344
本文介绍了MySQL的替代品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我的应用程序持久存储数据,但是我真的不需要完整的关系数据库.我真的可以通过像缓存"这样的基本 persistent 存储来解决,该存储结构只是一个(键,值)对.

代替数据库,我最好的可扩展选项是什么?

解决方案

始终存在 SQLite ,该数据库是存储在文件中. SQLite已经具有内置的并发性,因此您不必担心文件锁定之类的问题,而且读取速度确实非常快.

但是,如果您要进行许多数据库更改,则最好一次在交易.与每次发出更改查询相反,这只会将更改写入文件一次.这样可以大大提高进行多项更改的速度.

发出变更查询时,无论它是否在事务内部,整个数据库将被锁定,直到该查询结束为止.这意味着非常大的事务可能会对其他进程的性能产生不利影响,因为它们必须等待事务完成才能访问数据库.在实践中,我还没有发现这一点那么引人注目,但是尝试尽量减少发出的数据库修改查询的数量始终是个好习惯.

I would like to store data persistently for my application, but I don't really need a full blown relational database. I really could get by with a basic "cache"-like persistent storage where the structure is just a (key, value) pair.

In lieu of a database what are my best, scalable options?

解决方案

There's always SQLite, a database that's stored in a file. SQLite already has built-in concurrency, so you don't have to worry about things like file locking, and it's really fast for reads.

If, however, you are doing lots of database changes, it's best to do them all at once inside a transaction. This will only write the changes to the file once, as opposed to every time an change query is issued. This dramatically increases the speed of doing multiple changes.

When a change query is issued, whether it's inside a tranasction or not, the whole database is locked until that query finishes. This means that extremely large transactions could adversely affect the performance of other processes because they must wait for the transaction to finish before they can access the database. In practice, I haven't found this to be that noticeable, but it's always good practice to try to minimize the number of database modifying queries you issue.

这篇关于MySQL的替代品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆