0

I have a mobile/web project, using pg9.3 as database, and linux as server.

The data won't be huge, but as time goes on, the data increase.


For long term considering, I want to know about:

Questions:

1. Is it necessary for me to create tablespace for my database, or just use the default one?

2. If I create new tablespace, what is the proper location on linux to create the folder, and why?

3. If I don't create it now, and wait until I have to, till then, will it be easy for me to migrate db with data to new tablespace?

Eric
  • 22,183
  • 20
  • 145
  • 196

1 Answers1

3

Just use the default tablespace, do not create new tablespaces. Tablespaces are only useful if you have multiple physical disks, so you can define which data is stored on which physical disk. The directory where your data is located is not that important for the workings of postgres, so if you only have one disk it is useless to use tablespaces

Should your data grow beyond the capacity of 1 disk, you will have to perform a full data migration anyway to move it to another physical disk, so you can configure tablespaces at that time

The idea behind defining which data is located on which disk (with tablespaces) is that you can do things like putting a big table which is hardly used on a slow disk, and putting this very intensively used table on a separated faster disk. But I assume you're not there yet, so don't over complicate things

Peter
  • 963
  • 6
  • 10