Overview
Domain 2 is the most technical part of the vector material and probably the largest block of questions. It covers how Oracle measures closeness with VECTOR_DISTANCE and its metrics (COSINE, EUCLIDEAN, EUCLIDEAN_SQUARED, DOT, MANHATTAN, HAMMING and JACCARD), the shorthand functions and operators, and how to write similarity queries. Exact search scans every candidate and returns the true nearest neighbours with FETCH EXACT.
Approximate search uses a vector index with FETCH APPROX and an optional target accuracy. You must know the two main index types: HNSW, an in-memory neighbour graph held in the vector pool, and IVF, a disk-based index that partitions vectors around centroids. The section also touches hybrid vector indexes that combine Oracle Text with vectors, memory sizing with VECTOR_MEMORY_SIZE, and checking index accuracy with DBMS_VECTOR reports.
How it's tested
Expect SQL to read and requirements to weigh. A question may show a query with FETCH APPROX and ask why the index is not used, or describe a ten-billion-row corpus with limited memory and ask which index organization fits. Metric choice questions usually tie back to how the embedding model was trained.
-
Choose the metric
A model or data type is described, and you select the distance metric that matches, such as cosine for normalized text embeddings or Hamming for binary vectors.
-
Exact or approximate
A requirement for complete, correct results or for speed at scale decides between FETCH EXACT and FETCH APPROX with a target accuracy.
-
HNSW or IVF
Memory limits, dataset size and query latency goals point to the in-memory neighbour graph or to neighbour partitions on disk.
A team has 2 billion product vectors and a database with little spare SGA. HNSW keeps its graph in the vector pool, so it needs memory proportional to the data, which they lack. IVF stores partitions on disk and probes only the closest centroids at query time. The question expects IVF, with NEIGHBOR PARTITIONS set at creation and probes tuned for accuracy.
Topics 4
Official topics from the Oracle outline, in outline order.
2.1 Select vector distance metricsVECTOR_DISTANCE metrics and shorthand functions.
- What it means
- VECTOR_DISTANCE(v1, v2, metric) returns how far apart two vectors are. Supported metrics include COSINE (the default), EUCLIDEAN and EUCLIDEAN_SQUARED, DOT (returned as a negative dot product so smaller means closer), MANHATTAN, HAMMING and JACCARD. Shorthand functions and operators such as COSINE_DISTANCE, L2_DISTANCE and <=> express the same calculations.
- What to understand
- Pick the metric the embedding model was trained for. Cosine compares direction and suits most text models; Euclidean measures straight-line gap; dot product suits normalized vectors and is fast. Hamming and Jaccard apply to BINARY vectors. Because every metric returns smaller values for closer items, similarity queries order ascending, which surprises people used to similarity scores.
- How it shows up
- A model card or vector format is described and you must name the matching metric or the right shorthand operator.
- Common confusion
- Ordering by distance descending; Oracle distances are smaller for more similar vectors, including the negated dot product.
2.2 Perform exact and approximate similarity searchFETCH EXACT, FETCH APPROX, target accuracy and filtered search.
- What it means
- Exact search computes the distance to every candidate row and returns the true top-k with ORDER BY VECTOR_DISTANCE and FETCH EXACT FIRST k ROWS ONLY. Approximate search uses a vector index with FETCH APPROX FIRST k ROWS ONLY and can request WITH TARGET ACCURACY, trading a little recall for large speed gains.
- What to understand
- Exact search is right for small tables, ground-truth testing and cases where every true neighbour must be returned. Approximate search is the normal choice at scale. Relational filters can be combined with vector search in one statement, and multi-vector queries can return the best chunks per document with FETCH FIRST n PARTITIONS BY.
- How it shows up
- A query is shown and you identify whether it can use the index, or which clause guarantees exact results.
- Common confusion
- Assuming FETCH APPROX always returns approximate rows; without a usable index Oracle falls back to an exact scan.
2.3 Create and tune HNSW and IVF vector indexesNeighbour graph and neighbour partition indexes.
- What it means
- CREATE VECTOR INDEX builds either an in-memory neighbour graph (HNSW) with ORGANIZATION INMEMORY NEIGHBOR GRAPH or a neighbour partition index (IVF) with ORGANIZATION NEIGHBOR PARTITIONS. Each index records a DISTANCE metric and a TARGET ACCURACY, plus parameters such as NEIGHBORS and EFCONSTRUCTION for HNSW or NEIGHBOR PARTITIONS for IVF.
- What to understand
- HNSW lives in the vector pool of the SGA, offers very fast and accurate searches, and needs memory sized for the data. IVF is stored on disk, clusters vectors around centroids found by k-means, and probes the nearest partitions, so it scales past memory. A query only uses the index when its distance metric matches the index metric.
- How it shows up
- Scenarios weigh memory, dataset size and latency, then ask which ORGANIZATION clause or parameter to change.
- Common confusion
- Thinking IVF needs the vector pool; HNSW is the in-memory organization, IVF partitions live on disk.
2.4 Manage vector memory, accuracy and hybrid indexesVECTOR_MEMORY_SIZE, accuracy reports and hybrid vector indexes.
- What it means
- HNSW indexes need the vector pool, sized with the VECTOR_MEMORY_SIZE parameter, and DBMS_VECTOR offers an advisor to estimate the memory an index will use. Accuracy can be measured with DBMS_VECTOR.INDEX_ACCURACY_QUERY. A hybrid vector index joins an Oracle Text index and a vector index so one query can blend keyword and semantic relevance.
- What to understand
- Undersized vector memory blocks HNSW creation, so check sizing before blaming syntax. Accuracy reports compare approximate results with exact ones, which is how you justify a TARGET ACCURACY value. Hybrid search through DBMS_HYBRID_VECTOR.SEARCH helps when users type product codes or rare terms that embeddings handle poorly but keywords match exactly.
- How it shows up
- Expect a question about why an HNSW index failed to build, or which feature combines keyword and vector relevance.
- Common confusion
- Treating hybrid vector indexes as a separate product; they combine Oracle Text and vector search in the same database.
High-yield concepts
The terms, rules and formulas this domain turns into questions most often.
-
VECTOR_DISTANCE
Function returning the distance between two vectors for a chosen metric.
- Remember
- Smaller result means more similar.
- Tested as
- Every similarity query.
- Trap
- Sorting descending.
-
COSINE metric
Compares the angle between vectors.
- Remember
- Default metric and common for text embeddings.
- Tested as
- Metric choice questions.
- Trap
- Using it on binary vectors.
-
DOT metric
Negative dot product so smaller means closer.
- Remember
- Suits normalized embeddings.
- Tested as
- Metric and operator questions.
- Trap
- Forgetting the negation.
-
HAMMING and JACCARD
Metrics for BINARY vectors.
- Remember
- Hamming counts differing bits.
- Tested as
- Binary format scenarios.
- Trap
- Pairing binary data with Euclidean.
-
FETCH EXACT
Forces exact nearest-neighbour search.
- Remember
- Returns the true top-k at higher cost.
- Tested as
- Accuracy-critical queries.
- Trap
- Assuming it uses the vector index.
-
FETCH APPROX with TARGET ACCURACY
Approximate search through a vector index.
- Remember
- Falls back to exact if no matching index.
- Tested as
- Performance questions.
- Trap
- Expecting index use with a mismatched metric.
-
HNSW index
In-memory neighbour graph organization.
- Remember
- Needs vector pool memory from VECTOR_MEMORY_SIZE.
- Tested as
- Low-latency scenarios.
- Trap
- Choosing it when memory is scarce.
-
IVF index
Neighbour partitions built around k-means centroids.
- Remember
- Disk-based; scales beyond memory.
- Tested as
- Very large corpus scenarios.
- Trap
- Thinking it requires the vector pool.
-
NEIGHBORS and EFCONSTRUCTION
HNSW build parameters for graph links and candidate list size.
- Remember
- Higher values raise accuracy and build cost.
- Tested as
- Tuning questions.
- Trap
- Confusing them with IVF partition settings.
-
Index metric match
Query metric must equal the index DISTANCE.
- Remember
- Mismatch means the optimizer ignores the index.
- Tested as
- Troubleshooting slow queries.
- Trap
- Changing the query metric without rebuilding.
-
Hybrid vector index
Combines Oracle Text keyword and vector similarity.
- Remember
- Queried through DBMS_HYBRID_VECTOR.SEARCH.
- Tested as
- Rare-term and code lookups.
- Trap
- Treating it as only a text index.
-
Multi-vector search
Returns top chunks per document with PARTITIONS BY.
- Remember
- Stops one document flooding the results.
- Tested as
- Chunked document scenarios.
- Trap
- Using DISTINCT instead.
Side by side
Concepts candidates mix up, compared on the point that decides the answer.
HNSW vs. IVF vector indexes
| Concept | Meaning | Key difference | Common trap |
|---|---|---|---|
| HNSW | In-memory neighbour graph | Fastest, needs vector pool memory | Building it with too little VECTOR_MEMORY_SIZE |
| IVF | Neighbour partitions on disk | Scales past memory, probes nearest centroids | Expecting HNSW-level latency |
| No index | Full scan of candidates | Exact results, slow at scale | Assuming FETCH APPROX fails without an index |
Distance metrics
| Concept | Meaning | Key difference | Common trap |
|---|---|---|---|
| COSINE | Angle between vectors | Ignores magnitude | Using it for binary data |
| EUCLIDEAN | Straight-line distance | Sensitive to magnitude | Mixing it with a cosine-trained model |
| DOT | Negative inner product | Fast on normalized vectors | Sorting descending |
| HAMMING | Count of differing bits | For BINARY vectors only | Using it on FLOAT32 data |
Exact vs. approximate search
| Concept | Meaning | Key difference | Common trap |
|---|---|---|---|
| FETCH EXACT | Compares against every candidate | Always the true neighbours | Using it for latency-sensitive production queries |
| FETCH APPROX | Uses a vector index if available | Speed with configurable accuracy | Forgetting it can silently fall back to exact |
Exam traps
Each trap is an answer that looks right. Learn the clue that should change your mind.
-
Bigger distance is better
- What candidates pick
- Sort by VECTOR_DISTANCE descending to get the best matches.
- Why it looks right
- Similarity scores usually rank high first.
- Why it's wrong
- Oracle returns distances, where closer vectors have smaller values, so the best matches come first in ascending order.
Clue to watch for The query orders by VECTOR_DISTANCE.
-
Any metric uses the index
- What candidates pick
- Query with EUCLIDEAN against a COSINE index and expect index use.
- Why it looks right
- The index exists on the column.
- Why it's wrong
- The optimizer only uses a vector index when the query metric matches the index DISTANCE clause.
Clue to watch for Two different metric names appear in the scenario.
-
IVF lives in memory
- What candidates pick
- Increase VECTOR_MEMORY_SIZE to fix an IVF index.
- Why it looks right
- Vector pool settings sound relevant to every vector index.
- Why it's wrong
- The vector pool serves HNSW graphs; IVF partitions are stored on disk like other index structures.
Clue to watch for ORGANIZATION NEIGHBOR PARTITIONS in the DDL.
-
Approximate is always faster
- What candidates pick
- Add FETCH APPROX to a query and expect index speed.
- Why it looks right
- The clause names approximate search.
- Why it's wrong
- Without a matching vector index the database performs an exact scan, so the clause alone gives no speed gain.
Clue to watch for No CREATE VECTOR INDEX is mentioned.
-
Text search handles codes badly too
- What candidates pick
- Rely on embeddings alone for part numbers and error codes.
- Why it looks right
- Semantic search seems strictly better.
- Why it's wrong
- Embeddings blur exact tokens; a hybrid vector index adds keyword matching so rare identifiers still rank correctly.
Clue to watch for Users search for SKUs, codes or exact names.
-
Cosine for binary vectors
- What candidates pick
- Apply COSINE distance to a BINARY column.
- Why it looks right
- Cosine is the default.
- Why it's wrong
- Binary vectors are compared with Hamming or Jaccard, which count bit differences or overlap.
Clue to watch for The column format is BINARY.
Answer framework
Work through a vector search or indexing scenario in this order to land on the answer Oracle expects.
- Match the distance metric to the embedding model and storage format, such as cosine for text or Hamming for binary.
- Decide whether the requirement demands the true top-k with no misses, which means FETCH EXACT, or speed at scale, which means FETCH APPROX.
- Compare data size with available memory: HNSW when the graph fits in the vector pool, IVF when it does not.
- Check that the index DISTANCE and the query metric agree, otherwise the index will not be used.
- Tune with evidence: run accuracy reports, adjust TARGET ACCURACY or build parameters, and add a hybrid index for exact-term needs.
Practice question
Want more like this? The 1Z0-1159-26 practice test has questions for every domain.
Checklist
0 of 12
Tick each one you can do without notes. Your ticks stay in this browser.
Study strategy
Give this section the most hours. Begin by memorising the metric list with one line each, then prove the ordering rule to yourself: compute VECTOR_DISTANCE for a few hand-made vectors with COSINE, EUCLIDEAN and DOT, and watch which comes first in ascending order.
Next, load a few thousand embedded rows and run the same top-10 query with FETCH EXACT and with FETCH APPROX. Build an HNSW index after setting VECTOR_MEMORY_SIZE, check the execution plan, then drop it and build an IVF index instead. Change the query metric so it no longer matches and confirm in the plan that the index is ignored. That one experiment answers several common question types.
Then run an accuracy report and adjust TARGET ACCURACY to see the recall and latency trade-off. Read the hybrid vector index chapter once so you can say when keyword plus vector beats either alone. Close with timed practice sets focused on index choice, since those scenarios are wordy and reward a fixed decision order. Track every wrong answer by cause: metric, memory, index type or fallback.
FAQ
How much of 1Z0-1159-26 is Domain 2, Apply Vector Distance and Indexing?
Oracle publishes no section weights. Third-party practice banks give this distance and indexing section more items than any other, so plan to spend the most study time here.
What is the default distance metric?
COSINE is the default for VECTOR_DISTANCE and for vector indexes when no metric is given. Choose another metric when the embedding model expects it.
When should I pick HNSW over IVF?
Pick HNSW when the graph fits in the vector pool and you need the lowest latency. Pick IVF when the data is too large for memory.
Why does my FETCH APPROX query run slowly?
Usually there is no vector index, or the query metric differs from the index DISTANCE. In both cases Oracle runs an exact scan.
What does TARGET ACCURACY control?
It sets the recall you want from approximate search. Higher values search more of the index and return closer to exact results, at more cost.
What is a hybrid vector index?
An index that combines Oracle Text keyword search with vector similarity, queried through DBMS_HYBRID_VECTOR, so exact terms and meaning both influence ranking.
Can I filter vector search with normal SQL predicates?
Yes. Vector search runs inside SQL, so WHERE clauses, joins and partitioning work together with ORDER BY VECTOR_DISTANCE.
Other Artificial Intelligence & Machine Learning certifications
Where the same subject shows up in other exams. Cards marked "Same subject" open the matching domain.
Test your Domain 2 knowledge
You have worked through distance metrics, exact and approximate search, HNSW and IVF indexes, vector memory and hybrid indexes. Test your index and metric choices against timed questions.
Keep going
- Training Training Built on your Weak areas
- Practice test Questions by domain, with explanations
- Mock exam Full length, timed like the real exam
- Readiness test Find your weakest domain in minutes
- Cheat sheet Key terms and formulas on one page
- Ask the 1Z0-1159-26 AI tutor Get any concept explained your way