Chapter 3: PostgreSQL Get Started

  • PostgreSQL Introduction → what it is, history, why it’s awesome
  • PostgreSQL Home → official site + PGDATA folder
  • PostgreSQL Tutorial → hands-on CREATE/INSERT/SELECT/JOIN examples
  • Install Introduction → step-by-step install on Windows/mac/Linux/Docker

Now: “PostgreSQL Get Started”

This phrase almost always points to the very first practical steps after installation — the official “Getting Started” section in the PostgreSQL documentation (right now for version 18.2).

The official docs call it: Chapter 1. Getting Started → https://www.postgresql.org/docs/current/tutorial-start.html (That’s the link you should bookmark forever!)

It has four short but gold subsections:

  1. Installation (we already covered)
  2. Architectural Fundamentals
  3. Creating a Database
  4. Accessing a Database

Today I’m going to walk you through exactly what “Get Started” means in real life — like we’re doing it together on your laptop right now. We’ll follow the official flow but make it super clear, Hyderabad-style, with exact commands, what you’ll see on screen, and tiny explanations.

Step 0: Assume PostgreSQL is already running (from our Install class)

  • Windows: service is auto-started
  • macOS (Postgres.app): app is open
  • Ubuntu: sudo systemctl status postgresql@18-main → active
  • Docker: docker ps → see your postgres:18 container running

If not running → start it now (ask if stuck!).

Test alive:

Bash

Step 1: Architectural Fundamentals (the 2-minute mental model)

PostgreSQL is not just one big file — it’s a cluster of databases managed by one server process.

Key concepts (teacher drawing on imaginary board):

  • One PostgreSQL server instance (called a “cluster”) runs on your machine
  • It can manage many databases at once (like school_db, shop_db, blog_db)
  • Every database has many schemas (default = public)
  • Schemas have tables, views, functions, etc.
  • One special database always exists: postgres (for admin tasks)
  • One superuser always exists: postgres (like root)

Think: Server (postgres process)   └── Cluster       ├── Database: postgres       ├── Database: template1 (blueprint)       ├── Database: template0 (never touch)       └── Your databases (school_db, etc.)

That’s it — no magic. Just hierarchy.

Step 2: Creating Your First Database (official 1.3 section)

Don’t work inside the default postgres database — always create your own.

Two easy ways:

Way A — Using createdb command (easiest, recommended first time)

Bash

Way B — Inside psql (what official tutorial shows)

Bash

You should see: CREATE DATABASE

Type \l (list databases) → you see my_first_db in the list!

Step 3: Accessing / Connecting to Your Database (official 1.4 section)

Now switch into it.

Bash

Inside psql you’ll see:

text

Or from inside an existing psql session:

SQL

Step 4: Your “It really works” moment — official style first commands

Now that you’re connected to my_first_db, let’s do the classic hello-world:

SQL

Expected output something like:

text

Boom! 🎉 You just:

  • Created a database
  • Connected to it
  • Created a table
  • Inserted data
  • Queried it

That’s PostgreSQL Get Started in real life.

Bonus: Useful psql meta-commands (you’ll use every day)

Command What it does Example output feeling
\l List all databases Shows your new db
\dt List tables in current database See greetings table
\d greetings Describe table structure Columns, types, constraints
\conninfo Show current connection details Host, port, user, db
\? List all meta-commands Your cheat sheet
\q Quit psql Back to terminal

Where to go next (official path + my recommendation)

Official docs continue with:

  • Simple SELECT queries
  • Creating more tables
  • INSERT / UPDATE / DELETE
  • … up to joins, aggregates, etc.

My suggestion for you right now:

  1. Create one more table → students (like we did in Tutorial class)
  2. Insert 3–4 rows with Indian names
  3. Run SELECT * FROM students ORDER BY first_name;
  4. Play with \d students and \l

If you want GUI instead of terminal:

  • Open pgAdmin 4 (installed with Windows/EDB)
  • Or download DBeaver (free, works everywhere) → connect localhost:5432, user=postgres, db=my_first_db

Tell guru what next:

  • Stuck on any command / error? Paste it!
  • Want to do first real SELECT queries with WHERE / ORDER BY?
  • How to create your own user (not just postgres superuser)?
  • Or move to backup your first db?

Your call — we’re building step-by-step! 🚀

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *