SQLite比MySQL快吗? [英] SQLite faster than MySQL?

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

问题描述

我想设置一个teampeak 3服务器.我可以选择SQLite和MySQL作为数据库.好吧,我通常倾向于在生产中不使用SQLite".但另一方面,它是一个teampeak服务器.好吧,就让我用谷歌搜索吧...我发现了:

I want to set up a teamspeak 3 server. I can choose between SQLite and MySQL as database. Well I usually tend to "do not use SQLite in production". But on the other hand, it's a teamspeak server. Well okay, just let me google this... I found this:

  1. 速度
    SQLite3比MySQL数据库快得多.这是因为文件数据库总是比unix套接字快.当我请求编辑频道时,在MySQL数据库(127.0.0.1)上花费了大约0.5-1秒,而在SQLite 3上几乎立即花费了(0.1秒).[...]
  1. Speed
    SQLite3 is much faster than MySQL database. It's because file database is always faster than unix socket. When I requested edit of channel it took about 0.5-1 sec on MySQL database (127.0.0.1) and almost instantly (0.1 sec) on SQLite 3. [...]

http://forum.teamspeak. com/showthread.php/77126-SQLite-vs-MySQL-Answer-is-here

我不想开始讨论SQLite与MySQL的争论.我只想问:他的论点是否有效?我无法想象他说的是真的.但不幸的是,我不够专业,无法亲自回答这个问题.

I don't want to start a SQLite vs MySQL debate. I just want to ask: Is his argument even valid? I can't imagine it's true what he says. But unfortunately I'm not expert enough to answer this question myself.

TeamSpeak开发人员在SQLite和MySQL之间的数据库体系结构上可能有一些主要差异,这说明了速度上的巨大差异(我无法想象).

Maybe TeamSpeak dev's have some major differences in their db architecture between SQLite and MySQL which explains a huge difference in speed (I can't imagine this).

推荐答案

首次访问时,在SQLite中的显示速度会更快

SQLite的访问时间在第一次出现时会更快,但这是在线上有少量用户的情况. SQLite使用非常简单的访问算法,它的速度很快,但不能处理并发.

The access time for SQLite will appear faster at first instance, but this is with a small number of users online. SQLite uses a very simplistic access algorithm, its fast but does not handle concurrency.

随着数据库开始增长,同时访问的数量将开始减少.服务器处理多个请求的方式完全不同,并且更加复杂和经过优化以实现高并发性.例如,如果正在进行更新,SQLite将锁定整个表,并将订单排队.

As the database starts to grow, and the amount of simultaneous access it will start to suffer. The way servers handle multiple requests is completely different and way more complex and optimized for high concurrency. For example, SQLite will lock the whole table if an update is going on, and queue the orders.

RDBMS的工作量很大,使它们更具可扩展性

MySQL,即使只有一个用户也将创建访问队列,部分锁定表而不是每次仅允许单个用户执行时间,以及其他相当复杂的任务,以确保其他任何用户仍可访问该数据库同时访问.

MySQL for example, even with a single user will create an access QUEUE, lock tables partially instead of allowing only single user-per time executions, and other pretty complex tasks in order to make sure the database is still accessible for any other simultaneous access.

这将使单个用户的连接速度变慢,但是在将来有100个用户在线时(这种情况下,简单 锁定整个表并每次执行一次查询" SQLite的过程将占用服务器.

This will make a single user connection slower, but pays off in the future, when 100's of users are online, and in this case, the simple "LOCK THE WHOLE TABLE AND EXECUTE A SINGLE QUERY EACH TIME" procedure of SQLite will hog the server.

SQLite是为了简化和自包含数据库应用程序而设计的.

SQLite is made for simplicity and Self Contained Database Applications.

如果您希望一次同时在数据库上进行10次同时访问写入,则SQLite可能会表现良好,但是您不希望有100个用户应用程序使用SQLite不断地向数据库中写入和读取数据.它不是为这种情况而设计的,它会浪费资源.

If you are expecting to have 10 simultaneous access writing at the database at a time SQLite may perform well, but you won't want an 100 user application that constant writes and reads data to the database using SQLite. It wasn't designed for such scenario, and it will trash resources.

考虑到您的TeamSpeak场景,您可能会对SQLite感到满意,即使对于某些企业来说也可以,某些网站需要的数据库只有在添加新内容时才是只读的.

Considering your TeamSpeak scenario you are likely to be ok with SQLite, even for some business it is OK, some websites need databases that will be read only unless when adding new content.

对于这种用途,SQLite是一种廉价,易于实现,自包含的,完美的解决方案,可以完成工作.

For this kind of uses SQLite is a cheap, easy to implement, self contained, perfect solution that will get the job done.

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

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