-- 047: matching companion to sql/045 — awarded_value DESC NULLS LAST index.
--
-- Problem: /achizitii/cauta?sort=value_desc was ~3.5s. Same root cause as
-- sql/045: existing `idx_ann_value btree (awarded_value)` defaults to
-- ASC NULLS LAST, so ORDER BY awarded_value DESC NULLS LAST cannot use it
-- (NULLS ordering mismatch). Planner did Seq Scan + top-N heap sort over
-- 781K rows.
--
-- Fix: composite-direction index matching the exact ORDER BY clause.
--
-- Measurements (production):
--   Before: 1284ms (Seq Scan + Sort)
--   After:  0.4ms (Index Scan + LIMIT)
--
-- Existing idx_ann_value is kept for the value_asc sort case.

CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_ann_value_desc_nl
  ON seap.announcements (awarded_value DESC NULLS LAST);
