I am running postgreSQL 8.4 on Ubuntu 10.0.4.
I recently needed to import a large amount of data (approx 300G) into a database. I purchased an additional drive, prepared it for use on my machine, and turned off logging altogether by setting:
log_destination='stderr'
in my postgresql.conf file
I then stopped the current run postgresql service, and restarted it, specifying the data directory. I did that using the following steps:
- sudo su - postgres
- /usr/lib/postgresql/8.4/bin/pg_ctl -D /path/to/dir/on/new/drive -l logfile start &
I run the psql command line utility and run SHOW DATA_DIRECTORY
to confirm that the running postgres service was indeed pointing to the right directory.
I then started my data import, but periodically run df -h
to check disk usage on my machine. Although data was being stored to my new drive (as expected), disk space was being consumed at a much faster rate on my old drive.
I don't understand why that would be, since postgreSQL should (AFAIK) have no reason to write anything to my old drive.
Does anyone know why this may be happening, and how to fix this? (i.e. force PG to save data in the specified location only?)
Note:
I did NOT change the data_directory setting in my postgresql.conf. It was still pointing to my old drive - however, I had explicitly restarted the postgres service and specified a new data directory location.