</>
Skip to content
PostgreSQL lessons (34/38)

PostgreSQL — Extensions

What are Extensions?

Extensions add functionality to PostgreSQL.

List Extensions

SELECT * FROM pg_extension;

Enable Extension

-- UUID generation
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

-- Full text search
CREATE EXTENSION IF NOT EXISTS "pg_trgm";

-- UUID v4
CREATE EXTENSION IF NOT EXISTS "pgcrypto";

Common Extensions

ExtensionDescription
uuid-osspUUID generation
pg_trgmTrigram similarity
pgcryptoCryptographic functions
postgisGeospatial data
hstoreKey-value store
pg_stat_statementsQuery statistics

Disable Extension

DROP EXTENSION "uuid-ossp";

Extension Usage

-- Generate UUID
SELECT uuid_generate_v4();

-- Trigram search
SELECT * FROM products WHERE name % 'phone';

Mini Practice

  1. List extensions
  2. Enable an extension
  3. Use extension functions
  4. Disable an extension

Up Next

Continue with Roles — user roles.

Related Topics

Frequently Asked Questions about Extensions

What is Extensions in PostgreSQL?

Extensions is a fundamental concept in PostgreSQL. This lesson explains it step by step with clear examples, making it easy for beginners to understand.

How do I learn Extensions?

Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Extensions.

Why is Extensions important in PostgreSQL?

Extensions is essential for PostgreSQL development. Understanding this concept will help you write better code and solve real-world problems more effectively.