0
0
Supabasecloud~5 mins

Why Postgres powers Supabase

Choose your learning style9 modes available
Introduction

Postgres is a strong, reliable database that helps Supabase store and manage data safely and quickly.

When you need a database that supports many types of data and complex queries.
When you want your app to handle lots of users and data without slowing down.
When you want to use open-source tools that are widely trusted and supported.
When you want easy integration with Supabase features like authentication and real-time updates.
When you want a database that can grow with your app from small to large scale.
Syntax
Supabase
CREATE TABLE table_name (
  column_name data_type PRIMARY KEY,
  other_column data_type
);

This is a simple example of creating a table in Postgres.

Postgres uses SQL language to manage data.

Examples
This creates a users table with an auto-incrementing id, a name, and a unique email.
Supabase
CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  name TEXT NOT NULL,
  email TEXT UNIQUE NOT NULL
);
This fetches all data for the user with the specified email.
Supabase
SELECT * FROM users WHERE email = 'user@example.com';
Sample Program

This example creates a tasks table, adds one task, and then retrieves all tasks.

Supabase
CREATE TABLE tasks (
  id SERIAL PRIMARY KEY,
  title TEXT NOT NULL,
  completed BOOLEAN DEFAULT FALSE
);

INSERT INTO tasks (title) VALUES ('Learn Supabase');

SELECT * FROM tasks;
OutputSuccess
Important Notes

Postgres supports many data types like text, numbers, dates, and JSON.

Supabase uses Postgres to provide real-time data updates and easy API access.

Postgres is open-source, so it has a large community and many tools.

Summary

Postgres is the database behind Supabase because it is reliable and powerful.

It supports complex data and scales well for apps of all sizes.

Supabase builds on Postgres to offer easy-to-use backend services.