What is PostgreSQL? The open-source database behind serious apps
Every app you use keeps its data somewhere: accounts, orders, messages, prices. That “somewhere” is a database. PostgreSQL, often just called Postgres, is one of the most trusted databases in the world, free and open source, and the choice of many teams that cannot afford to lose a single order.
What is PostgreSQL in one sentence?
PostgreSQL is a free, open-source relational database: it stores data in tables of rows and columns, links those tables together, and lets you ask questions of the data in SQL.
Where did PostgreSQL come from?
It began in 1986 as the POSTGRES project at the University of California, Berkeley. SQL support was added in the mid-1990s, and the project took the name PostgreSQL. Since then it has been built by a worldwide community of developers rather than one company, with a new major version every year. PostgreSQL 16 was released in September 2023.
What makes PostgreSQL different?
- Reliability: it follows the ACID rules, so a transaction is either saved completely or not at all. An order is never half-written, even if the server loses power.
- Many users at once: its MVCC design lets readers and writers work at the same time without waiting for each other.
- More than tables: it stores JSON documents (JSONB), arrays and full-text search natively, so one database can do the work of several.
- Extensions: PostGIS adds maps and locations, and other extensions add new data types and indexes.
- Standards: it follows the SQL standard closely, so what you learn carries over.
- A free licence: the PostgreSQL License lets you use it in any project, commercial or not, at no cost.
What does PostgreSQL look like in practice?
A table of products and a question about it:
CREATE TABLE products (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
price_iqd INTEGER NOT NULL,
details JSONB
);
INSERT INTO products (name, price_iqd, details)
VALUES ('Leather bag', 45000, '{"colour": "brown", "sizes": ["M", "L"]}');
SELECT name, price_iqd
FROM products
WHERE details->>'colour' = 'brown'
ORDER BY price_iqd;
The last query reads a field inside the JSON column as easily as a normal column. That mix of strict tables and flexible documents is one of the reasons developers like Postgres.
PostgreSQL or MySQL: which should I choose?
Both are excellent and free. MySQL is simple and very common on shared hosting. PostgreSQL is usually chosen when the data is more complex, when you need JSON, geography or advanced queries, or when strict correctness matters most. For a new project with real business data, many teams start with PostgreSQL.
Who uses PostgreSQL?
It runs behind apps of every size, from small startups to large platforms such as Instagram and Reddit, which have written publicly about using it. It is also offered as a managed service by all the major clouds.
How do I start learning PostgreSQL?
- Install it from the official site, postgresql.org, or run it in Docker.
- Use the
psqlcommand line or a visual tool such as pgAdmin. - Learn the basics of SQL first:
SELECT,INSERT,UPDATE,JOIN. - Build something small and real, such as a table of your shop’s products and orders.
At Watad Nexus we build websites and apps on databases like PostgreSQL, designed so your data stays correct and safe as your business grows. Talk to us about your project.