SQLite vs PostgreSQL
When comparing SQLite vs PostgreSQL, the Slant community recommends PostgreSQL for most people. In the question“What are the best databases to use for Node.js applications?” PostgreSQL is ranked 1st while SQLite is ranked 8th. The most important reason people chose PostgreSQL is:
PostgreSQL performance increases with each release, this is also proven by many benchmark tests. Notable performance features include: * As PostgreSQL only supports one storage engine, it has been able to integrate and optimise it and with the rest of the database. This has resulted in multiple benefits such as the ability to allow different transaction types to co-exist efficiently without the need to select storage engine types once for each table ahead of time. * On the fly data compression resulting in less IO required for reading. * Asynchronous + synchronous Replication. * PostgreSQL supports a asynchronous API for use by client applications. It is reported to increase performance by up to 40% and is not supported by MySQL. * Designed to scale very well with large numbers of cores at high concurrency levels.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Small
SQLite is also only 350KiB in size.
Pro Great language support
SQLite has bindings for a large number of programming languages, including BASIC, Delphi, C, C#, C++, Clipper//Harbour, Common Lisp, Curl, D, Free Pascal, Haskell, Java, JavaScript, Livecode, Lua, newLisp, Objective-C (on OS X and iOS), OCaml, Perl, PHP, Pike, PureBasic, Python, R, REALbasic, REBOL, Ruby, Scheme, Smalltalk, Tcl, Visual Basic.
Pro Self-contained
SQLite is largely self-contained. It requires very minimal support from external libraries or from the operating system.
Pro Portable
An SQLite database is a single ordinary disk file that can be located anywhere in the directory hierarchy. It works by sending requests to a single file where all the data is kept instead of communicating with a hosted database which gives access to an interface by making use of sockets and ports. The file format used is also cross-platform, so can easily be migrated to various machines.
This makes SQLite extremely portable throughout different applications, all that's needed to transfer the whole database is to make a copy of the file.
Pro Great for testing and first stages of development
Because of it's ability to scale and with the portability that a single-file database gives you without losing much of the power and features that SQL gives developers, it's a great choice for testing applications and for the early stages of development when the workload and the data that needs to be stored is not that large.
Pro Not unnecessarily fiddly
Pro Reliable
With less complication, there is less to go wrong.
Pro Zero configuration
There is literally no configuration required to get SQL lite up and running. This is mainly due to SQLite being serverless, there is no separate server process to install, setup, configure, initialize, manage, and troubleshoot.
Pro High performance
PostgreSQL performance increases with each release, this is also proven by many benchmark tests.
Notable performance features include:
As PostgreSQL only supports one storage engine, it has been able to integrate and optimise it and with the rest of the database. This has resulted in multiple benefits such as the ability to allow different transaction types to co-exist efficiently without the need to select storage engine types once for each table ahead of time.
On the fly data compression resulting in less IO required for reading.
Asynchronous + synchronous Replication.
PostgreSQL supports a asynchronous API for use by client applications. It is reported to increase performance by up to 40% and is not supported by MySQL.
Designed to scale very well with large numbers of cores at high concurrency levels.
Pro Fully ACID compliant
PostgreSQL is known to have a very holistic approach to robustness and data integrity which is reflected by it being fully ACID compliant.
PostgreSQL has always been strict about making sure data is valid before allowing it into the database, and there is no way for a client to bypass those checks.
Depending on your requirements, ACID compliance might be important.
Pro Strong community
PostgreSQL has a strong community backing it, with guides, tutorials and support for any kind of problem a developer may have.
Pro Support for JSON data type
JSON data can be stored as a column with optional indexes. In 9.4 (upcoming at the time of this writing), JSONB will be a binary version of JSON that will save space. It's like the best of the NO-SQL world without having to give up ACID and Relationships. This means that cascading deletes can be done in a single Transaction across multiple JSON documents.
Pro Actively developed
Regular fixes and features are released
Pro Support for geographic objects
PostgreSQL can be extended to have geographic object support through PostGIS and allows for location queries to be run through SQL.
Pro Multiple node packages available
There are many packages (like Sequelize) that integrate deeply with the features Postgres offers.
Pro Support Perl and Python for coding stored procedures
Postgres supports popular languages for coding stored procedures, such as Perl and Python. So, you can fairly easy transform just DB-server to reliable Service with complex business logic.
Pro Open Source, powerful and on par with other paid RDBMS'
It is a powerful, open source product that has all the bells and whistles when compared with its costly, proprietary counterparts.
Cons
Con No multi user
Lacks multi-user capabilities, see SQLite vs. MySQL vs. PostgreSQL: A Comparison of Relational Databases.
Also see: Appropriate Uses For SQLite.
Con Some SQL features are missing
SQLite is made to be extremely lightweight and portable, but it still uses SQL. However, some SQL features such as RIGHT OUTER JOIN
and FOR EACH STATEMENT
are missing.
Con Not suited for small apps
Because of it's complexity and power, it may be an overkill to use PostgreSQL in small applications that will not make use of it's full power.