SELECT * anti-pattern in n8n
Why retrieving all columns wastes memory and bandwidth
What is this issue?
Using SELECT * retrieves every column from a database table, including large JSON blobs, text fields, and binary data you may not need. This wastes memory, network bandwidth, and processing time.
Problematic patterns:
•SELECT * FROM users instead of SELECT id, name, email•Querying tables with large TEXT or JSON columns•Fetching BLOB fields when only metadata is needed•Joining tables with SELECT * returning duplicates
Why is this dangerous?
Memory exhaustion
Large columns (JSON, TEXT, BLOB) can consume gigabytes of memory when fetching many rows.
Network overhead
Transferring unnecessary data slows down queries and increases database load.
Schema coupling
Adding new columns to tables silently changes what your workflow receives.
Slower processing
More data means longer processing time in downstream nodes.
How to fix it
- 1
Specify required columns
Replace SELECT * with an explicit column list: SELECT id, name, email, created_at.
- 2
Use projection options
In n8n database nodes, use the 'Columns' option to fetch only needed fields.
- 3
Create database views
For complex queries, create a database view that returns only necessary columns.
- 4
Use pagination
Combine specific columns with LIMIT/OFFSET to control data volume.
Scan your workflow now
Upload your n8n workflow JSON and detect database queries using SELECT *.