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
GH-1199: Prevent timeouts with configurable batching for PgVectorStore inserts
Resolves#1199
- Implement configurable maxDocumentBatchSize to prevent insert timeouts
when adding large numbers of documents
- Update PgVectorStore to process document inserts in controlled batches
- Add maxDocumentBatchSize property to PgVectorStoreProperties
- Update PgVectorStoreAutoConfiguration to use the new batching property
- Add tests to verify batching behavior and performance
This change addresses the issue of PgVectorStore inserts timing out due to
large document volumes. By introducing configurable batching, users can now
control the insert process to avoid timeouts while maintaining performance
and reducing memory overhead for large-scale document additions.
Copy file name to clipboardExpand all lines: spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/pgvector/PgVectorStoreAutoConfiguration.java
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -71,6 +71,7 @@ public PgVectorStore vectorStore(JdbcTemplate jdbcTemplate, EmbeddingModel embed
Copy file name to clipboardExpand all lines: spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/pgvector/PgVectorStoreProperties.java
Copy file name to clipboardExpand all lines: vector-stores/spring-ai-pgvector-store/src/main/java/org/springframework/ai/vectorstore/PgVectorStore.java
+58-34Lines changed: 58 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -18,10 +18,12 @@
18
18
importjava.sql.PreparedStatement;
19
19
importjava.sql.ResultSet;
20
20
importjava.sql.SQLException;
21
+
importjava.util.ArrayList;
21
22
importjava.util.List;
22
23
importjava.util.Map;
23
24
importjava.util.Optional;
24
25
importjava.util.UUID;
26
+
importjava.util.concurrent.atomic.AtomicInteger;
25
27
26
28
importorg.postgresql.util.PGobject;
27
29
importorg.slf4j.Logger;
@@ -81,6 +83,8 @@ public class PgVectorStore extends AbstractObservationVectorStore implements Ini
Copy file name to clipboardExpand all lines: vector-stores/spring-ai-pgvector-store/src/test/java/org/springframework/ai/vectorstore/PgVectorStoreTests.java
0 commit comments