Getting Started
This page follows the idea of the official PostgreSQL Tutorial – Getting started: first connection and basic operations.
What is PostgreSQL?
PostgreSQL is an open-source relational database supporting SQL, ACID, complex queries, foreign keys, triggers, views, stored procedures, and many extensions. See the official preface for more.
Install and start
- Binary: See Chapter 16 – Installation.
- Source: See Chapter 17 – Installation from Source.
After installation, start the server and ensure the default port (5432) and pg_hba.conf allow your client.
First connection
Using psql or any PostgreSQL client (e.g. DBeaver, pgAdmin):
bash
psql -h localhost -p 5432 -U postgres -d postgresBasic example
sql
CREATE DATABASE mydb;
-- In psql: \c mydb
CREATE TABLE users (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
created_at TIMESTAMPTZ DEFAULT now()
);
INSERT INTO users (name) VALUES ('Alice'), ('Bob');
SELECT * FROM users;For more SQL and administration, use the official documentation and our PostgreSQL Docs Overview.
