SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction to systemd
Introduction to systemdIntroduction to systemd
Introduction to systemdYusaku OGAWA
 
Linux containers-namespaces(Dec 2014)
Linux containers-namespaces(Dec 2014)Linux containers-namespaces(Dec 2014)
Linux containers-namespaces(Dec 2014)Ralf Dannert
 
Linux container, namespaces & CGroup.
Linux container, namespaces & CGroup. Linux container, namespaces & CGroup.
Linux container, namespaces & CGroup. Neeraj Shrimali
 
Advanced Namespaces and cgroups
Advanced Namespaces and cgroupsAdvanced Namespaces and cgroups
Advanced Namespaces and cgroupsKernel TLV
 
PostgreSQL on EXT4, XFS, BTRFS and ZFS
PostgreSQL on EXT4, XFS, BTRFS and ZFSPostgreSQL on EXT4, XFS, BTRFS and ZFS
PostgreSQL on EXT4, XFS, BTRFS and ZFSTomas Vondra
 
redis-benchmark with AMD RYZEN 1800X Intel Kaby Lake (i7-7700K) memo
redis-benchmark with AMD RYZEN 1800X Intel Kaby Lake (i7-7700K) memoredis-benchmark with AMD RYZEN 1800X Intel Kaby Lake (i7-7700K) memo
redis-benchmark with AMD RYZEN 1800X Intel Kaby Lake (i7-7700K) memoNaoto MATSUMOTO
 
Linux io-stack-diagram v1.0
Linux io-stack-diagram v1.0Linux io-stack-diagram v1.0
Linux io-stack-diagram v1.0bsd free
 
Containers with systemd-nspawn
Containers with systemd-nspawnContainers with systemd-nspawn
Containers with systemd-nspawnGábor Nyers
 
Linux Kernel Init Process
Linux Kernel Init ProcessLinux Kernel Init Process
Linux Kernel Init ProcessKernel TLV
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linuxsureskal
 
Linux Process & CF scheduling
Linux Process & CF schedulingLinux Process & CF scheduling
Linux Process & CF schedulingSangJung Woo
 
Containers are the future of the Cloud
Containers are the future of the CloudContainers are the future of the Cloud
Containers are the future of the CloudPavel Odintsov
 
Backup with Bareos and ZFS - by Christian Reiß
Backup with Bareos and ZFS - by Christian ReißBackup with Bareos and ZFS - by Christian Reiß
Backup with Bareos and ZFS - by Christian ReißNETWAYS
 

Was ist angesagt? (20)

RPM Building
RPM BuildingRPM Building
RPM Building
 
Introduction to systemd
Introduction to systemdIntroduction to systemd
Introduction to systemd
 
First steps on CentOs7
First steps on CentOs7First steps on CentOs7
First steps on CentOs7
 
Linux containers-namespaces(Dec 2014)
Linux containers-namespaces(Dec 2014)Linux containers-namespaces(Dec 2014)
Linux containers-namespaces(Dec 2014)
 
Linux container, namespaces & CGroup.
Linux container, namespaces & CGroup. Linux container, namespaces & CGroup.
Linux container, namespaces & CGroup.
 
Advanced Namespaces and cgroups
Advanced Namespaces and cgroupsAdvanced Namespaces and cgroups
Advanced Namespaces and cgroups
 
PostgreSQL on EXT4, XFS, BTRFS and ZFS
PostgreSQL on EXT4, XFS, BTRFS and ZFSPostgreSQL on EXT4, XFS, BTRFS and ZFS
PostgreSQL on EXT4, XFS, BTRFS and ZFS
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
redis-benchmark with AMD RYZEN 1800X Intel Kaby Lake (i7-7700K) memo
redis-benchmark with AMD RYZEN 1800X Intel Kaby Lake (i7-7700K) memoredis-benchmark with AMD RYZEN 1800X Intel Kaby Lake (i7-7700K) memo
redis-benchmark with AMD RYZEN 1800X Intel Kaby Lake (i7-7700K) memo
 
Pc bsd-intro
Pc bsd-introPc bsd-intro
Pc bsd-intro
 
Linux io-stack-diagram v1.0
Linux io-stack-diagram v1.0Linux io-stack-diagram v1.0
Linux io-stack-diagram v1.0
 
Containers with systemd-nspawn
Containers with systemd-nspawnContainers with systemd-nspawn
Containers with systemd-nspawn
 
Linux Kernel Init Process
Linux Kernel Init ProcessLinux Kernel Init Process
Linux Kernel Init Process
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
Basic Linux kernel
Basic Linux kernelBasic Linux kernel
Basic Linux kernel
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
 
