# Batch Qdrant inserts and retry Postgres table creation

> Agno's Qdrant insert and async_insert now send upserts of batch_size points, and PostgresDb retries table creation after a failed attempt.

- Published: 2026-11-17
- Author: 电大老baby
- Categories: Changelog
- Canonical: https://www.agno.com/blog/batch-qdrant-inserts-and-retry-postgres-table-creation
- Markdown: https://www.agno.com/blog/batch-qdrant-inserts-and-retry-postgres-table-creation.md

Agno's `Qdrant.insert` now sends upserts of `batch_size` points, so a large document stays under the Qdrant server's request-size limit, and `async_insert` takes the same argument. Before, `insert` accepted `batch_size` and still sent every point in one `upsert`.

```python
vector_db.insert(content_hash=content_hash, documents=documents, batch_size=100)
```

We inserted five documents with `batch_size=2` into an in-memory `QdrantClient`, using a fake embedder as a stand-in for a real embedding model, and counted the upsert calls:

```text
Before: upsert calls: 1 sizes: [5]
Now:    upsert calls: 3 sizes: [2, 2, 1]
```

`PostgresDb` and `AsyncPostgresDb` could not recover from a failed table creation. The instance kept the broken table definition, and every later call on it failed even after the database was fixed. A composite type named `agno_sessions` blocked the first `upsert_session` on an embedded Postgres. Then the script dropped the type and called the same instance again:

```text
Before: retry -> InvalidRequestError: Table 'ai.agno_sessions' is already defined for this MetaData instance.
Now:    retry -> saved
```

`AsyncPostgresDb` showed the same before and after.

See the [cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/07_knowledge/05_integrations/vector_dbs/01_qdrant.py), and learn more about [Qdrant](https://docs.agno.com/knowledge/vector-stores/qdrant/overview) and [PostgreSQL](https://docs.agno.com/database/providers/postgres/overview) in the documentation.
