Top Banner
Some Conference OSCON 2011 PostgreSQL 9.1 Selena Deckelmann PostgreSQL Global Development Group Stronger Harder Better Faster
43

Harder, better, faster, stronger: PostgreSQL 9.1

Dec 07, 2014

Download

Technology

 
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 1. Harder Better Faster Stronger PostgreSQL 9.1 Selena Deckelmann PostgreSQL Global Development GroupSo O mS eCC O on N fer 20 en 11 e c
  • 2. 11 20 N O SCO
  • 3. Say Postgres. c e 11 en 20 fer O on N eCC O mS So
  • 4. c e 11 en 20 fer O on N eCC O mSSo
  • 5. Worlds most advanced open source database.So O mS eCC O on N fer 20 en 11 e c
  • 6. c e 11 en 20 fer O on N eCC O mSSo
  • 7. c e 11 en 20 fer O on N eCC O mSSo
  • 8. c e 11 en 20 fer O on N eCC O mSSo
  • 9. Postgres disrupts the commercial relational database industry.So O mS eCC O on N fer 20 en 11 e c
  • 10. Disruptive forces Licensing Enterprise Web development Proprietary DBA Career PathSo O mS eCC O on N fer 20 en 11 e c
  • 11. Licensing Drop-in replacement for custom application development. Cheap Data Warehousing Ecosystem!So O mS eCC O on N fer 20 en 11 e c
  • 12. Enterprise Web development Postgres is a Developers database - Extension is encouraged! Database of choice for Django Oracle wants PHP developersSo O mS eCC O on N fer 20 en 11 e c
  • 13. Visit the Ruby and Python Topic for more information pertaining to Ruby/RoR, Python and other non-PHP scripting languages.So O mS eCC O on N fer 20 en 11 e c
  • 14. DBA Career path Companies cant hire Postgres DBAs fast enough. Postgres is close enough to Oracle, that Oracle DBAs can jump in. What we do better: Data loading, automation, TUI and GUI admin toolsSo O mS eCC O on N fer 20 en 11 e c
  • 15. And... Stability Support major releases for at least 5 years. Commits to HEAD are stable. Bugs reported are xed in Index Scan using q on test (cost=0.00..76512.60 rows=1000000 width=16) (actual time=0.163..0.473 rows=10 loops=1)So O Order By: ("position" (500,500)::point) mS eCC O on N fer 20 en 11 e c
  • 32. Faster Unlogged Tables Background: every write to a table in Postgres is essentially *two* writes because of the Write Ahead Log (basis for replication, and durability guarantees) Unlogged tables are FREED of this durability constraint! Could think of them as Global Temporary tables (see Haas post) http://www.depesz.com/index.php/2011/01/03/waiting-for-9-1-unlogged-tables/ http://rhaas.blogspot.com/2010/05/global-temporary-and-unlogged-tables.html Example: =$ perl -le my $x = "aaaaaaaa"; for (1..450000) {print $x++} | perl -pe s/.*/(047$&047)/;s/s*z/,/ if $.%3 | sed s/.*/insert into test (some_text) values &;/So O mS eCC O on N fer 20 en 11 e c
  • 33. Stronger Serializable Snapshot Isolation PostgreSQLs is the rst production implementation Includes: per transaction support Why use it? * No more blocking on table locks! * No more "select for update" * Simplies programming Wiki: http://wiki.postgresql.org/wiki/SSI Developer: My notes from Kevins version of the talk: http://www.chesnok.com/ daily/2011/03/24/raw-notes-from-kevin-grittners-talk-on-ssi/So O mS eCC O on N fer 20 en 11 e c
  • 34. Stronger c e 11 en 20 fer O on N eCC O mS So
  • 35. Stronger Stronger Foreign Data Wrappers * Remote datasource access * Initially implemented TEXT, CSV data sources * Twitter: http://pgxn.org/dist/twitter_fdw/ * Google Summer of Code student is working on other data sources * Underway currently: Oracle and MySQL sources Awesome because: * 6-function API for implementing * Good for implementing imports, things which would otherwise fail if you just used COPY (imporoving COPY is a whole other rant...)So O mS eCC O on N fer 20 en 11 e c
  • 36. Stronger Stronger Foreign Data Wrappers Not awesome because: * Nothing other than sequential scans are possible for query plans * Not that many data sources implemented yet Expect tons of FDWs to be implemented once we get 9.1 to production releaseSo O mS eCC O on N fer 20 en 11 e c
  • 37. Stronger Syncronous Replication This is *the* most important use case for WAL-level replication. User: http://developer.postgresql.org/pgdocs/postgres/warm- standby.html#SYNCHRONOUS-REPLICATION (kind of terrible for a person trying to understand how it works) Somewhat better: http://wiki.postgresql.org/wiki/What %27s_new_in_PostgreSQL_9.1#Synchronous_replication_and_other_replic ation_features Wiki: http://wiki.postgresql.org/wiki/Synchronous_replicationSo O mS eCC O on N fer 20 en 11 e c
  • 38. Stronger Syncronous Replication WAL stands for "write ahead log" and it is what ensures durability for all write operations * WAL-shipping 16-MB chunks of these records was the pre-9.0 method for built-in replication * 9.0 and later have Streaming rep - per WAL record (per-commit) shipping of changes * Logical changes to DB, NOT statement-based * All-or-nothing wrt databases and tablesSo O mS eCC O on N fer 20 en 11 e c
  • 39. Stronger Syncronous Replication * Create a replication role (no longer a forced role creation like in 9.0) * pg_hba.conf (host based authorization) update to allow replication user to access system * Five key conguration options: wal_level, max_wal_senders, archive_mode, archive_command, synchronous_standby_names * Create a base backup that will be the slave * recovery.conf cong: restore_command, standby_mode, primary_conninfo, trigger_leSo O mS eCC O on N fer 20 en 11 e c
  • 40. Terrifyingly live demo.So O mS eCC O on N fer 20 en 11 e c
  • 41. Harder Better Faster Stronger Thanks to Josh Berkus http://www.pgexperts.com/document.html?id=50 Depesz http://www.depesz.comSo O mS eCC O on N fer 20 en 11 e c
  • 42. Harder Better Faster Stronger Other Postgres talks: Pro PostgreSQL Robert Treat, 1:40pm Wednesday Unbreaking your Django Application Christophe Pettus, 9amSo O mS (tutorial happening NOW) eCC O on N fer 20 en 11 e c
  • 43. Harder Better Faster Stronger Selena Deckelmann @selenamarie http://chesnok.com For hire! :)So O mS eCC O on N fer 20 en 11 e c