My First BCC
My First BCCMy First BCC
My First BCC
 
Linux Process & CF scheduling
Linux Process & CF schedulingLinux Process & CF scheduling
Linux Process & CF scheduling
 
Containers are the future of the Cloud
Containers are the future of the CloudContainers are the future of the Cloud
Containers are the future of the Cloud
 
Backup with Bareos and ZFS - by Christian Reiß
Backup with Bareos and ZFS - by Christian ReißBackup with Bareos and ZFS - by Christian Reiß
Backup with Bareos and ZFS - by Christian Reiß
 

Ähnlich wie LSA2 - PostgreSQL

Trivadis TechEvent 2017 PostgreSQL für die (Orakel) DBA by Ludovico Caldara
Trivadis TechEvent 2017 PostgreSQL für die (Orakel) DBA by Ludovico CaldaraTrivadis TechEvent 2017 PostgreSQL für die (Orakel) DBA by Ludovico Caldara
Trivadis TechEvent 2017 PostgreSQL für die (Orakel) DBA by Ludovico CaldaraTrivadis
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAsMark Leith
 
How to configure the cluster based on Multi-site (WAN) configuration
How to configure the clusterbased on Multi-site (WAN) configurationHow to configure the clusterbased on Multi-site (WAN) configuration
How to configure the cluster based on Multi-site (WAN) configurationAkihiro Kitada
 
PGConf.ASIA 2019 Bali - AppOS: PostgreSQL Extension for Scalable File I/O - K...
PGConf.ASIA 2019 Bali - AppOS: PostgreSQL Extension for Scalable File I/O - K...PGConf.ASIA 2019 Bali - AppOS: PostgreSQL Extension for Scalable File I/O - K...
PGConf.ASIA 2019 Bali - AppOS: PostgreSQL Extension for Scalable File I/O - K...Equnix Business Solutions
 
Postgres 12 Cluster Database operations.
Postgres 12 Cluster Database operations.Postgres 12 Cluster Database operations.
Postgres 12 Cluster Database operations.Vijay Kumar N
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL AdministrationCommand Prompt., Inc
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL AdministrationEDB
 
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...Mydbops
 
Collaborate 2012 - Administering MySQL for Oracle DBAs
Collaborate 2012 - Administering MySQL for Oracle DBAsCollaborate 2012 - Administering MySQL for Oracle DBAs
Collaborate 2012 - Administering MySQL for Oracle DBAsNelson Calero
 
Wheeler w 0450_linux_file_systems1
Wheeler w 0450_linux_file_systems1Wheeler w 0450_linux_file_systems1
Wheeler w 0450_linux_file_systems1sprdd
 
Wheeler w 0450_linux_file_systems1
Wheeler w 0450_linux_file_systems1Wheeler w 0450_linux_file_systems1
Wheeler w 0450_linux_file_systems1sprdd
 
Tuning Linux for Databases.
Tuning Linux for Databases.Tuning Linux for Databases.
Tuning Linux for Databases.Alexey Lesovsky
 
Алексей Лесовский "Тюнинг Linux для баз данных. "
Алексей Лесовский "Тюнинг Linux для баз данных. "Алексей Лесовский "Тюнинг Linux для баз данных. "
Алексей Лесовский "Тюнинг Linux для баз данных. "Tanya Denisyuk
 

Ähnlich wie LSA2 - PostgreSQL (20)

Trivadis TechEvent 2017 PostgreSQL für die (Orakel) DBA by Ludovico Caldara
Trivadis TechEvent 2017 PostgreSQL für die (Orakel) DBA by Ludovico CaldaraTrivadis TechEvent 2017 PostgreSQL für die (Orakel) DBA by Ludovico Caldara
Trivadis TechEvent 2017 PostgreSQL für die (Orakel) DBA by Ludovico Caldara
 
PostgreSQL Prologue
PostgreSQL ProloguePostgreSQL Prologue
PostgreSQL Prologue
 
MySQL database
MySQL databaseMySQL database
MySQL database
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
How to configure the cluster based on Multi-site (WAN) configuration
How to configure the clusterbased on Multi-site (WAN) configurationHow to configure the clusterbased on Multi-site (WAN) configuration
How to configure the cluster based on Multi-site (WAN) configuration
 
PGConf.ASIA 2019 Bali - AppOS: PostgreSQL Extension for Scalable File I/O - K...
PGConf.ASIA 2019 Bali - AppOS: PostgreSQL Extension for Scalable File I/O - K...PGConf.ASIA 2019 Bali - AppOS: PostgreSQL Extension for Scalable File I/O - K...
PGConf.ASIA 2019 Bali - AppOS: PostgreSQL Extension for Scalable File I/O - K...
 
