Files
mcp-outline-postgresql/migrations

Database Migrations

This directory contains optional database migrations for improving MCP Outline PostgreSQL performance.

Index Migration (001_indexes.sql)

This migration creates recommended indexes to improve query performance.

Before Running

  1. Backup your database - Always backup before applying migrations
  2. Review the indexes - Some may already exist in your Outline installation
  3. Test in staging - Apply to a staging environment first

Running the Migration

# Connect to your Outline database
psql -d outline -f migrations/001_indexes.sql

# Or via DATABASE_URL
psql $DATABASE_URL -f migrations/001_indexes.sql

Index Categories

Category Tables Impact
Documents documents 10-100x faster searches and listings
Memberships collection_users, group_users, user_permissions 10x faster permission checks
Events events 5-20x faster audit log queries
User Interaction stars, pins, views 5x faster bookmark/view queries
Full-text Search documents (GIN) Dramatically faster text search

Checking Index Usage

After applying, verify indexes are being used:

-- Check if indexes exist
SELECT indexname, tablename
FROM pg_indexes
WHERE indexname LIKE 'idx_%'
ORDER BY tablename, indexname;

-- Check index usage statistics
SELECT
  schemaname,
  tablename,
  indexname,
  idx_scan as times_used,
  idx_tup_read,
  idx_tup_fetch
FROM pg_stat_user_indexes
WHERE indexname LIKE 'idx_%'
ORDER BY idx_scan DESC;

Removing Indexes

If you need to remove specific indexes:

DROP INDEX IF EXISTS idx_documents_search;
-- etc.

MCP Outline PostgreSQL | Descomplicar® | 2026