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
| Extension | Description |
|---|---|
| uuid-ossp | UUID generation |
| pg_trgm | Trigram similarity |
| pgcrypto | Cryptographic functions |
| postgis | Geospatial data |
| hstore | Key-value store |
| pg_stat_statements | Query 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
- List extensions
- Enable an extension
- Use extension functions
- 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.