Postgres Setup on locally hosted n8n

Hi all,

I am currently trying to setup Postgres as an alternative to SQLite for storing n8n’s Workflow and credential data.
My database knowledge isn’t the strongest and I’m trying to understand one of the ENV variables presented here: Databases | Docs

  • Is this a required variable?
  • Is there a schema available for n8n database?
  • Does this then remove the need to set up the tables within the Postgres n8n database

Hopefully that all makes sense!

As a note:

  • This is on an Ubuntu 20.04 server.
  • None of this is being done using docker.

Hey @Jaime_B,

Welcome to the community :sparkling_heart:

The env DB_POSTGRESDB_SCHEMA is not required. It is only required if you make any changes to your Postgres instance.

You check the environment variables that you need to configure in this file: n8n/docker-compose.yml at master · n8n-io/n8n · GitHub

Even though you’re not using docker, the env set from line 21 are all the ones you need!

Hope this helps :slight_smile:

1 Like

Thanks @harshil1712 !

Just one thing I’m still a bit unsure of is will I need to do anything with my Postgres DB beyond setting up a database & a user for it?
Will I need to set up the tables etc within to allow n8n to use it?

Hey @Jaime_B,

n8n will create the tables in the database for you.

1 Like