Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is PGDATA in PostgreSQL

New to PostgreSQL, experienced in Oracle. Trying to understand what PGDATA is.

Reading about it, it seems to contain what is necessary to create the initial Database cluster.

I did and install and I am converting some data from Oracle. The path the installation put PGDATA by default is in a file system that is fairly small. So I am looking to move it into a bigger file system.

So my questions are:

  1. Is this akin to the Oracle Data Dictionary?
  2. Do I need to put all my application data in that path or is it best practice not to?
  3. I know I can just take the default and create a new database in the bigger file system, but should I?

Thanks

like image 652
user4237042 Avatar asked Nov 10 '14 19:11

user4237042


People also ask

What is base folder in PostgreSQL?

The base directory in PostgreSQL (data_dir/base) is the folder is where PostgreSQL stores all the data you have inserted in your databases. It contains all the sub-directories which are used by a database in your clusters.

Can I delete Pgsql_tmp?

The temporary files that get created in base/pgsql_tmp during query execution will get deleted when the query is done. You should not delete them by hand. These files have nothing to do with temporary tables, they are use to store data for large hash or sort operations that would not fit in work_mem .

Where is Pg_tblspc?

pg_tblspc: it's in a non-default tablespace. 16709: it's in the tablespace with oid 16709. PG_9.

What is PostgreSQL Shared_buffers parameter used for?

The shared_buffers parameter determines how much memory is dedicated to the server for caching data. The value should be set to 15% to 25% of the machine's total RAM. For example: if your machine's RAM size is 32 GB, then the recommended value for shared_buffers is 8 GB.


1 Answers

One major difference between oracle and postgres is documentation quality. If you plan to work with postgres - make some time (a day ot two) to read it.

You can find full description for postgres files here: http://www.postgresql.org/docs/current/static/storage-file-layout.html

Generally you do not need to move your whole DB if you do not want. You can create a tablespace outside postgres data directory (via linux symlink).

Still you may want to move your whole DB to a bigger (faster?) FS. PGDATA directory contains Write Ahead Log (similar to Oracle REDO log). Slow operations on WAL mean slow DB in general. The size of the WAL files depends on DB setting and activity - you may want to be sure there is enough free space for it.

like image 187
Ihor Romanchenko Avatar answered Oct 01 '22 15:10

Ihor Romanchenko