← Oracle administration: recovery, performance, and production
08 / 19 · 115 MIN

Vector search and model migration

Assess relevance, resources, and authorization in approximate search.

Concept and mechanism

Embeddings represent content in a space produced by a model and configuration. Equal-dimensional vectors are not necessarily comparable when generated by different models. Corpus indexing and query representation must align.

Distance metric also forms part of the contract: inspect the relationship between query metric, index, and selected plan. Approximate indexes trade resources and retrieval quality for speed. An accuracy target is neither measured recall for every query nor the probability that a document is true.

Compare results with exact search on representative data and retain evaluation queries exposing difficult cases. Version the evaluation set so that later changes are compared against known expectations.

Guided application

In a fictional APS assistant, measure latency, recall, memory, build time, and maintenance before selecting an index. A ten-document experiment does not represent a large corpus or production concurrency. Authorization filters remain necessary: similarity does not grant access to runbooks outside the user scope.

When changing models, version representation, reprocess the corpus, and validate cutover and return routes. Do not change only the query model while retaining incompatible vectors. The technical manager coordinates document owners, security, and DBA teams, defining permitted data and how relevance regression will be detected without exposing confidential content. Keep quality, capacity, and access acceptance as separate checks.

Read a ranking before choosing the index

A fictional APS assistant retrieves procedures for a batch failure. The DBA receives a complaint that the list changed after a technical change. Before rebuilding the index, fix the query, corpus, filters, representation version and metric.

The small experiment uses three fabricated vectors without banking documents: [9,0,0], [1,0.3,0] and [0,1,0], compared with [1,0,0]. COSINE produces ID order 1,2,3; EUCLIDEAN produces 2,3,1. The first vector points in the query direction but is far from it in Euclidean distance.

Neither result validates a procedure’s truth or freshness. During diagnosis, separate a representation change, a calculation change and a physical access change. Only the last can be attributed directly to the optimizer’s chosen path.

Keep the query contract explicit

In the 1024-vector experiment, exact EUCLIDEAN top seven was 22,23,21,263,318,262,317. Creating the index did not change that result when the query retained its metric and FETCH EXACT. Another query omitted the metric: with the column indexed by EUCLIDEAN it returned those same IDs; after dropping the index it returned 320,319,616,22,23,321,264, matching the COSINE reference.

This observed behavior exposes an implicit contract that can surprise a team during maintenance. Record the metric in the experiment SQL and application documentation. The demonstrated rule involves a single indexed column; expressions with several columns and BINARY formats require checking their specific rules.

Dropping the index did not regenerate embeddings. The difference came from resolving the omitted metric.

Measure retrieval and identify access

The lab creates HNSW and runs approximate search using the index metric. A documented hint helps observe the path on a small dataset, but the report uses the cursor plan actually executed. The VECTOR INDEX operation with HNSW SCAN appears in the approximate run.

The exact query shows TABLE ACCESS FULL. When the query requests COSINE against the EUCLIDEAN index, the observed plan also performs a full scan and IDs match the exact COSINE reference. Both completed runs retrieved the seven EUCLIDEAN reference neighbors, giving recall@7=7/7 for this experiment.

Latency was not measured and no minimum recall was established for other queries. For an actual service, retain the evaluation set, result distribution, concurrent load and agreed acceptance criteria. A timing improvement is useful only within the defined quality commitment.

Compare within the eligible population

The synthetic dataset marks IDs divisible by three as group A. Filtering the global top seven leaves only 21 and 318. However, exact search computed within A returns seven IDs: 21,318,264,78,24,261,207.

The reproducible difference shows that operation order changes the question answered. An application presenting only two results cannot conclude that only two eligible documents exist. This label is a demonstration filter, not an authorization implementation.

In a project, security defines access policy and the DBA confirms query behavior within that population. The manager includes searches with small groups, updated documents and empty result sets in acceptance planning. Access controls must not be removed to improve a retrieval measure.

Treat inputs and resources as distinct conditions

A VECTOR(3,FLOAT32) column rejected an attempt to insert two dimensions with ORA-51803. The row was not created. A NULL input produced a NULL distance, which should not be converted into a perfect neighbor.

The first index-creation attempt instead failed for memory, not dimensions. In this Oracle Free image, the initial dynamic change was rejected and a 64 MiB reservation initialized at startup did not suffice for the attempted creation. The completed execution used a 256 MiB CDB reservation and a PDB with SGA_TARGET of 1 GiB; effective vector quota was recorded.

These values describe the disposable environment and are not sizing advice. A PDB limit does not measure bytes actually used. Consult version documentation and distinguish managed infrastructure, autonomous services and local installations before proposing commands.

Guided exercise and delivery decision

