You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve vector storage backend for OpenViking, enabling OpenViking memory storage and retrieval through native openGauss vector tables. This PR includes an openGauss collection adapter, backend configuration support, HNSW vector index creation, metadata persistence, documentation updates, and tests for openGauss-specific behavior.
Related Issue
N/A
Type of Change
Bug fix (non-breaking change that fixes an issue)
New feature (non-breaking change that adds functionality)
Breaking change (fix or feature that would cause existing functionality to not work as expected)
Documentation update
Refactoring (no functional changes)
Performance improvement
Test update
Changes Made
Added an openGauss CollectionAdapter implementation using native SQL and the openGauss vector type.
Added support for collection lifecycle, dense vector search, scalar filtering, keyword search, fetch, upsert, delete, count, and index-related operations.
Added native HNSW physical vector index creation for openGauss.
Normalized OpenViking vector index metadata to hnsw so metadata matches the actual physical index created in openGauss.
Added support for cosine, l2, and ip distance metrics:
cosine uses vector_cosine_ops
l2 uses vector_l2_ops
ip uses vector_ip_ops
Added fail-fast behavior for physical vector index creation failures to avoid saving metadata for indexes that were not actually created.
Added openGauss backend configuration support, including host, port, user, password, database, schema, deployment mode, connection timeout, and vector column names.
Added optional dependency group for openGauss via openviking[opengauss].
Added openGauss adapter registration in the VectorDB adapter factory.
Added English and Chinese configuration documentation for the openGauss backend.
The _save_collection_meta and _save_index_meta methods use MySQL-specific ON DUPLICATE KEY UPDATE syntax, which is not compatible with openGauss (PostgreSQL-compatible). This will cause errors when saving collection and index metadata.
Replace MySQL-specific ON DUPLICATE KEY UPDATE with PostgreSQL/openGauss-compatible ON CONFLICT DO UPDATE syntax, using EXCLUDED to reference inserted values.
Why: Replaces MySQL-specific ON DUPLICATE KEY UPDATE with PostgreSQL/openGauss-compatible ON CONFLICT DO UPDATE syntax, which is critical for the adapter to work correctly.
High
Fix upsert syntax for index metadata table
Replace MySQL-specific ON DUPLICATE KEY UPDATE with PostgreSQL/openGauss-compatible ON CONFLICT DO UPDATE syntax for the index metadata table.
self._execute(
f"""
INSERT INTO {self._meta_table_ref(_INDEX_META_TABLE)}
(table_name, index_name, meta_json, updated_at)
VALUES (%s, %s, %s, CURRENT_TIMESTAMP)
- ON DUPLICATE KEY UPDATE- meta_json = VALUES(meta_json),+ ON CONFLICT (table_name, index_name) DO UPDATE SET+ meta_json = EXCLUDED.meta_json,
updated_at = CURRENT_TIMESTAMP
""",
[self.collection_key, index_name, _json_dumps(meta)],
)
Suggestion importance[1-10]: 9
__
Why: Replaces MySQL-specific ON DUPLICATE KEY UPDATE with PostgreSQL/openGauss-compatible ON CONFLICT DO UPDATE syntax for the index metadata table, which is critical for the adapter to work correctly.
Category **Suggestion ** Impact
Possible issue
Fix upsert syntax for collection metadata table Replace MySQL-specific ON DUPLICATE KEY UPDATE with PostgreSQL/openGauss-compatible ON CONFLICT DO UPDATE syntax, using EXCLUDED to reference inserted values.
Why: Replaces MySQL-specific ON DUPLICATE KEY UPDATE with PostgreSQL/openGauss-compatible ON CONFLICT DO UPDATE syntax, which is critical for the adapter to work correctly.
High
Fix upsert syntax for index metadata table Replace MySQL-specific ON DUPLICATE KEY UPDATE with PostgreSQL/openGauss-compatible ON CONFLICT DO UPDATE syntax for the index metadata table.
self._execute(
f"""
INSERT INTO {self._meta_table_ref(_INDEX_META_TABLE)}
(table_name, index_name, meta_json, updated_at)
VALUES (%s, %s, %s, CURRENT_TIMESTAMP)
- ON DUPLICATE KEY UPDATE- meta_json = VALUES(meta_json),+ ON CONFLICT (table_name, index_name) DO UPDATE SET+ meta_json = EXCLUDED.meta_json,
updated_at = CURRENT_TIMESTAMP
""",
[self.collection_key, index_name, _json_dumps(meta)],
)
Suggestion importance[1-10]: 9
__
Why: Replaces MySQL-specific ON DUPLICATE KEY UPDATE with PostgreSQL/openGauss-compatible ON CONFLICT DO UPDATE syntax for the index metadata table, which is critical for the adapter to work correctly.
High
建议里的 ON CONFLICT ... DO UPDATE 在当前 openGauss 里直接报错:syntax error at or near "CONFLICT"。
我已经改成 openGauss 可执行的 MERGE INTO,同时覆盖 collection metadata 和 index metadata 两处 upsert。
vincentsunx
changed the title
add openGauss vectordb support
vector data storage optimization
Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Improve vector storage backend for OpenViking, enabling OpenViking memory storage and retrieval through native openGauss vector tables. This PR includes an openGauss collection adapter, backend configuration support, HNSW vector index creation, metadata persistence, documentation updates, and tests for openGauss-specific behavior.
Related Issue
N/A
Type of Change
Changes Made
CollectionAdapterimplementation using native SQL and the openGauss vector type.hnswso metadata matches the actual physical index created in openGauss.cosine,l2, andipdistance metrics:cosineusesvector_cosine_opsl2usesvector_l2_opsipusesvector_ip_opsopenviking[opengauss].Testing
Tested locally on Windows with:
py_compilefor modified Python filesLoCoMo small result with openGauss +
l2+ HNSW:Token usage:
Checklist
Screenshots (if applicable)
N/A
Additional Notes
openGauss is treated as an optional backend dependency. Users need to install the optional driver when using backend: opengauss:
Example VectorDB config:
{ "backend": "opengauss", "name": "context_volcengine", "project": "default", "index_name": "default", "dimension": 1024, "distance_metric": "l2", "opengauss": { "host": "127.0.0.1", "port": 5432, "user": "omm", "password": "<password>", "db_name": "postgres", "schema": "public", "mode": "standalone", "connect_timeout": 10, "dense_vector_name": "vector", "sparse_vector_name": "sparse_vector" } }