Postgres Record Manager
The Postgres Record Manager node is used to keep track of document writes into vector databases. It utilizes PostgreSQL to store and manage records of document insertions, updates, and deletions. This node is particularly useful for maintaining the state of documents across different runs or sessions, enabling incremental updates and efficient management of large document collections.
Node Details
-
Name: postgresRecordManager
-
Type: Postgres RecordManager
-
Version: 1.0
-
Category: Record Manager
Parameters
Input Parameters
-
Host (string, required)
- The hostname of the PostgreSQL server
-
Database (string, required)
- The name of the database to connect to
-
Port (number, optional)
-
The port number for the PostgreSQL server
-
Default: 5432
-
-
Additional Connection Configuration (JSON, optional)
- Additional configuration options for the PostgreSQL connection
-
Table Name (string, optional)
-
The name of the table to use for storing records
-
Default: “upsertion_records”
-
-
Namespace (string, optional)
-
A namespace for the records
-
If not specified, the chatflowid will be used
-
-
Cleanup (options, optional)
-
Specifies the cleanup method for old content
-
Options:
-
None: No cleanup of old content
-
Incremental: Delete previous versions if content has changed
-
Full: Same as incremental, but also deletes records if source document is deleted
-
-
Default: “none”
-
-
SourceId Key (string, optional)
-
Key used to get the true source of the document
-
Default: “source”
-
Credential Parameters
-
User: PostgreSQL username
-
Password: PostgreSQL password
Functionality
The PostgresRecordManager provides the following main functions:
-
createSchema(): Creates the necessary table and indexes in the database if they don’t exist.
-
update(keys, updateOptions): Updates or inserts records for the given keys.
-
exists(keys): Checks if records exist for the given keys.
-
listKeys(options): Lists keys based on specified options (before, after, limit, groupIds).
-
deleteKeys(keys): Deletes records for the given keys.
-
end(): Terminates the database connection.
Usage
This node is typically used in workflows where you need to keep track of document insertions, updates, or deletions in a vector database. It’s particularly useful for:
-
Incremental updates to vector stores
-
Tracking which documents have been processed
-
Managing document versions
-
Implementing cleanup strategies for outdated embeddings
By using PostgreSQL as the backend, it provides a robust and scalable solution for managing record metadata in large-scale vector database operations.
Note
Ensure that you have the necessary PostgreSQL credentials and permissions set up before using this node. The node will automatically create the required table and indexes if they don’t exist in the specified database.