Pro PostgreSQL, OSCon 2008

12,512 views

Published on

My Pro PostgreSQL talk, given at OSCon 2008

Published in: Technology
0 Comments
8 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
12,512
On SlideShare
0
From Embeds
0
Number of Embeds
3,986
Actions
Shares
0
Downloads
256
Comments
0
Likes
8
Embeds 0
No embeds

No notes for slide

Pro PostgreSQL, OSCon 2008

  1. Pro PostgreSQL Robert Treat omniti.com brighterlamp.org
  2. Who Am I? (Why Listen To Me) O-0 <ul><li>PostgreSQL User Since 6.5.x </li></ul><ul><li>DBA of High Traffic / Large PostgreSQL Instances </li></ul><ul><li>Long Time Contributor to PostgreSQL Project </li></ul><ul><li>Contribute / Maintain Several Open Source Projects </li></ul><ul><li>Co-Author Beginning PHP & PostgreSQL 8 (Apress) </li></ul>
  3. Outline O-1 <ul><li>What you need to know about the project </li></ul><ul><li>Getting started </li></ul><ul><li>Upgrading </li></ul><ul><li>Configuring your server </li></ul><ul><li>Hardware </li></ul><ul><li>Availability </li></ul><ul><li>Scalability </li></ul><ul><li>Query tuning </li></ul><ul><li>Tablespaces </li></ul><ul><li>Partitioning </li></ul><ul><li>Stuff you should know about </li></ul>
  4. K-0 Know Your Way Around The Project
  5. Know Your Way Around The Project K-1 www.postgresql.org <ul><li>downloads </li></ul><ul><li>documentation </li></ul><ul><li>bug reports </li></ul><ul><li>security alerts </li></ul><ul><li>wiki </li></ul><ul><li>support companies </li></ul><ul><li>rss –> news – events - versions </li></ul>
  6. Know Your Way Around The Project K-2 www.pgfoundry.org projects.postgresql.org <ul><li>Modules </li></ul><ul><li>Programs </li></ul><ul><li>Resources </li></ul><ul><li>URI Type </li></ul><ul><li>CIText </li></ul><ul><li>SkyTools </li></ul><ul><li>Npgsql </li></ul><ul><li>Pl/Proxy </li></ul><ul><li>pg_bulkload </li></ul><ul><li>plpgsql-debugger </li></ul><ul><li>sample databases </li></ul>
  7. Know Your Way Around The Project K-3 www.planetpostgresql.org <ul><li>Project News </li></ul><ul><li>Community News </li></ul><ul><li>Helpful Tips / Examples </li></ul>
  8. Know Your Way Around The Project K-4 archives.postgresql.org <ul><li>mailing list archives back to 1997 </li></ul><ul><li>full text search via postgtresql 8.3 </li></ul><ul><li>keyword search suggestions </li></ul><ul><li>lists for users, developers, regional, user groups </li></ul>
  9. Know Your Way Around The Project K-5 #postgresql <ul><li>irc.freenode.net </li></ul><ul><li>real time help </li></ul><ul><li>rtfm_please - ??help </li></ul>
  10. Know Your Way Around The Project K-6 project management <ul><li>core team </li></ul><ul><li>committers </li></ul><ul><li>-hackers </li></ul><ul><li>roadmap </li></ul><ul><li>web team </li></ul>
  11. S-0 Get Off To A Good Start
  12. S-1 Get Off To A Good Start Use package management <ul><li>Consistent </li></ul><ul><li>Standardized </li></ul><ul><li>Simple </li></ul>
  13. <ul><li>Different across systems </li></ul><ul><li>Upgrades are an issue </li></ul><ul><li>Trust your packager? </li></ul>S-2 Get Off To A Good Start Use package management
  14. <ul><li>Different across systems </li></ul><ul><li>Upgrades are an issue </li></ul><ul><li>Trust your packager? </li></ul>S-2 Get Off To A Good Start Use package management Don't Be Afraid To Roll Your Own
  15. S-4 Get Off To A Good Start <ul><li>$PGDATA/pg_log </li></ul><ul><li>/var/log/pgsql </li></ul><ul><li>when in doubt... (postgresql.conf) </li></ul><ul><li>separate disk </li></ul>Configure Logging Logging is often overlooked, but is the first step toward troubleshooting!
  16. S-5 Get Off To A Good Start <ul><li>most systems have different defaults </li></ul><ul><li>firewalls/ selinux (FATAL) </li></ul><ul><li>rtfm (pg_hba.conf, grant, revoke) </li></ul>Configure Authentication
  17. S-6 Get Off To A Good Start <ul><li>TRUST </li></ul><ul><li>md5 </li></ul><ul><li>IDENT </li></ul>Authentication Methods
  18. S-7 Get Off To A Good Start <ul><li>trust these more than your own code </li></ul><ul><li>package dependent </li></ul><ul><li>use different schemas (when able) </li></ul><ul><li>pgcrypto </li></ul><ul><li>pgstatstuple, pg_buffercache, pg_freespacemap </li></ul>/contrib
  19. S-8 Get Off To A Good Start <ul><li>package dependent </li></ul><ul><li>some are non-core (plruby, plr, plphp) </li></ul><ul><li>varying functionality </li></ul><ul><li>varying levels of trust </li></ul><ul><li>don't be afraid, test! </li></ul>procedural languages
  20. U-0 Let's Talk About Upgrades
  21. U-1 Let's Talk About Upgrades Versioning First Digit ( 7 .4.16 -> 8 .2.0) Second Digit (8.2.4 -> 8.3.0) Third Digit (8.3.0 -> 8.3.1)
  22. U-2 Let's Talk About Upgrades Versioning First Digit (7.4.16 -> 8.2.0) Second Digit (8. 2 .4 -> 8. 3 .0) Third Digit (8.3.0 -> 8.3.1)
  23. U-3 Let's Talk About Upgrades Versioning First Digit (7.4.16 -> 8.2.0) Second Digit (8.2.4 -> 8.3.0) Third Digit (8.3. 0 -> 8.3. 1 )
  24. U-4 Let's Talk About Upgrades Achtung!! <ul><li>Make Backups! </li></ul><ul><li>Read the Release Notes! </li></ul>
  25. U-5 Let's Talk About Upgrades pg_dump/pg_restore <ul><li>simple </li></ul><ul><li>-Fc is your friend </li></ul><ul><li>dump with new version of pg_dump </li></ul><ul><li>pitfalls (time, hdd) </li></ul>
  26. U-6 Let's Talk About Upgrades the slony method <ul><li>not simple </li></ul><ul><li>create slave on new version </li></ul><ul><li>switchover (switch back?) </li></ul><ul><li>pitfalls (initial synch, compatibility) </li></ul>
  27. U-7 Let's Talk About Upgrades pg_migrator <ul><li>in place upgrades </li></ul><ul><li>rewrites system catalog info </li></ul><ul><li>no way to go back (fs snapshots) </li></ul><ul><li>still new, under-flux </li></ul><ul><li>8.1 -> 8.2 only (for now) </li></ul>
  28. U-8 Let's Talk About Upgrades upgrading older db <ul><li><= 7.3 is no longer supported (upgrade now!) </li></ul><ul><li>pg_dump 8.2 has issues with <= 7.2 </li></ul><ul><ul><ul><li>you can upgrade to 7.3 first </li></ul></ul></ul><ul><ul><ul><li>use adddepends on 7.3 install </li></ul></ul></ul><ul><li>slony requires 7.3 (or 7.4) (or 8.3) or newer </li></ul><ul><li>pg_migrator (lol) </li></ul>
  29. C-0 Figure Your Configure
  30. C-1 Figure Your Configure the basics : performance <ul><li>effective_cache_size </li></ul><ul><li>shared_buffers </li></ul><ul><li>default_statistics_target </li></ul><ul><li>work_mem </li></ul><ul><li>checkpoint_segments </li></ul>
  31. C-2 Figure Your Configure the basics : logging <ul><li>stderr/pg_log vs. syslog/eventlog </li></ul><ul><li>log_min_error_statement (error!) </li></ul><ul><li>log_min_duration_statement </li></ul><ul><li>log_line_prefix (%d, %p, %t) </li></ul>
  32. C-3 Figure Your Configure other stuff worth looking at <ul><li>maintenance_work_mem </li></ul><ul><li>max_prepared_transactions </li></ul><ul><li>update_process_title </li></ul><ul><li>max_fsm_pages </li></ul><ul><li>synchronous_commit </li></ul>
  33. M-0 Routine Maintenance
  34. M-1 Routine Maintenance a word about vacuum <ul><li>reclaim usable space </li></ul><ul><li>update table stats </li></ul><ul><li>avoid xid wraparound </li></ul>
  35. M-2 Routine Maintenance autovacuum : just do it! <ul><li>autovacuum </li></ul><ul><li>track_activities </li></ul><ul><li>track_counts </li></ul><ul><li>autovacuum_max_freeze_age </li></ul><ul><li>pg_autovacuum ? </li></ul>
  36. M-3 Routine Maintenance other stuff worth looking at <ul><li>reindexing </li></ul><ul><li>logfiles </li></ul><ul><li>backups </li></ul><ul><li>failover </li></ul>
  37. P-0 Hardware For Software People
  38. P-1 Hardware For Software People you can be cheap on the licensing, don't be cheap on the hardware <ul><li>Cram the (ecc) RAM </li></ul><ul><li>Redundant Disks </li></ul><ul><li>(Software|Hardware) RAID </li></ul><ul><li>Prefer SCSI, Accept SATA </li></ul><ul><li>RAID Z (JBOD) </li></ul>
  39. P-2 Hardware For Software People cpu and you <ul><li>Multiple CPU's work wonders, up to 8 processors (16 OK) </li></ul><ul><li>Opteron, Xeon, Core 2 Duo </li></ul><ul><li>http://tweakers.net/ </li></ul>
  40. P-3 Hardware For Software People disk do's <ul><li>Put WAL on it's own disk (RAID 1) </li></ul><ul><li>Put DATA directory on it's own disk (RAID 10) </li></ul><ul><li>More Spindles is Good </li></ul><ul><li>More Controllers Even Gooder (tablespaces!) </li></ul><ul><li>Battery Backed Controllers, Write cache enabled </li></ul>
  41. P-4 Hardware For Software People disk dont's <ul><li>NFS == Not Fully Safe! </li></ul><ul><li>RAID 5 </li></ul><ul><li>Beware disks / controllers that Lie </li></ul>
  42. A-0 Availability (Not Scalability)
  43. A-1 Availability what do we mean by availability? <ul><li>not backups (exactly) </li></ul><ul><li>not replication (necessarily) </li></ul><ul><li>not clustering (even less so) </li></ul>
  44. A-2 Availability what do we mean by availability? if (kablooy) then (ok) <ul><li>not backups (exactly) </li></ul><ul><li>not replication (necessarily) </li></ul><ul><li>not clustering (even less so) </li></ul>
  45. A-3 Availability pg_dump <ul><li>traditionally used for backups </li></ul><ul><li>send dump to another server </li></ul><ul><li>constantly run restore process </li></ul><ul><li>large time, i/o constraints </li></ul>
  46. A-4 Availability filesystem snapshots <ul><li>zfs, lvm </li></ul><ul><li>built on top of pitr backup commands </li></ul><ul><li>traditionally used for backups </li></ul><ul><li>copy snapshot to another server </li></ul><ul><li>cumbersome time, i/o constraints </li></ul>
  47. A-5 Availability pitr <ul><li>create second, standby server </li></ul><ul><li>ship wal logs to new server </li></ul><ul><li>less time/io than pg_dump </li></ul><ul><li>8.1 -> cold standby </li></ul><ul><li>8.2 -> warm standby </li></ul><ul><li>8.4 -> hot standby ? </li></ul>
  48. A-6 Availability slony <ul><li>asynchronous, master-slave replication </li></ul><ul><li>controlled switchover, failover </li></ul><ul><li>low i/o, time constraints </li></ul><ul><li>other benefits (upgrades, scaling) </li></ul>
  49. A-7 Availability bucardo <ul><li>asynchronous, multi-master replication </li></ul><ul><li>also does master-slave </li></ul><ul><li>low i/o, time constraints </li></ul><ul><li>other benefits (upgrades, scaling) </li></ul>
  50. A-8 Availability shared disk <ul><li>one copy of PGDATA on shared storage </li></ul><ul><li>standby takes over akin to db crash </li></ul><ul><li>shared disk is point of failure (raid) </li></ul><ul><li>STONITH </li></ul>
  51. A-9 Availability filesystem replication <ul><li>drbd </li></ul><ul><li>filesystem mirrored between servers </li></ul><ul><li>synchronized, ordered writes </li></ul><ul><li>single disk system? </li></ul>
  52. A-10 Availability pgpool <ul><li>dual-master, statement based </li></ul><ul><li>little caveats (random(),now(),sequences) </li></ul><ul><li>bigger caveats (security, password, pg_hba) </li></ul><ul><li>pgpool becomes failure point </li></ul>
  53. A-11 Availability postgres-r <ul><li>multi-master, synchronous </li></ul><ul><li>just open sourced this month! </li></ul><ul><li>small community </li></ul><ul><li>not proven </li></ul>
  54. H-0 Scalability
  55. H-1 Scalability what is scaling? “ How well a solution to some problem will work when the relative size of the problem increases” - Theo Schlossnagle
  56. H-2 Scalability bigger, better, faster, more! <ul><li>postgresql scales up pretty well </li></ul><ul><li>more disks (tablespaces) </li></ul><ul><li>more cpu's, more ram </li></ul><ul><li>connection pooling </li></ul><ul><li>1000+ connections, TB+ data </li></ul>
  57. H-3 Scalability pgpool <ul><li>dual-master, statement based </li></ul><ul><li>little caveats (random(),now(),sequences) </li></ul><ul><li>bigger caveats (security, password, pg_hba) </li></ul><ul><li>pgpool becomes failure point </li></ul>
  58. H-4 Scalability pg_bouncer <ul><li>simple connection pooler </li></ul><ul><li>10/1 -> 40/1 </li></ul><ul><li>caveats (prepared statements, temp tables) </li></ul><ul><li>skype, myyearbook.com </li></ul>
  59. H-5 Scalability slony <ul><li>asynchronous, master-slave replication </li></ul><ul><li>multiple, cascading slaves </li></ul><ul><li>scales read operations </li></ul><ul><li>other benefits (upgrades, scaling) </li></ul><ul><li>solid user base </li></ul>
  60. H-6 Scalability bucardo <ul><li>asynchronous, multi-master replication </li></ul><ul><li>also does master-slave </li></ul><ul><li>low i/o, time constraints </li></ul><ul><li>other benefits (upgrades, scaling) </li></ul>
  61. H-7 Scalability pgpool-II <ul><li>single db over multiple machines </li></ul><ul><li>scales read operations </li></ul><ul><li>replication, load balance, parallel query </li></ul><ul><li>green technology </li></ul>
  62. H-8 Scalability pgcluster <ul><li>synchronous multi-master replication </li></ul><ul><li>significant complexity </li></ul><ul><li>scales read operations </li></ul><ul><li>other uses (failover abilities) </li></ul><ul><li>green technology </li></ul>
  63. H-9 Scalability postgres-r <ul><li>multi-master, synchronous </li></ul><ul><li>just open source this month! </li></ul><ul><li>small community </li></ul><ul><li>other uses (failover abilities) </li></ul><ul><li>not proven </li></ul>
  64. H-10 Scalability pitr read-only slaves <ul><li>based on pitr, warm standby operation </li></ul><ul><li>core team officially supporting development </li></ul><ul><li>8.4 -> synchronous wal shipping </li></ul><ul><li>8.? -> read only slaves </li></ul>
  65. J-0 Query Your Queries
  66. J-1 Query Your Queries finding slow queries: log_min_duration_statement <ul><li>-1, 0 , n </li></ul><ul><li>superuser only </li></ul><ul><li>alter user </li></ul>LOG: duration: 5005.273 ms statement: select pg_sleep(5);
  67. J-2 Query Your Queries finding slow queries: pgfouine / pqa <ul><li>log analyzers </li></ul><ul><li>command line, generate reports </li></ul><ul><li>i/o load </li></ul>http://pgfouine.projects.postgresql.org/reports.html http://pqa.projects.postgresql.org/example.html
  68. J-3 Query Your Queries finding slow queries: pg_stat_all_tables pagila=# d pg_stat_all_tables View &quot;pg_catalog.pg_stat_all_tables&quot; Column | Type | ------------------+-------------+ relid | oid | schemaname | name | relname | name | seq_scan | bigint | seq_tup_read | bigint | idx_scan | bigint | idx_tup_fetch | bigint | n_tup_ins | bigint | n_tup_upd | bigint | n_tup_del | bigint | n_tup_hot_upd | bigint | n_live_tup | bigint | n_dead_tup | bigint | last_vacuum | timestamptz | last_autovacuum | timestamptz | last_analyze | timestamptz | last_autoanalyze | timestamptz |
  69. J-4 Query Your Queries finding slow queries: pg_stat_all_tables pagila=# d pg_stat_all_tables View &quot;pg_catalog.pg_stat_all_tables&quot; Column | Type | ------------------+-------------+ relid | oid | schemaname | name | relname | name | seq_scan | bigint | seq_tup_read | bigint | idx_scan | bigint | idx_tup_fetch | bigint | n_tup_ins | bigint | n_tup_upd | bigint | n_tup_del | bigint | n_tup_hot_upd | bigint | n_live_tup | bigint | n_dead_tup | bigint | last_vacuum | timestamptz | last_autovacuum | timestamptz | last_analyze | timestamptz | last_autoanalyze | timestamptz |
  70. J-5 Query Your Queries finding slow queries: pg_stat_all_tables pagila=# d pg_stat_all_tables View &quot;pg_catalog.pg_stat_all_tables&quot; Column | Type | ------------------+-------------+ relid | oid | schemaname | name | relname | name | seq_scan | bigint | seq_tup_read | bigint | idx_scan | bigint | idx_tup_fetch | bigint | n_tup_ins | bigint | n_tup_upd | bigint | n_tup_del | bigint | n_tup_hot_upd | bigint | n_live_tup | bigint | n_dead_tup | bigint | last_vacuum | timestamptz | last_autovacuum | timestamptz | last_analyze | timestamptz | last_autoanalyze | timestamptz |
  71. J-6 Query Your Queries finding slow queries: pg_stat_all_tables pagila=# d pg_stat_all_tables View &quot;pg_catalog.pg_stat_all_tables&quot; Column | Type | ------------------+-------------+ relid | oid | schemaname | name | relname | name | seq_scan | bigint | seq_tup_read | bigint | idx_scan | bigint | idx_tup_fetch | bigint | n_tup_ins | bigint | n_tup_upd | bigint | n_tup_del | bigint | n_tup_hot_upd | bigint | n_live_tup | bigint | n_dead_tup | bigint | last_vacuum | timestamptz | last_autovacuum | timestamptz | last_analyze | timestamptz | last_autoanalyze | timestamptz |
  72. J-7 Query Your Queries finding slow queries: pg_stat_all_tables pagila=# d pg_stat_all_tables View &quot;pg_catalog.pg_stat_all_tables&quot; Column | Type | ------------------+-------------+ relid | oid | schemaname | name | relname | name | seq_scan | bigint | seq_tup_read | bigint | idx_scan | bigint | idx_tup_fetch | bigint | n_tup_ins | bigint | n_tup_upd | bigint | n_tup_del | bigint | n_tup_hot_upd | bigint | n_live_tup | bigint | n_dead_tup | bigint | last_vacuum | timestamptz | last_autovacuum | timestamptz | last_analyze | timestamptz | last_autoanalyze | timestamptz |
  73. J-8 Query Your Queries finding slow queries: pg_stat_all_tables pagila=# d pg_stat_all_tables View &quot;pg_catalog.pg_stat_all_tables&quot; Column | Type | ------------------+-------------+ relid | oid | schemaname | name | relname | name | seq_scan | bigint | seq_tup_read | bigint | idx_scan | bigint | idx_tup_fetch | bigint | n_tup_ins | bigint | n_tup_upd | bigint | n_tup_del | bigint | n_tup_hot_upd | bigint | n_live_tup | bigint | n_dead_tup | bigint | last_vacuum | timestamptz | last_autovacuum | timestamptz | last_analyze | timestamptz | last_autoanalyze | timestamptz |
  74. J-9 Query Your Queries finding slow queries: pg_stat_all_indexes pagila=# d pg_stat_all_indexes View &quot;pg_catalog.pg_stat_all_indexes&quot; Column | Type | ---------------+--------+ relid | oid | indexrelid | oid | schemaname | name | relname | name | indexrelname | name | idx_scan | bigint | idx_tup_read | bigint | idx_tup_fetch | bigint |
  75. J-10 Query Your Queries finding slow queries: pg_stat_all_indexes pagila=# d pg_stat_all_indexes View &quot;pg_catalog.pg_stat_all_indexes&quot; Column | Type | ---------------+--------+ relid | oid | indexrelid | oid | schemaname | name | relname | name | indexrelname | name | idx_scan | bigint | idx_tup_read | bigint | idx_tup_fetch | bigint |
  76. J-11 Query Your Queries finding slow queries: pg_statio_all_tables pagila=# d pg_statio_all_tables View &quot;pg_catalog.pg_statio_all_tables&quot; Column | Type | -----------------+--------+ relid | oid | schemaname | name | relname | name | heap_blks_read | bigint | heap_blks_hit | bigint | idx_blks_read | bigint | idx_blks_hit | bigint | toast_blks_read | bigint | toast_blks_hit | bigint | tidx_blks_read | bigint | tidx_blks_hit | bigint |
  77. J-12 Query Your Queries finding slow queries: pg_statio_all_tables pagila=# d pg_statio_all_tables View &quot;pg_catalog.pg_statio_all_tables&quot; Column | Type | -----------------+--------+ relid | oid | schemaname | name | relname | name | heap_blks_read | bigint | heap_blks_hit | bigint | idx_blks_read | bigint | idx_blks_hit | bigint | toast_blks_read | bigint | toast_blks_hit | bigint | tidx_blks_read | bigint | tidx_blks_hit | bigint |
  78. J-13 Query Your Queries fixing slow queries: explain analyze <ul><li>universal tool </li></ul><ul><li>good for specific queries </li></ul><ul><li>“ explain” for large queries </li></ul><ul><li>could be it's own talk </li></ul>
  79. J-14 Query Your Queries fixing slow queries: explain analyze <ul><li>universal tool </li></ul><ul><li>good for specific queries </li></ul><ul><li>“ explain” for large queries </li></ul><ul><li>could be it's own talk </li></ul>http://wiki.postgresql.org/Using_EXPLAIN
  80. J-15 Query Your Queries fixing slow queries: indexing (basic) <ul><li>use explain to find large sequential reads </li></ul><ul><li>use pg_stat_* tables to find numerous reads </li></ul><ul><li>btree – (gist/gin) </li></ul><ul><li>enable_indexscan, enable_bitmapscan </li></ul><ul><li>dual column vs. single column </li></ul>
  81. J-16 Query Your Queries fixing slow queries: indexing (partial) create index address_ba_part_idx on address (district) where district = 'Buenos Aires'; <ul><li>restrain index to rows that matter </li></ul><ul><li>can give significant speed improvements </li></ul><ul><li>where clause of index should match </li></ul><ul><li>where clause of query </li></ul>
  82. J-17 Query Your Queries fixing slow queries: indexing (partial) create index customer_active_part_idx on customer (customer_id) where activebool is true; <ul><li>restrain index to rows that matter </li></ul><ul><li>can give significant speed improvements </li></ul><ul><li>where clause of index should match </li></ul><ul><li>where clause of query </li></ul>
  83. J-18 Query Your Queries fixing slow queries: indexing (functional) <ul><li>some people prefer to call these expressional indexes </li></ul>
  84. J-19 Query Your Queries fixing slow queries: indexing (expressional) create unique index one_true_email_xidx on customer (lower(email)); <ul><li>push expensive functions into your index </li></ul><ul><li>system sees just WHERE indexedcolumn = 'constant' </li></ul><ul><li>expression of index should match expression of queries </li></ul><ul><li>narrow scope, but nice gains </li></ul>
  85. J-20 Query Your Queries fixing slow queries: indexing (expressional) create index fullname_xidx on customer ((first_name||' '||last_name)); <ul><li>push expensive functions into your index </li></ul><ul><li>system sees just WHERE indexedcolumn = 'constant' </li></ul><ul><li>expression of index should match expression of queries </li></ul><ul><li>narrow scope, but nice gains </li></ul>
  86. J-21 Query Your Queries fixing slow queries: full text search <ul><li>uses lexmes and word stemming to find common words </li></ul><ul><li>replacement for LIKE '%x%', ~* 'x'; </li></ul><ul><li>supports multiple languages, custom dictionaries </li></ul><ul><li>special indexing options </li></ul>
  87. J-22 Indexing Options full text indexing gist vs. gin <ul><li>“ old school” </li></ul><ul><li>slower for queries </li></ul><ul><li>faster insert / update </li></ul><ul><li>mature </li></ul><ul><li>new in 8.2 </li></ul><ul><li>faster for queries </li></ul><ul><li>slower insert / update </li></ul><ul><li>stable </li></ul>
  88. N-0 PostgreSQL Tablespaces
  89. N-1 PostgreSQL Tablespaces tablespaces? <ul><li>define logical locations for object placement </li></ul><ul><li>point to locations on disk (uses symlinks) </li></ul><ul><li>size determined by disk size (not pre-ordained) </li></ul><ul><li>dedicate per db, split db across multiple tblspc </li></ul>
  90. N-2 PostgreSQL Tablespaces tablespaces! <ul><li>split database over separate disks </li></ul><ul><li>use stat, statio tables to gauge disk access </li></ul><ul><li>create dedicated storage for workloads </li></ul><ul><ul><ul><li>disk for read / write </li></ul></ul></ul><ul><ul><ul><li>disk for read only </li></ul></ul></ul><ul><ul><ul><li>large, slow disk for archiving </li></ul></ul></ul><ul><ul><ul><li>disk for indexes </li></ul></ul></ul>
  91. Q-0 PostgreSQL Partitioning
  92. Q-1 PostgreSQL Partitioning partitioning? <ul><li>as table size grows, it becomes unmanageable </li></ul><ul><li>use inheritance, rules, constraints to split data </li></ul><ul><li>queries ignore non-relevant partitions </li></ul><ul><li>could be it's own talk </li></ul>
  93. Q-2 PostgreSQL Partitioning partitioning! <ul><li>as table size grows, it becomes unmanageable </li></ul><ul><li>use inheritance, rules, constraints to split data </li></ul><ul><li>queries ignore non-relevant partitions </li></ul><ul><li>could be it's own talk </li></ul>http://www.pgcon.org/2007/schedule/events/41.en.html
  94. Q-3 PostgreSQL Partitioning partitioning : key points <ul><li>determine list vs. range </li></ul><ul><li>use triggers rather than rules </li></ul><ul><li>partition creation vs. data population </li></ul><ul><li>automate maintenance </li></ul>
  95. I-0 Other Stuff I Should Mention
  96. I-1 Other Stuff I Should Mention pgcrypto <ul><li>cryptography type functions </li></ul><ul><li>/contrib (export issues) </li></ul><ul><li>md5, sha1, blowfish, many more </li></ul>
  97. I-2 Other Stuff I Should Mention dblink <ul><li>pg -> pg connections </li></ul><ul><li>/contrib (still under development?) </li></ul><ul><li>can have performance issues on large queries </li></ul><ul><li>make it live in it's own schema </li></ul>
  98. I-3 Other Stuff I Should Mention *-link <ul><li>heterogenous connections for postgresql </li></ul><ul><li>db specific and db independent options </li></ul><ul><li>any pl/u language can implement this </li></ul><ul><li>similar performance issues to dblink </li></ul><ul><li>dblink-tds, dbi-link, oralink, odbclink </li></ul>http://www.pgfoundry.org/ (db link)
  99. I-4 Other Stuff I Should Mention autonomous logging tool <ul><li>persistent logging for postgresql functions </li></ul><ul><li>built on top of dblink </li></ul><ul><li>make it live in it's own schema </li></ul>https://labs.omniti.com/trac/pgsoltools
  100. I-5 Other Stuff I Should Mention snapshot pitr clones <ul><li>full read/write copy of pitr slave </li></ul><ul><li>static snapshot </li></ul><ul><li>need solaris (zfs zone mojo) </li></ul><ul><li>could re-implement on other systems </li></ul>https://labs.omniti.com/trac/pgsoltools
  101. I-6 Other Stuff I Should Mention check_postgres <ul><li>nagios based monitoring script </li></ul><ul><li>common items for warnings and alerts </li></ul><ul><li>can be adapted to other uses </li></ul>http://bucardo.org/check_postgres
  102. I-7 Other Stuff I Should Mention reconnoiter <ul><li>monitoring / graphing tool </li></ul><ul><li>postgres based </li></ul><ul><li>still pretty green </li></ul>https://labs.omniti.com/trac/reconnoiter
  103. I-8 Other Stuff I Should Mention phpPgAdmin <ul><li>web based gui for postgresql </li></ul><ul><li>remote administration of multiple servers </li></ul><ul><li>implements much of postgresql functionality </li></ul><ul><li>support back to 7.2? </li></ul>http://phppgadmin.sourceforge.net/
  104. I-9 Other Stuff I Should Mention ;-) my book?
  105. I-10 Other Stuff I Should Mention ;-) we're hiring <ul><li>Ops Ninjas </li></ul><ul><li>Perl Kung-Fu Artists </li></ul><ul><li>PHP Ninjas </li></ul><ul><li>Database Samurai </li></ul>http://omniti.com/is/hiring
  106. L-0 El Fin

×