n8n AI & Database Management#
1. Database Administration#
Access the backend Postgres instance to monitor or clear AI-related data.
Access the Database#
docker exec -it n8n_postgres16 psql -U n8n -d n8nTable Inspection#
-- Count entries in knowledge base
SELECT COUNT(*) FROM n8n_knowledge_base;-- Count entries in chat history
SELECT COUNT(*) FROM n8n_chat_histories;-- View table structure
\d n8n_knowledge_base-- Preview top 20 entries
SELECT * FROM n8n_knowledge_base LIMIT 20;Maintenance (Data Deletion)#
-- Clear all chat histories
DELETE FROM n8n_chat_histories;-- Clear all knowledge base vectors
DELETE FROM n8n_knowledge_base;2. AI Agent: System Prompt (Wally)#
Copy and paste the following into the System Message field of your n8n AI Agent node.