<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Database on Evan Hoffman</title><link>https://evan.wtf/tags/database/</link><description>Recent content in Database on Evan Hoffman</description><generator>Hugo</generator><language>en-US</language><copyright>Evan Hoffman</copyright><lastBuildDate>Thu, 26 Sep 2013 09:12:05 +0000</lastBuildDate><atom:link href="https://evan.wtf/tags/database/index.xml" rel="self" type="application/rss+xml"/><item><title>Goodbye, pg_dump</title><link>https://evan.wtf/2013/09/26/goodbye-pg_dump/</link><pubDate>Thu, 26 Sep 2013 09:12:05 +0000</pubDate><guid>https://evan.wtf/2013/09/26/goodbye-pg_dump/</guid><description>&lt;p&gt;I&amp;rsquo;ve been a Postgres user and administrator for a while. Over the years, my views on backups have evolved.&lt;/p&gt;&#10;&lt;p&gt;Originally, like most people, I started out with good old pg_dump. With a reasonably small database (under 50 GB) dumping to a flat text file is a fine option. I&amp;rsquo;d generally do something like &lt;code&gt;pg_dump -Upostgres dbname | gzip &amp;gt; dbname.sql.gz&lt;/code&gt; to compress it on the fly and save space. For years this seemed perfect: dumping the entire database in a single transaction into a single file that can be restored anywhere.&lt;/p&gt;</description></item><item><title>Problems with PostgreSQL 9.0 on CentOS 6.3 with a 2.6.32-series kernel</title><link>https://evan.wtf/2012/09/25/problems-with-postgresql-9-0-on-centos-6-3-with-a-2-6-32-series-kernel/</link><pubDate>Tue, 25 Sep 2012 13:20:36 +0000</pubDate><guid>https://evan.wtf/2012/09/25/problems-with-postgresql-9-0-on-centos-6-3-with-a-2-6-32-series-kernel/</guid><description>&lt;p&gt;&lt;em&gt;Note: this is cross-posted from the &lt;a href="http://www.yodletechblog.com/post/problems-with-postgresql-9.0-on-centos-6.3-with-a-2.6.32-series-kernel/"&gt;Yodle Tech Blog&lt;/a&gt;&lt;/em&gt;.&#10;We recently migrated our Postgres database to a significantly more powerful machine. While our existing server was doing okay load-wise, we were approaching 90% full on its Postgres volume. We&amp;rsquo;d also recently acquired an awesome new PureStorage SSD-based SAN and were excited to move our database onto it. For comparison, here are the the specs for the two systems:&lt;/p&gt;&#10;&lt;table&gt;&#10;&#9;&lt;thead&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;&lt;/th&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/thead&gt;&#10;&#9;&lt;tbody&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Old server&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;New server&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Nickname&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;DB1&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;DB2&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;CPU&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;2x 6-core &lt;a href="http://ark.intel.com/products/52576/Intel-Xeon-Processor-X5690-%2812M-Cache-3_46-GHz-6_40-GTs-Intel-QPI%29"&gt;Xeon X5690&lt;/a&gt; CPUs at 3.47GHz&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;2x 8-core &lt;a href="http://ark.intel.com/products/64596/Intel-Xeon-Processor-E5-2690-%2820M-Cache-2_90-GHz-8_00-GTs-Intel-QPI%29"&gt;E5-2690&lt;/a&gt; CPUs at 2.90 GHz&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Memory&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;96 GB 1333 MHz&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;128 GB 1600 MHz&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Storage&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;- Dell PERC H800 SAS HBA - Dell MD1220 drive enclosure - 24x 15k RPM SAS drives configured in RAID 10&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;- QLogic QLE2562 dual-port 8 Gbit FC HBA - PureStorage SSD-based SAN&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;OS&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;CentOS 5.6 x86_64&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;CentOS 6.3 x86_64&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Kernel&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;2.6.18-238.9.1.el5&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;2.6.32-279.2.1.el6.x86_64&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;p&gt;As you can probably guess, moving from spinning disk onto SSD was the centerpiece of the upgrade. We&amp;rsquo;d tested the PureStorage system pretty extensively and used it in some secondary databases and seen some amazing improvements. We were excited to see how it would handle our production workload.&lt;/p&gt;</description></item><item><title>33 hours to restore a Postgres DB</title><link>https://evan.wtf/2011/07/26/33-hours-2/</link><pubDate>Tue, 26 Jul 2011 18:10:01 +0000</pubDate><guid>https://evan.wtf/2011/07/26/33-hours-2/</guid><description>Restoring a huge DB takes a long time.</description></item><item><title>Benchmarking disk IO on ext3 vs ext4 vs xfs with fio</title><link>https://evan.wtf/2011/07/22/benchmarking-disk-io-on-ext3-vs-ext4-with-fio/</link><pubDate>Fri, 22 Jul 2011 07:15:05 +0000</pubDate><guid>https://evan.wtf/2011/07/22/benchmarking-disk-io-on-ext3-vs-ext4-with-fio/</guid><description>&lt;p&gt;With the old database phased out, I figured this was a good time to benchmark IO on it before either repurposing it or mothballing it. In &lt;a href="https://evan.wtf/2009/10/27/nilfs-a-file-system-to-make-ssds-scream-in-pain/"&gt;the past&lt;/a&gt; I&amp;rsquo;ve used &lt;code&gt;dd&lt;/code&gt; for elementary sequential read/write testing, but I recently found &lt;a href="http://freshmeat.net/projects/fio/"&gt;fio&lt;/a&gt; which is much more versatile. Apparently developed by FusionIO, fio lets you control concurrency, blocksize and many other parameters and reports lots more data, most notably &lt;a href="http://en.wikipedia.org/wiki/IOPS"&gt;IOPS&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;I created 4 fio config files, basically the same as the one below, for direct / buffered disk access and sequential / random writes. All have 8k blocksize since that&amp;rsquo;s what Postgres uses by default.&lt;/p&gt;</description></item><item><title>Using WAL archiving &amp; Compellent snapshots for PostgreSQL backups</title><link>https://evan.wtf/2011/07/13/using-wal-archiving-compellent-snapshots-for-postgresql-backups/</link><pubDate>Wed, 13 Jul 2011 13:46:40 +0000</pubDate><guid>https://evan.wtf/2011/07/13/using-wal-archiving-compellent-snapshots-for-postgresql-backups/</guid><description>Changing my Postgres DB backup strategy from nightly &lt;code&gt;pg_dump&lt;/code&gt;s to WAL archiving with SAN snapshots.</description></item><item><title>Migrating a PostgreSQL DB to a new machine without doing a dump &amp; restore</title><link>https://evan.wtf/2011/07/11/migrating-a-postgresql-db-to-a-new-machine-without-doing-a-dump-restore/</link><pubDate>Mon, 11 Jul 2011 14:39:16 +0000</pubDate><guid>https://evan.wtf/2011/07/11/migrating-a-postgresql-db-to-a-new-machine-without-doing-a-dump-restore/</guid><description>rsync over NFS can be so fast.</description></item><item><title>Do I still need swap space?</title><link>https://evan.wtf/2010/11/11/do-i-still-need-swap-space/</link><pubDate>Thu, 11 Nov 2010 14:36:49 +0000</pubDate><guid>https://evan.wtf/2010/11/11/do-i-still-need-swap-space/</guid><description>&lt;p&gt;About three years ago I replaced our primary database. For years we&amp;rsquo;d been plagued by awful performance in the database and we were never able to diagnose the problem. The original server was a real beast at the time: 8 Opterons (single core), 32 gigs ram, and a fibre channel RAID connected via a QLogic HBA. This was back in 2005, so those specs don&amp;rsquo;t probably sound that impressive today, but this was a crazy configuration (with a crazy price tag to match). On paper it looked like this server should be basically invincible but the performance was awful, slowing down every process within the company. We contacted a few different companies (including &lt;a href="http://commandprompt.com/"&gt;CommandPrompt&lt;/a&gt;, which employs several of the core Pg devs) to see if they could assist us in diagnosing the problems but tuning only helped to a point. There was just something wrong with the box, maybe having to do with the FC HBA itself (which nobody knew much about).&lt;/p&gt;</description></item></channel></rss>