CREATE INDEX IF NOT EXISTS entities_type_canonical_idx ON entities (entity_type, canonical_name, id) WHERE tombstoned_at IS NULL; CREATE INDEX IF NOT EXISTS entities_status_canonical_idx ON entities (status, canonical_name, id) WHERE tombstoned_at IS NULL; CREATE INDEX IF NOT EXISTS entity_relations_source_entity_idx ON entity_relations (source_entity_id, relation_type, target_entity_id); CREATE INDEX IF NOT EXISTS entity_relations_target_entity_idx ON entity_relations (target_entity_id, relation_type, source_entity_id); CREATE INDEX IF NOT EXISTS entity_facts_freshness_idx ON entity_facts (entity_id, valid_until, field_name, observed_at DESC);