-- Search upgrade: trigram-based fuzzy matching + brand/country filters. -- pg_trgm and the product.name GIN index already exist (see 0001). Add a -- matching trigram index on brand.name so brand filtering / fuzzy brand -- lookups can use an index instead of a sequential scan. CREATE INDEX IF NOT EXISTS idx_brand_name_trgm ON brand USING gin (name gin_trgm_ops); -- country_of_origin is filtered by exact/prefix match; a plain btree index -- keeps that cheap as the catalog grows. CREATE INDEX IF NOT EXISTS idx_product_country ON product (country_of_origin);