Search documentation of phoenix_kit

# PhoenixKit.Migrations.Postgres.V21 (phoenix_kit v1.6.19)

View Source

PhoenixKit V21 Migration: Optimize Message ID Search Performance

This migration adds a composite index on (message_id, aws_message_id) to optimize the dual message ID search pattern used throughout the email system.

## Changes

### Email System Performance Optimization

- Adds composite index on (message_id, aws_message_id) for faster lookups
- Improves performance of AWS SES event correlation
- Optimizes message ID search queries used in SQSProcessor and EmailLog

## Background

The email system uses a dual message ID architecture:

- `message_id`: Internal PhoenixKit ID (pk_ prefix) - primary identifier
- `aws_message_id`: AWS SES ID - secondary identifier for AWS event correlation

This composite index enables fast searches when querying either field or both, which is critical for processing AWS SES events and correlating them with email logs.

## PostgreSQL Support

- Supports PostgreSQL prefix for schema isolation
- Uses efficient B-tree index for string matching
- Backward compatible with existing data

# Summary

## Functions

down(opts)

Rollback the V21 migration.

up(opts)

Run the V21 migration to add composite message ID index.

# Functions

# down(opts)

Rollback the V21 migration.

# up(opts)

Run the V21 migration to add composite message ID index.