Postgres 12 Cluster Database operations.
Postgres 12 Cluster Database operations.Postgres 12 Cluster Database operations.
Postgres 12 Cluster Database operations.
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
 
IMDt
IMDtIMDt
IMDt
 
Collaborate 2012 - Administering MySQL for Oracle DBAs
Collaborate 2012 - Administering MySQL for Oracle DBAsCollaborate 2012 - Administering MySQL for Oracle DBAs
Collaborate 2012 - Administering MySQL for Oracle DBAs
 
Lamp ppt
Lamp pptLamp ppt
Lamp ppt
 
NoSQL
NoSQLNoSQL
NoSQL
 
Mydumper
MydumperMydumper
Mydumper
 
Wheeler w 0450_linux_file_systems1
Wheeler w 0450_linux_file_systems1Wheeler w 0450_linux_file_systems1
Wheeler w 0450_linux_file_systems1
 
Wheeler w 0450_linux_file_systems1
Wheeler w 0450_linux_file_systems1Wheeler w 0450_linux_file_systems1
Wheeler w 0450_linux_file_systems1
 
Tuning Linux for Databases.
Tuning Linux for Databases.Tuning Linux for Databases.
Tuning Linux for Databases.
 
Алексей Лесовский "Тюнинг Linux для баз данных. "
Алексей Лесовский "Тюнинг Linux для баз данных. "Алексей Лесовский "Тюнинг Linux для баз данных. "
Алексей Лесовский "Тюнинг Linux для баз данных. "
 
The Accidental DBA
The Accidental DBAThe Accidental DBA
The Accidental DBA
 

Mehr von Marian Marinov

Dev.bg DevOps March 2024 Monitoring & Logging
Dev.bg DevOps March 2024 Monitoring & LoggingDev.bg DevOps March 2024 Monitoring & Logging
Dev.bg DevOps March 2024 Monitoring & LoggingMarian Marinov
 
Basic presentation of cryptography mechanisms
Basic presentation of cryptography mechanismsBasic presentation of cryptography mechanisms
Basic presentation of cryptography mechanismsMarian Marinov
 
Microservices: Benefits, drawbacks and are they for me?
Microservices: Benefits, drawbacks and are they for me?Microservices: Benefits, drawbacks and are they for me?
Microservices: Benefits, drawbacks and are they for me?Marian Marinov
 
Introduction and replication to DragonflyDB
Introduction and replication to DragonflyDBIntroduction and replication to DragonflyDB
Introduction and replication to DragonflyDBMarian Marinov
 
Message Queuing - Gearman, Mosquitto, Kafka and RabbitMQ
Message Queuing - Gearman, Mosquitto, Kafka and RabbitMQMessage Queuing - Gearman, Mosquitto, Kafka and RabbitMQ
Message Queuing - Gearman, Mosquitto, Kafka and RabbitMQMarian Marinov
 
How to successfully migrate to DevOps .pdf
How to successfully migrate to DevOps .pdfHow to successfully migrate to DevOps .pdf
How to successfully migrate to DevOps .pdfMarian Marinov
 
How to survive in the work from home era
How to survive in the work from home eraHow to survive in the work from home era
How to survive in the work from home eraMarian Marinov
 
Improve your storage with bcachefs
Improve your storage with bcachefsImprove your storage with bcachefs
Improve your storage with bcachefsMarian Marinov
 
Control your service resources with systemd
 Control your service resources with systemd  Control your service resources with systemd
Control your service resources with systemd Marian Marinov
 
Comparison of-foss-distributed-storage
Comparison of-foss-distributed-storageComparison of-foss-distributed-storage
Comparison of-foss-distributed-storageMarian Marinov
 
Защо и как да обогатяваме знанията си?
Защо и как да обогатяваме знанията си?Защо и как да обогатяваме знанията си?
Защо и как да обогатяваме знанията си?Marian Marinov
 
Securing your MySQL server
Securing your MySQL serverSecuring your MySQL server
Securing your MySQL serverMarian Marinov
 
DoS and DDoS mitigations with eBPF, XDP and DPDK
DoS and DDoS mitigations with eBPF, XDP and DPDKDoS and DDoS mitigations with eBPF, XDP and DPDK
DoS and DDoS mitigations with eBPF, XDP and DPDKMarian Marinov
 
Challenges with high density networks
Challenges with high density networksChallenges with high density networks
Challenges with high density networksMarian Marinov
 
SiteGround building automation
SiteGround building automationSiteGround building automation
SiteGround building automationMarian Marinov
 
Preventing cpu side channel attacks with kernel tracking
Preventing cpu side channel attacks with kernel trackingPreventing cpu side channel attacks with kernel tracking
Preventing cpu side channel attacks with kernel trackingMarian Marinov
 
