Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
Oracle · Agentic AI for Oracle AI Database Professional

HNSW Indexes and the Vector Pool

Agentic AI for Oracle AI Database Professional · Lesson 6 of 20 · 42:06

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the Agentic AI for Oracle AI Database Professional exam (1Z0-1159-26). In this lesson: vector index types, the HNSW graph and its parameters (NEIGHBORS, EFCONSTRUCTION, EFSEARCH), sizing the vector pool, and how HNSW handles inserts, updates, and restarts. Follows Ambergate Appliances, a fictional appliance maker. Includes three original practice questions.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

Milliseconds, not seconds

Ambergate's repair assistant now searches forty million chunks, and an exact search takes several seconds for each question. The team wants answers in milliseconds, and it is ready to trade a little accuracy for that speed. This lesson covers vector indexes, the HNSW index, the memory it lives in, and how it handles changes to the data.

Vector indexes

A vector index speeds up similarity search by looking at only part of the vectors, so the search becomes approximate. Oracle AI Vector Search has two families: in memory neighbor graph indexes, which means HNSW, and neighbor partition indexes, which means IVF. A vector column can have only one vector index, and all its vectors must have the same number of dimensions. Vector indexes are not supported on some objects, like index organized tables, global temporary tables, or materialized views.

HNSW

HNSW stands for Hierarchical Navigable Small World. It builds a graph of vectors in layers: the top layers are sparse and allow long jumps, and the bottom layer holds every vector, linked to its close neighbors. A search enters at the top, moves toward the query vector layer by layer, then explores the neighbors in the bottom layer. It gives very fast searches with high accuracy, but the whole graph must fit in memory.

Create an HNSW index

You create it with create vector index, and the organization in memory neighbor graph clause. Distance sets the metric, which is cosine when you leave it out, and target accuracy sets the default accuracy of searches, as a percentage. The optional parameters set neighbors, the maximum number of links for each vector, and EFCONSTRUCTION, the number of candidates considered while building: higher values give better quality, but slower builds and more memory. At query time, a similar setting, EFSEARCH, controls how widely each search explores the graph.

The vector pool

HNSW indexes stay entirely in memory, in the vector pool, an area of the system global area. You size it with the VECTOR_MEMORY_SIZE parameter: at the container level it sets the size of the pool, and in a pluggable database it sets a maximum. A rough estimate of an HNSW index is 1.3 times the number of vectors, times the dimensions, times the bytes per value. The INDEX_VECTOR_MEMORY_ADVISOR procedure helps you size it, and the V$VECTOR_MEMORY_POOL view shows what is used. On Autonomous AI Database Serverless, the pool grows and shrinks on its own.

Changes to the data

An HNSW graph is hard to change in place, so changes to the table go through journals. Each transaction keeps its changes in a private journal, and committed changes go to a shared journal, which searches read along with the graph, so they still see the new rows. In the background, the database builds a new snapshot of the graph, incrementally or in full, when enough changes pile up. And checkpoints save the graph to disk, so it can be reloaded quickly after a restart, instead of being rebuilt.

Recap

Let's recap. A vector index makes similarity search approximate and fast, with two families, HNSW and IVF, and one vector index per column. HNSW is a graph in layers, searched from the top down, fast and accurate when it fits in memory. Neighbors and EFCONSTRUCTION shape the graph at build time, and EFSEARCH widens each search. The index sits in the vector pool, sized with VECTOR_MEMORY_SIZE, with an advisor and a view to help. And changes go through private and shared journals, snapshots refresh the graph, and checkpoints speed up reloads.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. Ambergate rebuilt its HNSW index with much higher values for NEIGHBORS and EFCONSTRUCTION. What should the team expect?

    • Better quality, a slower build, more memory
    • A faster build that needs less memory
    • Exact results on every single search
    • The index switches to the IVF type
    Show the answer

    Better quality, a slower build, more memory

    More links and more candidates give a better graph, at the cost of a slower build and more memory. “A faster build that needs less memory” is the opposite, since higher values add work and links. “Exact results on every single search” is wrong, because an index search stays approximate, whatever its settings. And “The index switches to the IVF type” is wrong, since these are HNSW parameters, and the index type stays the same.

  2. On Ambergate’s own database server, an HNSW index of 50 million vectors fails to build with a memory error, although the table is fine. What should the administrator look at first?

    • The temporary tablespace
    • The size of the vector pool
    • The number of table partitions
    • The distance metric of the index
    Show the answer

    The size of the vector pool

    An HNSW index sits entirely in the vector pool, so the pool must be large enough, and VECTOR_MEMORY_SIZE controls it. “The temporary tablespace” matters most when building IVF indexes, which use temporary space heavily. “The number of table partitions” is not the cause, since HNSW memory depends on the vectors, not on partitions. And “The distance metric of the index” changes how distances are computed, not how much memory the graph needs.

  3. Ambergate’s database restarts every weekend for patching, and rebuilding its large HNSW graph from scratch takes too long each time. Which feature shortens the reload?

    • A private journal for each transaction
    • A higher target accuracy
    • An IVF index instead of HNSW
    • HNSW checkpoints on disk
    Show the answer

    HNSW checkpoints on disk

    A checkpoint saves the graph to disk, so the index is reloaded from it after a restart, instead of being rebuilt. “A private journal for each transaction” only holds the changes of one transaction. “A higher target accuracy” affects the accuracy of searches, not how the graph comes back. And “An IVF index instead of HNSW” replaces the index type, which is a much bigger change than the problem needs.