Database

Indexes

Speed up the queries your app actually runs. Create btree, hash, GIN, GiST, SP-GiST, and BRIN indexes on public tables — single-column, composite, expression, or partial.

Choosing a method

MethodGood for
btreeEquality and range queries, sorting — the default and the only unique-capable method
hashEquality-only lookups
ginjsonb containment, arrays, full-text search
gistGeometry, ranges, nearest-neighbour search
spgistPartitioned data like points and text prefixes
brinVery large tables whose physical order matches the column (e.g. timestamps)

The Indexes screen lists every index in the public schema with its method, columns or expression, uniqueness, and size on disk.

Composite, expression, and partial indexes

  • Composite: pick up to 16 columns, each with ASC/DESC and optional NULLS FIRST/LAST. Column order matters — put the most-filtered column first.
  • Expression: index a computed value, e.g. lower(email), when your queries filter on that expression.
  • Partial: add a WHERE filter, e.g. status = 'active', to index only the rows you query.
  • Unique: btree only; enforces uniqueness like a constraint.
Examples · what the Console creates
CREATE INDEX customers_plan_name ON public.customers (plan, name);

CREATE INDEX customers_email_lower ON public.customers (lower(email));

CREATE INDEX customers_active ON public.customers (owner_id)
WHERE status = 'active';

CREATE UNIQUE INDEX customers_email_unique ON public.customers (email);

Constraint-backed indexes are protected

  • Primary keys and unique constraints own their indexes. The screen marks them and refuses to drop them — dropping the index would drop the constraint’s enforcement.
  • Ordinary indexes can be dropped at any time; queries fall back to sequential scans.
  • Every index costs write speed and storage. Watch the size column and drop indexes your queries no longer use.

Additional resources