LSA2 - PostgreSQL
Upcoming SlideShare
Loading in...5
×
 

LSA2 - PostgreSQL

on

  • 1,789 views

 

Statistics

Views

Total Views
1,789
Views on SlideShare
219
Embed Views
1,570

Actions

Likes
0
Downloads
4
Comments
0

2 Embeds 1,570

http://training.iseca.org 1568
http://www.slideee.com 2

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    LSA2 - PostgreSQL LSA2 - PostgreSQL Presentation Transcript

    • DataBases - PostgreSQL Linux System Administration II Marian Marinov Linux System Administration II DataBases - PostgreSQL
    • Important links http://www.postgresql.org PostgreSQL 9.3 Documentation PostgreSQL Wiki pgFoundry projects pg-as-nosql-pgday-fosdem-2013.pdf Linux System Administration II DataBases - PostgreSQL
    • Installation Source RPM/DEB Linux System Administration II DataBases - PostgreSQL
    • Directory structure basic /var/lib/pgsql/data/* Debian based /etc/postgresql-common/ /etc/postgresql/9.3/main/ /var/lib/postgresql/9.3/main/ RedHat based old versions /var/lib/pgsql/data/* newer versions /var/lib/pgsql/9.3/data/* Linux System Administration II DataBases - PostgreSQL
    • Structure of PostgreSQL server prefork (shared memory) client handling (client library) query parser query analyzer query planner plug-in modules storage engine maintenance processes client client library parser autocomplete Linux System Administration II DataBases - PostgreSQL
    • On disk data structure | |- PG_VERSION |- base per-database subdirectories |- global cluster-wide tables, such as pg_database |- pg_clog transaction commit status data |- pg_multixact multitransaction status data |- pg_stat_tmp temporary files for the statistics subsyste |- pg_subtrans subtransaction status data |- pg_tblspc symbolic links to tablespaces |- pg_twophase state files for prepared transactions |- pg_xlog WAL (Write Ahead Log) files |... Linux System Administration II DataBases - PostgreSQL
    • On disk data structure base - |- 1 |- 11510 |- 11511 |- 16384 - 24576 template1=# SELECT datname,datlastsysoid FROM pg_database; datname | datlastsysoid -------------+---------------- template1 | 11510 template0 | 11510 postgres | 11510 os | 11510 (5 rows) Linux System Administration II DataBases - PostgreSQL
    • On disk data structure base - |- 11510 - | |- 24765 os# SELECT relname,relfilenode,reltablespace FROM pg_class WHERE relfilenode=24765; Relname | relfilenode | reltablespace ------------+---------------+--------------- disk_io | 24765 | 0 (1 row) Linux System Administration II DataBases - PostgreSQL
    • On disk data structure Table and Indexes are stored in separate files Tables bigger then 1GB are split into different files: filenode.1, filenode.2, . . . , filenode.N The 1GB limit can be changed during build using –with-segsize configure option. Linux System Administration II DataBases - PostgreSQL
    • DataBase Design DBNAME SCHME OBJECTS database - (table/view/sequence/domain) |- public |- scheme1 ----- | |- table1 | |- table2 | |- view1 | |- view2 | |- seq1 | - seq2 - scheme2 Linux System Administration II DataBases - PostgreSQL
    • Configuration authentication (pg hba.conf) server (postgresql.conf) storage considerations Linux System Administration II DataBases - PostgreSQL
    • Working with PgSQL (psql and phpPgAdmin) start/stop/restart/reload the server server resouce limits(ulimits) kernel tunning for PgSQL Linux System Administration II DataBases - PostgreSQL
    • Working with PgSQL (psql and phpPgAdmin) storage types standard types XML/JSON Network datatypes PostGIS ARRAYs User defined types (UDT) tablespaces list databases list users grant/revoke privileges creating/destroying users creating/destroying databases creating/destroying schemas creating/destroying tables Linux System Administration II DataBases - PostgreSQL
    • Working with PgSQL (psql and phpPgAdmin) creating/destroying constrains creating/destroying indexes creating/destroying sequences VACUUM/AUTOVACUUM VACUUM vs. ANALYZE built-in functions writing user functions adding a language to a database supported languages (SQL, pl/pgSQL, PL/Python, PL/Perl, PL/TCL, pl/V8, PL/R, PL/LUA, C) adding an extension to a database Foreign data wrappers Linux System Administration II DataBases - PostgreSQL
    • Backup and restores pg dump pg dumpall LVM snapshots Via replication WAL Linux System Administration II DataBases - PostgreSQL
    • Monitoring EXPLAIN ( Planner Cost Constants ) ps axf. . . monitoring server monitoring tables & indexes Linux System Administration II DataBases - PostgreSQL