All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m44s
15 lines
651 B
SQL
15 lines
651 B
SQL
-- Migration: Optimize task queries with composite index
|
|
-- Date: 2026-01-24
|
|
--
|
|
-- This migration adds a composite index to optimize the task detail query:
|
|
-- WHERE id = $1 AND user_id = $2 AND deleted = FALSE
|
|
--
|
|
-- The index uses a partial index with WHERE deleted = FALSE to reduce index size
|
|
-- and improve query performance for active (non-deleted) tasks.
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_tasks_id_user_deleted
|
|
ON tasks(id, user_id, deleted)
|
|
WHERE deleted = FALSE;
|
|
|
|
COMMENT ON INDEX idx_tasks_id_user_deleted IS 'Composite index for optimizing task detail queries with id, user_id, and deleted filter. Partial index for non-deleted tasks only.';
|