Use only an authorized disposable schema for the SQL below. First predict and confirm the three-vector order. Then create the 1024 synthetic vectors, retain exact top seven, create HNSW and collect approximate results.

Compute the ID intersection; record metric, corpus and filters. A lab administrator can collect the matching cursor plan without granting broad privileges to the application account. Also compare COSINE against the EUCLIDEAN index and top seven filtered within A.

Submit a note stating what was observed, what was not measured and which criterion would block production handover. Exact search may be an acceptable alternative for a small corpus if it meets latency and resource objectives. Measure that option’s cost; this experiment declares no universal winner.

-- Disposable Oracle 26ai schema only. CREATE SESSION, CREATE TABLE and bounded tablespace quota.
-- Lab administrator must provide a working vector pool before CREATE VECTOR INDEX.
-- No production data, external models or administrative credentials required below.

-- metric-fixture
create table metric_probe(id number primary key, embedding vector(3,float32));
insert into metric_probe values(1,'[9,0,0]');
insert into metric_probe values(2,'[1,0.3,0]');
insert into metric_probe values(3,'[0,1,0]');
insert into metric_probe values(4,null);
commit;

-- cosine-order
select id from metric_probe where embedding is not null order by vector_distance(embedding,to_vector('[1,0,0]',3,float32),cosine) fetch exact first 3 rows only;

-- euclidean-order
select id from metric_probe where embedding is not null order by vector_distance(embedding,to_vector('[1,0,0]',3,float32),euclidean) fetch exact first 3 rows only;

-- search-fixture
create table search_probe(id number primary key, allowed_group varchar2(1), embedding vector(3,float32));
insert into search_probe select level,case when mod(level,3)=0 then 'A' else 'B' end,to_vector('['||to_char(mod(level*17,997)/997,'FM0.999999999','NLS_NUMERIC_CHARACTERS=''.,''')||','||to_char(mod(level*37,991)/991,'FM0.999999999','NLS_NUMERIC_CHARACTERS=''.,''')||','||to_char(mod(level*53,983)/983,'FM0.999999999','NLS_NUMERIC_CHARACTERS=''.,''')||']',3,float32) from dual connect by level<=1024;
commit;

-- exact-before-index
select /* DR_VEC_EXACT_05 */ id from search_probe order by vector_distance(embedding,to_vector('[0.4,0.8,0.2]',3,float32),euclidean) fetch exact first 7 rows only;

-- create-hnsw
create vector index search_hnsw on search_probe(embedding) organization inmemory neighbor graph distance euclidean with target accuracy 90 parameters(type HNSW,neighbors 16,efconstruction 64);

-- approximate
select /*+ vector_index_scan(search_probe search_hnsw) */ /* DR_VEC_APPROX_05 */ id from search_probe order by vector_distance(embedding,to_vector('[0.4,0.8,0.2]',3,float32),euclidean) fetch approximate first 7 rows only with target accuracy 90;

-- cosine-reference
select id from search_probe order by vector_distance(embedding,to_vector('[0.4,0.8,0.2]',3,float32),cosine) fetch exact first 7 rows only;

-- metric-mismatch
select /*+ vector_index_scan(search_probe search_hnsw) */ /* DR_VEC_MISMATCH_05 */ id from search_probe order by vector_distance(embedding,to_vector('[0.4,0.8,0.2]',3,float32),cosine) fetch approximate first 7 rows only with target accuracy 90;

-- filtered-reference
select id from search_probe where allowed_group='A' order by vector_distance(embedding,to_vector('[0.4,0.8,0.2]',3,float32),euclidean) fetch exact first 7 rows only;

-- omitted-metric
select id from search_probe order by vector_distance(embedding,to_vector('[0.4,0.8,0.2]',3,float32)) fetch exact first 7 rows only;

-- drop-index
drop index search_hnsw;

-- omitted-after-drop
select id from search_probe order by vector_distance(embedding,to_vector('[0.4,0.8,0.2]',3,float32)) fetch exact first 7 rows only;
IN PRACTICE

Corpus with model A and query with model B: equal dimension is insufficient; compare representation and version before tuning the index.

Common pitfalls

Accuracy as truth; dimension as compatibility; relevance as permission; first test as capacity.

Related topics: Containers, services, and resources · PDB lifecycle and isolation · Backup and recovery evidence

Take this idea with you

Make metric and population explicit, compare IDs against an exact reference, confirm the plan and separate recall from operational validity.

Create account

References

Oracle® is a registered trademark of Oracle and/or its affiliates. bigsavant.com is an independent preparation platform and is not affiliated with, associated with, sponsored, authorised or endorsed by Oracle. Content and questions are original, are not official exam questions, and completing our tests does not award or guarantee any certification. Names are used only to identify the subject. All other trademarks belong to their respective owners.