n8n Database Nodes: PostgreSQL, MySQL & Google Sheets Operations
⚡ n8n Workflow Automation T3 · Database Integration Nodes
n8n Database Nodes: PostgreSQL, MySQL & Google Sheets Operations

n8n’s database nodes bring the full spectrum of data operations into visual workflows — PostgreSQL and MySQL each provide 6 distinct actions (Select, Insert, Update, Delete, Upsert, Execute SQL) with parameterized queries; Google Sheets supports 10+ sheet and document operations through Service Account authentication; and Airtable offers 5 CRUD operations plus a dedicated trigger node for real‑time record changes. This guide covers the configuration, operation sets, connection details, and production patterns for each node. [1]

6
Postgres Actions [2]
6
MySQL Actions [3]
10+
Google Sheets Operations [4]
5
Airtable CRUD Operations [5]
Node Actions Default Port Auth Method Best For
Postgres Select, Insert, Update, Delete, Upsert, Execute SQL 5432 Credentials (user/password) Production pipelines, queue mode, heavy analytics
MySQL Select, Insert, Update, Delete, Insert or Update (upsert), Execute SQL 3306 Credentials (user/password) Web apps, legacy LAMP stacks, CRM sync
Google Sheets Create, Delete, Append, Update, Clear, Get Rows, Append or Update Row N/A Service Account (OAuth2) Dashboards, lightweight reporting, team collaboration
Airtable Append, Delete, List, Read, Update + Trigger N/A Personal Access Token No-code databases, content ops, project tracking

How do you configure the n8n PostgreSQL node and use its six actions?

The PostgreSQL node provides 6 distinct actions that cover the full spectrum of database operations: Select, Insert, Update, Delete, Upsert, and Execute SQL. Configure it by adding a Postgres node to the canvas, creating credentials with your host, port (default 5432), database name, user, and password, then selecting the operation and schema/table. The node wraps node-postgres (pg) under the hood. [2] [6]

The Execute SQL action supports parameterized queries using numbered placeholders ($1, $2, ...) in the Query Parameters field. The Upsert action requires a “Column to Match On” — typically a unique key like id or email — and generates an ON CONFLICT statement that inserts new rows or updates matched rows in a single database call. For production, create a dedicated database user with minimal permissions, enable SSL if connecting to cloud databases, and use the “Execute in Batches” option on large data volumes to fetch records in chunks rather than loading all into memory. LISTEN/NOTIFY support is available for real‑time event‑driven workflows via the dedicated Postgres Trigger node. For scaling patterns with queue mode and connection pooling, see the n8n Scaling & Queue Configuration guide.

What operations does the n8n MySQL node support, and how does upsert work?

The MySQL node provides 6 actions: Select, Insert, Update, Delete, Insert or Update (upsert), and Execute SQL. Credentials require the host, port (default 3306), database, user, and password. The node uses the mysql2 package; create a dedicated MySQL user with only the permissions your workflows require — never use root credentials in production. [3] [7]

The Insert or Update (upsert) operation requires specifying a unique key column. When a new row arrives, MySQL inserts it; when the key already exists, MySQL updates the existing row with the new values. The “Columns to Match On” field determines which column serves as the unique key. A known caveat with query parameters in the MySQL node: null values may be converted to empty strings unless the “Replace Empty Strings with NULL” option is enabled; additionally, you cannot reuse the same $N parameter placeholder twice in a single query. For advanced upsert logic, the community node MySQLExtend adds an Upsert operation with explicit conflict‑handling configuration. Common patterns include logging webhook events to a MySQL audit table, syncing inventory between e‑commerce platforms and the database, and scheduled cleanup of old records. For a detailed production pipeline walkthrough, see the n8n for Data Pipelines guide.

How does the n8n Google Sheets node handle document and sheet operations?

The Google Sheets node supports 10+ operations organized into two tiers. Document operations: Create and Delete spreadsheets. Sheet‑Within‑Document operations: Append Row (create a new row), Append or Update Row (upsert‑style: append a new row or update if it exists), Update Row, Get Row(s), Clear, Create, Delete, and Delete Rows or Columns. Authentication uses a Google Service Account with domain‑wide delegation. [4]

The Append or Update Row operation functions as a spreadsheet‑native upsert: n8n appends a new row if the row does not exist, or updates the current one if it already exists, matching on a specified key column. For reporting dashboards, combine multiple data sources into one sheet by running parallel branches each writing to a separate tab. The node’s Get Row(s) operation can retrieve all rows in a sheet and feed them into a Code or Set node for transformation before forwarding to a database node or notification channel. For production, the community node n8n-nodes-service-account-google-sheets provides additional spreadsheet-level operations (Create, Get) beyond the native node’s capabilities. For complete bidirectional sync patterns between Google Sheets and Postgres that use a Schedule Trigger, fetch rows from both sides, compare, and push only changed records, see the ETL pipeline automation guide.

