Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres Chat Memory Node Returns Full Table Instead of Limited Context Window #12958

Open
mdaviesnz opened this issue Jan 30, 2025 · 1 comment
Labels
in linear Issue or PR has been created in Linear for internal review

Comments

@mdaviesnz
Copy link

Bug Description

I am encountering an issue with the Postgres Chat Memory node in n8n where the query to the PostgreSQL database does not respect the "Context Window Length" setting. Despite setting this value to a low number, the query retrieves the full table rather than limiting the amount of historical chat data being returned.
This issue significantly impacts performance when using persistent chat memory, as the full history is unnecessarily loaded.

To Reproduce

  1. Configure the Postgres Chat Memory node in a workflow.
  2. Set "Context Window Length" to a low number (e.g., 5 or 10).
  3. Use a fixed session key to ensure chat memory persists across sessions.
  4. Observe the query execution and response time.
  5. Check the node output and see that all rows are being returned instead of only the expected limited number.

Expected behavior

The query should retrieve only the specified number of recent chat history entries based on the "Context Window Length" setting, improving performance and reducing response time.

Operating System

Docker Image: docker.n8n.io/n8nio/n8n

n8n Version

1.76.1

Node.js Version

20.18.2

Database

PostgreSQL

Execution mode

main (default)

@Joffcom
Copy link
Member

Joffcom commented Jan 30, 2025

Hey @mdaviesnz,

We have created an internal ticket to look into this which we will be tracking as "GHC-678"

@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

No branches or pull requests

2 participants