Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt

Use this file to discover all available pages before exploring further.

Migration: 20260121000000_performance_indexes_phase2.sql
Date: 2026-01-21
Status: Production ✅ | Staging ✅ COMPLETE

Deployment Summary

Production ✅ COMPLETE

  • Status: ✅ Successfully deployed via MCP
  • Date: 2026-01-21
  • Indexes Created: 13 indexes (4 date range, 3 multi-column, 5 sort, 1 search)

Staging ✅ COMPLETE

  • Project ID: bcuftbeczbudndukafbc
  • Status: ✅ Successfully deployed via CLI
  • Date: 2026-01-21
  • Indexes Created: 13 indexes (4 date range, 3 multi-column, 5 sort, 1 search)

Deploy to Staging

# Link to staging
supabase link --project-ref bcuftbeczbudndukafbc

# Apply the migration
supabase migration up --version 20260121000000

# Or push all pending migrations
supabase db push

# Verify deployment
supabase migration list

Option 2: Using Supabase Dashboard

  1. Navigate to: Supabase project dashboard
  2. Go to: SQL Editor
  3. Copy and paste the SQL from: supabase/migrations/20260121000000_performance_indexes_phase2.sql
  4. Execute the SQL
  5. Verify indexes were created

Option 3: Using Migration Apply Tool

If you have access to staging MCP connection:
mcp_supabase_apply_migration({
  name: "performance_indexes_phase2",
  query: "<SQL from migration file>"
})

Verification Queries

After deploying to staging, run these queries to verify:
-- Check if indexes exist
SELECT 
    schemaname,
    relname as tablename,
    indexrelname,
    idx_scan,
    pg_size_pretty(pg_relation_size(indexrelid)) as index_size
FROM pg_stat_user_indexes
WHERE schemaname = 'public'
    AND indexrelname IN (
        'idx_rh_schedule_instances_org_date',
        'idx_rh_attendance_records_org_schedule',
        'idx_hr_leave_requests_org_start_date',
        'idx_gr_audits_org_scheduled_date',
        'idx_gr_audits_org_created_desc',
        'idx_it_tickets_org_created_desc',
        'idx_hr_leave_requests_org_created_desc',
        'idx_rh_episodes_org_created_desc',
        'idx_fm_work_orders_org_created_desc',
        'idx_it_tickets_org_subject'
    )
ORDER BY indexrelname;
Expected Result: 10+ indexes should be listed

Indexes Created

Date Range Queries (4 indexes)

  • idx_rh_schedule_instances_org_date
  • idx_rh_attendance_records_org_schedule
  • idx_hr_leave_requests_org_start_date
  • idx_gr_audits_org_scheduled_date

Multi-Column Filters (3 indexes - conditional)

  • idx_it_tickets_org_site_status (if site_id exists)
  • idx_rh_episodes_org_site_status (if site_id exists)
  • idx_fm_work_orders_org_site_status (if site_id exists)

Sort Optimization (5 indexes)

  • idx_gr_audits_org_created_desc
  • idx_it_tickets_org_created_desc
  • idx_hr_leave_requests_org_created_desc
  • idx_rh_episodes_org_created_desc
  • idx_fm_work_orders_org_created_desc

Search Optimization (1 index)

  • idx_it_tickets_org_subject

Configuration Updated

config.toml updated with correct staging project ID: bcuftbeczbudndukafbc

Next Steps

  1. Deploy to Staging using one of the methods above
  2. Verify indexes using the verification query
  3. Monitor performance after 1 week
  4. Check index usage to ensure indexes are being utilized

Last Updated: 2026-01-21