<p>I recently read this Question about <a href="https://stackoverflow.com/questions/3630/sqlite-vs-mysql">SQLite vs MySQL</a> and the answer pointed out that SQLite doesn't scale well and the official website <a href="http://www.sqlite.org/whentouse.html" rel="noreferrer">sort-of confirms this</a>, however.</p>

<p>How scalable is SQLite and what are its upper most limits?</p>

[{'answer_id': 55012, 'author': 'Joel Coehoorn', 'author_id': 3043, 'author_profile': 'https://Stackoverflow.com/users/3043', 'pm_score': 5, 'selected': False, 'text': '<p>Sqlite is a <em>desktop</em> or <em>in-process</em> database.  SQL Server, MySQL, Oracle, and their brethren are <em>servers</em>.</p>\n\n<p>Desktop databases are by their nature not a good choices for <em>any</em> application that needs to support concurrent write access to the data store.  This includes at some level most web sites ever created. If you even have to log in for anything, you probably need write access to the DB.</p>\n'}, {'answer_id': 62123, 'author': 'Lasse V. Karlsen', 'author_id': 267, 'author_profile': 'https://Stackoverflow.com/users/267', 'pm_score': 6, 'selected': False, 'text': "<p>Sqlite is scalable in terms of single-user, I have multi-gigabyte database that performs very well and I haven't had much problems with it.</p>\n\n<p>But it <em>is</em> single-user, so it depends on what kind of scaling you're talking about.</p>\n\n<p>In response to comments. Note that there is nothing that prevents using an Sqlite database in a multi-user environment, but every transaction (in effect, every SQL statement that modifies the database) takes a lock on the <em>file</em>, which will prevent other users from accessing the database <em>at all</em>.</p>\n\n<p>So if you have lots of modifications done to the database, you're essentially going to hit scaling problems very quick. If, on the other hand, you have lots of read access compared to write access, it might not be so bad.</p>\n\n<p>But Sqlite will of course <em>function</em> in a multi-user environment, but it won't <em>perform</em> well.</p>\n"}, {'answer_id': 62220, 'author': 'Kyle Cronin', 'author_id': 658, 'author_profile': 'https://Stackoverflow.com/users/658', 'pm_score': 10, 'selected': True, 'text': '<p>Yesterday I released a small site<sup>*</sup> to track your rep that used a shared SQLite database for all visitors. Unfortunately, even with the modest load that it put on my host it ran quite slowly. This is because the entire database was locked every time someone viewed the page because it contained updates/inserts. I soon switched to MySQL and while I haven\'t had much time to test it out, it seems much more scaleable than SQLite. I just remember slow page loads and occasionally getting a database locked error when trying to execute queries from the shell in sqlite. That said, I am running another site from SQLite just fine. The difference is that the site is static (i.e. I\'m the only one that can change the database) and so it works just fine for concurrent reads. Moral of the story: only use SQLite for websites where updates to the database happen rarely (less often than every page loaded).</p>\n\n<p><strong>edit</strong>: I just realized that I may not have been fair to SQLite - I didn\'t index any columns in the SQLite database when I was serving it from a web page. This partially caused the slowdown I was experiencing. However, the observation of database-locking stands - if you have particularly onerous updates, SQLite performance won\'t match MySQL or Postgres.</p>\n\n<p><strong>another edit:</strong> Since I posted this almost 3 months ago I\'ve had the opportunity to closely examine the scalability of SQLite, and with a few tricks it can be quite scalable. As I mentioned in my first edit, database indexes dramatically reduce query time, but this is more of a general observation about databases than it is about SQLite. However, there is another trick you can use to speed up SQLite: <a href="http://www.sqlite.org/lang_transaction.html" rel="noreferrer">transactions</a>. Whenever you have to do multiple database writes, put them inside a transaction. Instead of writing to (and locking) the file each and every time a write query is issued, the write will only happen once when the transaction completes.</p>\n\n<p>The site that I mention I released in the first paragraph has been switched back to SQLite, and it\'s running quite smoothly once I tuned my code in a few places.</p>\n\n<p><sup>* the site is no longer available</sup></p>\n'}, {'answer_id': 66724, 'author': 'peregrine', 'author_id': 376422, 'author_profile': 'https://Stackoverflow.com/users/376422', 'pm_score': 2, 'selected': False, 'text': "<p>Think of it this way. SQL Lite will be locked every time someone uses it (SQLite doesn't lock on reading). So if your serving up a web page or a application that has multiple concurrent users only one could use your app at a time with SQLLite. So right there is a scaling issue. If its a one person application say a Music Library where you hold hundreds of titles, ratings, information, usage, playing, play time then SQL Lite will scale beautifully holding thousands if not millions of records(Hard drive willing)</p>\n\n<p>MySQL on the other hand works well for servers apps where people all over will be using it concurrently. It doesn't lock and it is quite large in size. So for your music library MySql would be over kill as only one person would see it, UNLESS this is a shared music library where thousands add or update it. Then MYSQL would be the one to use.</p>\n\n<p>So in theory MySQL scales better then Sqllite cause it can handle mutiple users, but is overkill for a single user app.</p>\n"}, {'answer_id': 692873, 'author': 'jle', 'author_id': 41713, 'author_profile': 'https://Stackoverflow.com/users/41713', 'pm_score': 1, 'selected': False, 'text': "<p>SQLite's website (the part that you referenced) indicates that it can be used for a variety of multi-user situations.</p>\n\n<p>I would say that it can handle quite a bit.  In my experience it has always been very fast.  Of course, you need to index your tables and when coding against it, you need to make sure you use parameritized queries and the like.  Basically the same stuff you would do with any database to improve performance.</p>\n"}, {'answer_id': 827194, 'author': 'Sam', 'author_id': 92551, 'author_profile': 'https://Stackoverflow.com/users/92551', 'pm_score': 5, 'selected': False, 'text': '<p>Have you read this SQLite docs - <a href="http://www.sqlite.org/whentouse.html" rel="noreferrer">http://www.sqlite.org/whentouse.html</a> ?</p>\n\n<blockquote>\n  <p>SQLite usually will work great as the\n  database engine for low to medium\n  traffic websites (which is to say,\n  99.9% of all websites). The amount of web traffic that SQLite can handle\n  depends, of course, on how heavily the\n  website uses its database. Generally\n  speaking, any site that gets fewer\n  than 100K hits/day should work fine\n  with SQLite. The 100K hits/day figure\n  is a conservative estimate, not a hard\n  upper bound. SQLite has been\n  demonstrated to work with 10 times\n  that amount of traffic.</p>\n</blockquote>\n'}, {'answer_id': 1654135, 'author': 'Ice', 'author_id': 124675, 'author_profile': 'https://Stackoverflow.com/users/124675', 'pm_score': 2, 'selected': False, 'text': "<p>i think that a (in numbers 1) webserver serving hunderts of clients appears on the backend with a single connection to the database, isn't it?</p>\n\n<p>So there is no concurrent access in the database an therefore we can say that the database is working in 'single user mode'. It makes no sense to diskuss multi-user access in such a circumstance and so SQLite works as well as any other serverbased database.</p>\n"}, {'answer_id': 3553696, 'author': 'MPelletier', 'author_id': 210916, 'author_profile': 'https://Stackoverflow.com/users/210916', 'pm_score': 3, 'selected': False, 'text': '<p>SQLite scalability will highly depend on the data used, and their format. I\'ve had some tough experience with extra long tables (GPS records, one record per second). Experience showed that SQLite would slow down in stages, partly due to constant rebalancing of the growing binary trees holding the indexes (and with time-stamped indexes, you just <em>know</em> that tree is going to get rebalanced a lot, yet it is vital to your searches). So in the end at about 1GB (very ballpark, I know), queries become sluggish in my case. Your mileage will vary.</p>\n\n<p>One thing to remember, despite all the bragging, SQLite is NOT made for data warehousing. There are various uses <a href="http://sqlite.org/whentouse.html" rel="nofollow noreferrer">not recommended</a> for SQLite. The fine people behind SQLite say it themselves:</p>\n\n<blockquote>\n  <p>Another way to look at SQLite is this: SQLite is not designed to replace Oracle. It is designed to replace fopen().</p>\n</blockquote>\n\n<p>And this leads to the main argument (not quantitative, sorry, but qualitative), SQLite is not for all uses, whereas MySQL can cover many varied uses, even if not ideally. For example, you could have MySQL store Firefox cookies (instead of SQLite), but you\'d need that service running all the time. On the other hand, you could have a transactional website running on SQLite (as many people do) instead of MySQL, but expect a lot of downtime.</p>\n'}, {'answer_id': 4451455, 'author': 'Jay Godse', 'author_id': 33890, 'author_profile': 'https://Stackoverflow.com/users/33890', 'pm_score': 5, 'selected': False, 'text': '<p>SQLite drives the sqlite.org web site and others that have lots of traffic. They suggest that if you have <a href="http://www.sqlite.org/whentouse.html">less than 100k</a> hits per day, SQLite should work fine. And that was written before they delivered the "Writeahead Logging" feature.  </p>\n\n<p>If you want to speed things up with SQLite, do the following:</p>\n\n<ul>\n<li>upgrade to SQLite 3.7.x</li>\n<li>Enable <a href="http://www.sqlite.org/draft/releaselog/3_7_0.html">write-ahead logging</a></li>\n<li>Run the following pragma: "PRAGMA cache_size = Number-of-pages;" The default size (Number-of-pages) is 2000 pages, but if you raise that number, then you will raise the amount of data that is running straight out of memory. </li>\n</ul>\n\n<p>You may want to take a look at my video on YouTube called "<a href="http://www.youtube.com/watch?v=hRu86mcRk5Y">Improve SQLite Performance With Writeahead Logging</a>" which shows how to use write-ahead logging and demonstrates a 5x speed improvement for writes. </p>\n'}]
['https://Stackoverflow.com/questions/54998', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/383/']