## PostgreSQLDocumentStore


PostgreSQL-backed document store with pgvector.


Usage


``` python
PostgreSQLDocumentStore(
    connection_string,
    embedding_dimension=1536,
)
```


## Parameters


`connection_string: str`  
Database connection string.

`embedding_dimension: int = ``1536`  
Dimensionality of embedding vectors.


## Methods

| Name | Description |
|----|----|
| [create_ivfflat_index()](#create_ivfflat_index) | Create an IVFFlat index for approximate search. |
| [retrieve_nearest_neighbors()](#retrieve_nearest_neighbors) | Retrieve documents using nearest neighbor search. |
| [upsert_with_embeddings()](#upsert_with_embeddings) | Insert or update documents with precomputed embeddings. |
| [vacuum_analyze_table()](#vacuum_analyze_table) | Run VACUUM ANALYZE on the document table. |

------------------------------------------------------------------------


#### create_ivfflat_index()


Create an IVFFlat index for approximate search.


Usage


``` python
create_ivfflat_index(num_lists=100)
```


------------------------------------------------------------------------


#### retrieve_nearest_neighbors()


Retrieve documents using nearest neighbor search.


Usage


``` python
retrieve_nearest_neighbors(embedding, top_k=10)
```


------------------------------------------------------------------------


#### upsert_with_embeddings()


Insert or update documents with precomputed embeddings.


Usage


``` python
upsert_with_embeddings(docs, embeddings)
```


------------------------------------------------------------------------


#### vacuum_analyze_table()


Run VACUUM ANALYZE on the document table.


Usage


``` python
vacuum_analyze_table()
```
