Skip to main content
Version: V1.4.0

REFRESH (DBMS_INDEX_MANAGER)

Description​

Starting in seekdb V1.3.0, HNSW vector indexes use asynchronous maintenance by default. The REFRESH procedure ensures that vector data written asynchronously becomes visible in approximate search according to asynchronous index visibility rules.

The REFRESH procedure waits for Change Stream consumption progress to advance on the tenant-level asynchronous vector index pipeline. This makes writes committed before the call retrievable by approximate search with APPROXIMATE/APPROX according to asynchronous vector index visibility rules.

Whether the wait completes depends on the current backlog and write pressure. If you do not call REFRESH, new writes are generally visible in approximate search within milliseconds.

Privilege requirements​

No additional privileges are required to execute CALL dbms_index_manager.refresh();.

Syntax​

CALL dbms_index_manager.refresh();

Parameters​

This procedure has no input parameters.

Behavior​

  • Applies to vector indexes of type HNSW / HNSW_SQ / HNSW_BQ on heap tables with sync_mode=async.
  • After execution, data committed to the main table remains immediately readable by ordinary SELECT. Whether approximate search with APPROXIMATE/APPROX returns hits depends on asynchronous index visibility.
  • INSERT: After commit, the main table is immediately readable. On the approximate search path, visibility is generally within milliseconds. To participate in approximate search as soon as possible after a write, call this procedure at the appropriate point in your application logic.
  • DELETE: After the delete commits, the row no longer appears in approximate search results.
  • UPDATE on a vector column: Approximate search follows the asynchronous index. The new vector is generally retrievable within milliseconds.

Limitations and considerations​

  • Under high write pressure, this procedure may block for a long time. A common pattern is to call it once after a batch of INSERT/UPDATE commits, rather than after every statement.

Examples​

Example 1: Approximate search soon after a write​

CREATE TABLE t_async (
id INT PRIMARY KEY,
vec VECTOR(4),
VECTOR INDEX idx_vec(vec) WITH (type=hnsw, distance=l2, sync_mode=async)
);

INSERT INTO t_async VALUES (1, '[1,0,0,0]');

CALL dbms_index_manager.refresh();

SELECT id
FROM t_async
ORDER BY l2_distance(vec, '[1,0,0,0]') APPROXIMATE
LIMIT 1;

Example 2: Refresh after a batch of writes​

INSERT INTO t_async VALUES (2, '[0,1,0,0]');
INSERT INTO t_async VALUES (3, '[0,0,1,0]');

CALL dbms_index_manager.refresh();

Example 3: Heap table with scalar columns, refresh after asynchronous writes​

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
c1 INT,
c2 VECTOR(3),
c3 VARCHAR(256),
PRIMARY KEY (c1),
VECTOR INDEX idx1(c2) WITH (distance=l2, type=hnsw, lib=vsag, sync_mode=async)
) ORGANIZATION HEAP;

INSERT INTO t1 VALUES (16, '[1.0, 2.0, 3.0]', 'seekdb 1.0');
INSERT INTO t1 VALUES (17, '[1.1, 2.1, 3.1]', 'seekdb 1.1');
INSERT INTO t1 VALUES (18, '[1.2, 2.2, 3.3]', 'seekdb 1.2');

CALL dbms_index_manager.refresh();

SELECT c1, c3
FROM t1
ORDER BY l2_distance(c2, '[100, 100, 100]') APPROXIMATE
LIMIT 5;

FAQ​

Q: Why can I not find my write in approximate search right away? A: The asynchronous index is still catching up. Run CALL dbms_index_manager.refresh(); before querying. If you do not call it, visibility delay is generally within milliseconds and increases with write pressure.

Q: How is this different from DBMS_VECTOR.REFRESH_INDEX? A: REFRESH_INDEX performs incremental index maintenance and structural optimization. dbms_index_manager.refresh only ensures that committed writes are visible on the asynchronous vector index path for approximate search. The two procedures have different semantics.

Q: What does REFRESH_SCN (or the refresh position in the view) being 0 mean? A: It means the refresh position has not advanced or is not initialized. For details, see DBA_OB_CHANGE_STREAM_REFRESH_STAT.

References​