Managing a lot of servers
Managing a lot of serversManaging a lot of servers
Managing a lot of serversMarian Marinov
 
Let's Encrypt failures
Let's Encrypt failuresLet's Encrypt failures
Let's Encrypt failuresMarian Marinov
 

Mehr von Marian Marinov (20)

Dev.bg DevOps March 2024 Monitoring & Logging
Dev.bg DevOps March 2024 Monitoring & LoggingDev.bg DevOps March 2024 Monitoring & Logging
Dev.bg DevOps March 2024 Monitoring & Logging
 
Basic presentation of cryptography mechanisms
Basic presentation of cryptography mechanismsBasic presentation of cryptography mechanisms
Basic presentation of cryptography mechanisms
 
Microservices: Benefits, drawbacks and are they for me?
Microservices: Benefits, drawbacks and are they for me?Microservices: Benefits, drawbacks and are they for me?
Microservices: Benefits, drawbacks and are they for me?
 
Introduction and replication to DragonflyDB
Introduction and replication to DragonflyDBIntroduction and replication to DragonflyDB
Introduction and replication to DragonflyDB
 
Message Queuing - Gearman, Mosquitto, Kafka and RabbitMQ
Message Queuing - Gearman, Mosquitto, Kafka and RabbitMQMessage Queuing - Gearman, Mosquitto, Kafka and RabbitMQ
Message Queuing - Gearman, Mosquitto, Kafka and RabbitMQ
 
How to successfully migrate to DevOps .pdf
How to successfully migrate to DevOps .pdfHow to successfully migrate to DevOps .pdf
How to successfully migrate to DevOps .pdf
 
How to survive in the work from home era
How to survive in the work from home eraHow to survive in the work from home era
How to survive in the work from home era
 
Managing sysadmins
Managing sysadminsManaging sysadmins
Managing sysadmins
 
Improve your storage with bcachefs
Improve your storage with bcachefsImprove your storage with bcachefs
Improve your storage with bcachefs
 
Control your service resources with systemd
 Control your service resources with systemd  Control your service resources with systemd
Control your service resources with systemd
 
Comparison of-foss-distributed-storage
Comparison of-foss-distributed-storageComparison of-foss-distributed-storage
Comparison of-foss-distributed-storage
 
Защо и как да обогатяваме знанията си?
Защо и как да обогатяваме знанията си?Защо и как да обогатяваме знанията си?
Защо и как да обогатяваме знанията си?
 
Securing your MySQL server
Securing your MySQL serverSecuring your MySQL server
Securing your MySQL server
 
Sysadmin vs. dev ops
Sysadmin vs. dev opsSysadmin vs. dev ops
Sysadmin vs. dev ops
 
DoS and DDoS mitigations with eBPF, XDP and DPDK
DoS and DDoS mitigations with eBPF, XDP and DPDKDoS and DDoS mitigations with eBPF, XDP and DPDK
DoS and DDoS mitigations with eBPF, XDP and DPDK
 
Challenges with high density networks
Challenges with high density networksChallenges with high density networks
Challenges with high density networks
 
SiteGround building automation
SiteGround building automationSiteGround building automation
SiteGround building automation
 
Preventing cpu side channel attacks with kernel tracking
Preventing cpu side channel attacks with kernel trackingPreventing cpu side channel attacks with kernel tracking
Preventing cpu side channel attacks with kernel tracking
 
Managing a lot of servers
Managing a lot of serversManaging a lot of servers
Managing a lot of servers
 
Let's Encrypt failures
Let's Encrypt failuresLet's Encrypt failures
Let's Encrypt failures
 

Kürzlich hochgeladen

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesShubhangi Sonawane
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 

Kürzlich hochgeladen (20)

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 

LSA2 - PostgreSQL

  • 1. DataBases - PostgreSQL Linux System Administration II Marian Marinov Linux System Administration II DataBases - PostgreSQL
  • 2. 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
  • 4. 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
  • 5. 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
  • 6. 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
  • 7. 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
  • 8. 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
  • 9. 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
  • 10. 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
  • 11. Configuration authentication (pg hba.conf) server (postgresql.conf) storage considerations Linux System Administration II DataBases - PostgreSQL
  • 12. 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
  • 13. 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
  • 14. 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
  • 15. Backup and restores pg dump pg dumpall LVM snapshots Via replication WAL Linux System Administration II DataBases - PostgreSQL
  • 16. Monitoring EXPLAIN ( Planner Cost Constants ) ps axf. . . monitoring server monitoring tables & indexes Linux System Administration II DataBases - PostgreSQL