4.0.5: Добавлен covering index для reward_configs
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m28s

This commit is contained in:
poignatov
2026-01-26 18:20:52 +03:00
parent 6bea094b7f
commit 41aed56689
4 changed files with 19 additions and 2 deletions

View File

@@ -0,0 +1,14 @@
-- Migration: Add covering index for reward_configs to optimize subtask rewards queries
-- Date: 2026-01-26
--
-- This migration adds a covering index to optimize queries that load rewards for multiple subtasks.
-- The index includes all columns needed for the query, allowing PostgreSQL to perform
-- index-only scans without accessing the main table.
--
-- Covering index for reward_configs query
-- Includes all columns needed for rewards selection to avoid table lookups
CREATE INDEX IF NOT EXISTS idx_reward_configs_task_id_covering
ON reward_configs(task_id, position)
INCLUDE (id, project_id, value, use_progression);
COMMENT ON INDEX idx_reward_configs_task_id_covering IS 'Covering index for rewards query - includes all selected columns to avoid table lookups. Enables index-only scans for better performance when loading rewards for multiple tasks.';