[PGVector] Unnecessary columns queried leads to high latency #84

Open
opened 2026-02-16 05:16:29 -05:00 by yindo · 1 comment
Owner

Originally created by @JoshuaPostel on GitHub (Jul 24, 2025).

https://github.com/langchain-ai/langchain-postgres/blob/18b1bcdb75ed152da717e3d624e1ed822d17d60f/langchain_postgres/vectorstores.py#L1419-L1432

This query returns the embedding column which is expensive to deserialize into a python object and AFAICT is not used downstream. From my observations benchmarking against an equivalent query without the embedding column, this costs ~150ms (1024 dimension vector, k=30).

Originally created by @JoshuaPostel on GitHub (Jul 24, 2025). https://github.com/langchain-ai/langchain-postgres/blob/18b1bcdb75ed152da717e3d624e1ed822d17d60f/langchain_postgres/vectorstores.py#L1419-L1432 This query returns the embedding column which is expensive to deserialize into a python object and AFAICT is not used downstream. From my observations benchmarking against an equivalent query without the embedding column, this costs ~150ms (1024 dimension vector, k=30).
Author
Owner

@averikitsch commented on GitHub (Aug 8, 2025):

The new PGVectorStore interface includes this improvement.

@averikitsch commented on GitHub (Aug 8, 2025): The new PGVectorStore interface includes this improvement.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langchain-postgres#84