How do you use the n8n Airtable node for CRUD operations and triggers?

The Airtable node provides 5 CRUD operations: Append (add rows), Delete (remove rows), List (read all rows), Read (retrieve a record by ID), and Update (modify existing rows). Authentication uses a Personal Access Token with specific scopes configured in the Airtable developer hub. A dedicated Airtable Trigger node watches for record changes, firing workflows on new, updated, or deleted records. [5]

The Append operation maps workflow data to Airtable columns using the field names configured in the node. The Read operation requires a Record ID or a Filter By Formula expression (e.g., {Status}="Pending") to narrow results. For bidirectional sync between a database and Airtable, pattern the workflow so that a database trigger feeds into the Airtable node for create/ update, while the Airtable Trigger feeds back into the database node for the reverse direction. The community node @vwork-digital/n8n-nodes-instant-airtable-trigger extends the native Airtable Trigger with webhook‑based instant notifications instead of polling. For integrating Airtable into complete content operations and project tracking automations, see the n8n Support Nodes guide.

How do you use upsert operations and parameterized queries across database nodes?

Upsert — a single atomic operation that inserts a new row or updates an existing one — is available on both the Postgres node (Upsert action) and the MySQL node (Insert or Update action). Both require specifying a unique key column to match on. Postgres implements upsert via the native ON CONFLICT clause; MySQL uses INSERT ... ON DUPLICATE KEY UPDATE. For Google Sheets, the Append or Update Row operation provides spreadsheet‑native upsert. [2] [3]

The Execute SQL action on both Postgres and MySQL supports parameterized queries using numbered placeholders ($1, $2, ...) configured in the Query Parameters field. Each parameter maps to a value that n8n substitutes before execution, protecting against SQL injection. A known limitation: the Postgres node reassigns $N placeholders by order of appearance rather than passing them through to Postgres natively, and you cannot reuse a parameter number twice in the same query. For high‑volume upsert workloads, combine the Upsert action with the “Execute in Batches” option on Postgres or MySQL nodes to process records in chunks of 100–500 rows, or use the SplitInBatches node to control batch granularity. When the data source is an API, first transform the payload with a Set node to match database column names before feeding it into the upsert node. For comprehensive error handling around bulk upserts and retry logic, see the n8n Error Handling guide.

⚡ Upsert Quick Reference: Postgres: Use “Upsert” action, set “Column to Match On” to your unique key (usually id or email). MySQL: Use “Insert or Update” action, same key column approach. Google Sheets: Use “Append or Update Row” with a key column. All three approaches eliminate the need for separate SELECT‑then‑INSERT/UPDATE logic in your workflows. [2]

How do you build production ETL pipelines by combining Google Sheets, Postgres, and MySQL?

A production ETL pipeline chains a Schedule Trigger (hourly or daily) → Source node (Google Sheets Get Rows, Postgres Select, or MySQL Select) → Set node (normalize column names and data types) → IF/Switch node (route by record type or status) → Destination node (Postgres Upsert, MySQL Insert or Update, or Google Sheets Append). For large datasets, pair Postgres or MySQL with “Execute in Batches” to chunk source records. [2] [8]

For bidirectional sync between Google Sheets and a database, the pattern compares data from both sides: fetch all rows from Google Sheets via Get Rows, fetch all rows from Postgres or MySQL via Select, use a Merge node in Combine mode to identify new/updated/ deleted records, then push changes to the opposite system. For high‑volume production pipelines (10,000+ rows), use the “Execute in Batches” option on Postgres or MySQL source nodes, add a Wait node between batches to throttle throughput, and monitor memory with N8N_LOG_LEVEL=debug. AI‑assisted ETL adds another layer: an LLM node can infer table schemas from Google Sheets headers, create tables dynamically in Postgres, and normalize currency, percentage, and date formats before loading. For the full production‑grade pipeline architecture including queue‑mode workers and connection pooling, see the n8n Scaling & Queue Configuration guide.

References

This guide is for informational purposes only. For the most current and authoritative information, always refer to the official n8n website (n8n.io), the n8n documentation, and the respective PostgreSQL, MySQL, Google Sheets, and Airtable API documentation. Node operations, authentication methods, and feature counts may change over time.

Leave a Reply

Your email address will not be published. Required fields are marked *