Administering Your PostgreSQL Geo Database
Administering Your PostgreSQL Geo Database
Geodatabase
Michael Downey
Jim McAbee
• Introduction to PostgreSQL
- http://www.postgresql.org/
- Open Source Enterprise level RDBMS
- Free, distributed with bsd license
- Supported by an active online development community
• Possible additional cost for administration guidance
- 3rd Quadrant, Enterprise DB, etc…
• Enable connections
pg_hba.conf
• SQL 3 specification of user-defined data types (UDTs) – ISO and OGC compliant
• Provides structured query language (SQL) access to the geodatabase and database.
• Can be used in PostgreSQL databases that contain a geodatabase and those that do
not.
SDE.SDE_DBTUNE
table for storing keywords
and associated parameters
user Geodatabase
data
• Enterprise Geodatabase is an Postgres Database
with an Administrative Schema providing
- Behaviors
- Complex Features A
A
B
C
B
(Topologies, Networks, Parcel Fabrics, etc…) C
admin user
- Versioning (Long Transactions) objects data
- Distributed Data sde user
schema schema
- Archiving
PostgreSQL
Geodatabase
Configuration
Michael Downey
Admin
Data Owners
Data Editors
Data Readers
• Authentication
- Who is connecting?
- Controlled by pg_hba.conf, specific database user name or group
• Schemas = Containers
- What are logical groups of database objects that should be managed as a whole?
• While there are several methods for creating backup – for PostgreSQL
Geodatabases pg_dump to create an archive file is the recommended method.
• Recovery would be dropping database and recreating with same name.
• PostGIS has further backup recommendations – see PostGIS’s documentation
• You must restore the public schema and its contents first. If you do not, some
of your spatial data will not restore. Second, restore the sde schema. If you do
not do this, spatial indexes will not be re-created on the feature classes.
http://desktop.arcgis.com/en/desktop/latest/manage-data/gdbs-in-
postgresql/restore-geodatabase-postgresql.htm
• Purposes
- cloning to staging or development environments
- migrating to new VM environment or hardware
• Methods
- via ArcGIS to new database – copy/paste, export/import, etc…
- pg_dump/pg_restore commands
- Restore PUBLIC schema first, then SDE, then data owner schemas
- run as superuser
- run ANALYZE after to update statistics
- re-create Tablespaces
- Text version of a table cannot be larger than 8GB if output to TAR
- use –o option if object identifiers (OIDs) in user-defined data
• Standard maintenance
- Reconcile/Post/Compress
- Rebuild Indexes
- Calculate Statistics
• Layer scale dependencies
• Excessive normalization
- Too many indexes
- No optimizer hints, index use can not be forced
- Need not worry about the Spatial Index
- GIST index used, self correcting
• Vacuum
- Have a specific plan – let it run automatically or run manually but this is what is
going to keep your indexes usable if there are large amounts of editing.
- removes dead tuples (rows)
- Autovacuum – on by default, can do an analyze
• Statistics (Analyze)
- Statistics – table size, cardinality of joins, distribution of indexes, etc…
- pg_stat_statements (create extension pg_stat_statements)
- module provides a means for tracking execution statistics of all SQL statements
executed by server.
- shared_preload_libraries = '"E:\\PostgreSQL\\9.2\\lib\\pg_stat_statements.dll"'
• Indexes (Rebuild)
mxdperfstat
PerfQA Analyzer
ArcGIS Desktop
Esri UC 2015 | Technical Workshop |
Thank you…
Online – www.esri.com/ucsessionsurveys
Paper – pick up and put in drop box