Skip to content

Conversation

cedrickrusche
Copy link

This pull request updates the metadata column type from JSON to JSONB in the PGVector table creation logic.

📌 Motivation

The LangChain documentation recommends using the JSONB type for metadata storage due to its performance and indexing advantages. However, the current implementation defaults to JSON, which does not align with this guidance.

✅ Changes

Replaces:

query += f""",\n"{metadata_json_column}" JSON"""

with

query += f""",\n"{metadata_json_column}" JSONB"""

📎 Notes

This change does not affect existing tables.

@averikitsch
Copy link
Collaborator

Thank you @cedrickrusche for the PR. The JSON data type has faster insertion performance. We recommend that any metadata that should be indexed and filtered on to be specified as specific "metadata_columns" for even better performance than using JSONB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants