Index Management
Indexes are a key technique for improving database query performance. By creating indexes on frequently queried fields, you can significantly improve query speed and user experience.
How to Create Indexes
- Go to the CloudBase Console / PostgreSQL Database
- Navigate to Index Management: select the target table and click the Index Management tab
- Manage indexes: create, delete, or modify index configurations
PostgreSQL Index Types
PostgreSQL provides a variety of index types suitable for different query scenarios:
| Index Type | Description | Use Cases |
|---|---|---|
| B-tree | Default index type, supports equality and range queries | Most common query scenarios: =, <, >, BETWEEN, ORDER BY, etc. |
| Hash | Hash index, supports equality queries only | Exact match scenarios only |
| GIN | Generalized Inverted Index | JSONB field queries, array containment queries, full-text search |
| GiST | Generalized Search Tree | Geometric data, full-text search, range types, nearest-neighbor queries |
| BRIN | Block Range Index | Large sequential data tables (e.g., time-series data), very small storage footprint |
tip
For detailed explanations and creation syntax for each index type, refer to the PostgreSQL Official Documentation - Indexes.