Permalink
Browse files

Site updated at 2012-06-05 18:24:31 UTC

  • Loading branch information...
1 parent b529896 commit ef148e505db9e75a253b9c830a23627ef2d37383 @liamks committed Jun 5, 2012
Showing with 39 additions and 12 deletions.
  1. +12 −3 atom.xml
  2. +12 −3 blog/2012/06/04/redis-and-relational-data/index.html
  3. +12 −3 index.html
  4. +3 −3 sitemap.xml
View
@@ -4,7 +4,7 @@
<title><![CDATA[Liam Kaufman]]></title>
<link href="http://liamkaufman.com/atom.xml" rel="self"/>
<link href="http://liamkaufman.com/"/>
- <updated>2012-06-04T14:40:10-04:00</updated>
+ <updated>2012-06-05T14:24:26-04:00</updated>
<id>http://liamkaufman.com/</id>
<author>
<name><![CDATA[Liam Kaufman]]></name>
@@ -19,6 +19,9 @@
<updated>2012-06-04T00:00:00-04:00</updated>
<id>http://liamkaufman.com/blog/2012/06/04/redis-and-relational-data</id>
<content type="html"><![CDATA[<p>
+ <strong>UPDATE:</strong> Based on the feedback in the comments (Phineas), I&#8217;ve added an index to the comments table and updated the results.
+</p>
+<p>
Using the right tool for the job is a basic tenant amongst programmers. However, with all the currently available database options it&#8217;s increasingly difficult to figure out what the right tool is. Sometime it&#8217;s nice to have a very simple tool that can be used for many different tasks: Redis. Over the last 4 months I&#8217;ve been using Redis heavily and I&#8217;ve even started to use it for relational data. I&#8217;ve been curious to find out the performance differences between Redis and PostgreSQL. Below I&#8217;ll provide an example of storing a simple relational dataset in Redis, and I&#8217;ll look at the performance differences between Redis and PostgreSQL.
</p>
@@ -138,12 +141,18 @@
</tr>
<tr>
- <td>psql (Native Bindings)</td>
+ <td>psql (Native Bindings - NB)</td>
<td>125.95</td>
<td>12.6</td>
</tr>
<tr>
+ <td>psql (NB + Index)</td>
+ <td>2.72</td>
+ <td>0.27</td>
+ </tr>
+
+ <tr>
<td>Redis (Hires)</td>
<td>0.76</td>
<td>0.067</td>
@@ -153,7 +162,7 @@
</div>
<p>
- Using PostgreSQL, it took an average of 138.34 seconds to execute all 10,000 queries, or 13.8 milliseconds/query. Using the native bindings, that come with the psql node module, yielded an improvement and was associated with 12.6 millisecons/query. In contrast, Redis can retrieve a post and its comments in 0.067 milliseconds. Of course the above is akin to comparing apples to oranges, but it still provides a glimpse into the performance differences between Redis and PostgreSQL.
+ Using PostgreSQL, it took an average of 138.34 seconds to execute all 10,000 queries, or 13.8 milliseconds/query. Using the native bindings, that come with the psql node module, yielded an improvement and was associated with 12.6 millisecons/query. When an index was added to comments (post_id), the time dropped to 2.72 seconds, or 0.27 seconds for a post and its 10 comments. In contrast, Redis can retrieve a post and its comments in 0.067 milliseconds. Of course the above is akin to comparing apples to oranges, but it still provides a glimpse into the performance differences between Redis and PostgreSQL.
</p>
<p>
While Redis is in memory and should be fast, PostgreSQL uses caching algorithms (<a href="http://archives.postgresql.org/pgsql-hackers/2007-11/msg00562.php">LRU</a>) to keep its contents in memory. Of course, keeping everything in memory (Redis) will most likely be faster than using LRU.
@@ -9,7 +9,7 @@
<meta name="author" content="Liam Kaufman">
- <meta name="description" content="Using the right tool for the job is a basic tenant amongst programmers. However, with all the currently available database options it&#8217;s &hellip;">
+ <meta name="description" content="UPDATE: Based on the feedback in the comments (Phineas), I&#8217;ve added an index to the comments table and updated the results. Using the right &hellip;">
<!-- http://t.co/dKP3o1e -->
@@ -106,6 +106,9 @@ <h1 class="entry-title">Redis and Relational Data</h1>
<div class="entry-content"><p>
+ <strong>UPDATE:</strong> Based on the feedback in the comments (Phineas), I&#8217;ve added an index to the comments table and updated the results.
+</p>
+<p>
Using the right tool for the job is a basic tenant amongst programmers. However, with all the currently available database options it&#8217;s increasingly difficult to figure out what the right tool is. Sometime it&#8217;s nice to have a very simple tool that can be used for many different tasks: Redis. Over the last 4 months I&#8217;ve been using Redis heavily and I&#8217;ve even started to use it for relational data. I&#8217;ve been curious to find out the performance differences between Redis and PostgreSQL. Below I&#8217;ll provide an example of storing a simple relational dataset in Redis, and I&#8217;ll look at the performance differences between Redis and PostgreSQL.
</p>
@@ -225,12 +228,18 @@ <h1 class="entry-title">Redis and Relational Data</h1>
</tr>
<tr>
- <td>psql (Native Bindings)</td>
+ <td>psql (Native Bindings - NB)</td>
<td>125.95</td>
<td>12.6</td>
</tr>
<tr>
+ <td>psql (NB + Index)</td>
+ <td>2.72</td>
+ <td>0.27</td>
+ </tr>
+
+ <tr>
<td>Redis (Hires)</td>
<td>0.76</td>
<td>0.067</td>
@@ -240,7 +249,7 @@ <h1 class="entry-title">Redis and Relational Data</h1>
</div>
<p>
- Using PostgreSQL, it took an average of 138.34 seconds to execute all 10,000 queries, or 13.8 milliseconds/query. Using the native bindings, that come with the psql node module, yielded an improvement and was associated with 12.6 millisecons/query. In contrast, Redis can retrieve a post and its comments in 0.067 milliseconds. Of course the above is akin to comparing apples to oranges, but it still provides a glimpse into the performance differences between Redis and PostgreSQL.
+ Using PostgreSQL, it took an average of 138.34 seconds to execute all 10,000 queries, or 13.8 milliseconds/query. Using the native bindings, that come with the psql node module, yielded an improvement and was associated with 12.6 millisecons/query. When an index was added to comments (post_id), the time dropped to 2.72 seconds, or 0.27 seconds for a post and its 10 comments. In contrast, Redis can retrieve a post and its comments in 0.067 milliseconds. Of course the above is akin to comparing apples to oranges, but it still provides a glimpse into the performance differences between Redis and PostgreSQL.
</p>
<p>
While Redis is in memory and should be fast, PostgreSQL uses caching algorithms (<a href="http://archives.postgresql.org/pgsql-hackers/2007-11/msg00562.php">LRU</a>) to keep its contents in memory. Of course, keeping everything in memory (Redis) will most likely be faster than using LRU.
View
@@ -9,7 +9,7 @@
<meta name="author" content="Liam Kaufman">
- <meta name="description" content="Using the right tool for the job is a basic tenant amongst programmers. However, with all the currently available database options it&#8217;s &hellip;">
+ <meta name="description" content="UPDATE: Based on the feedback in the comments (Phineas), I&#8217;ve added an index to the comments table and updated the results. Using the right &hellip;">
<!-- http://t.co/dKP3o1e -->
@@ -109,6 +109,9 @@ <h1 class="entry-title"><a href="/blog/2012/06/04/redis-and-relational-data/">Re
<div class="entry-content"><p>
+ <strong>UPDATE:</strong> Based on the feedback in the comments (Phineas), I&#8217;ve added an index to the comments table and updated the results.
+</p>
+<p>
Using the right tool for the job is a basic tenant amongst programmers. However, with all the currently available database options it&#8217;s increasingly difficult to figure out what the right tool is. Sometime it&#8217;s nice to have a very simple tool that can be used for many different tasks: Redis. Over the last 4 months I&#8217;ve been using Redis heavily and I&#8217;ve even started to use it for relational data. I&#8217;ve been curious to find out the performance differences between Redis and PostgreSQL. Below I&#8217;ll provide an example of storing a simple relational dataset in Redis, and I&#8217;ll look at the performance differences between Redis and PostgreSQL.
</p>
@@ -228,12 +231,18 @@ <h1 class="entry-title"><a href="/blog/2012/06/04/redis-and-relational-data/">Re
</tr>
<tr>
- <td>psql (Native Bindings)</td>
+ <td>psql (Native Bindings - NB)</td>
<td>125.95</td>
<td>12.6</td>
</tr>
<tr>
+ <td>psql (NB + Index)</td>
+ <td>2.72</td>
+ <td>0.27</td>
+ </tr>
+
+ <tr>
<td>Redis (Hires)</td>
<td>0.76</td>
<td>0.067</td>
@@ -243,7 +252,7 @@ <h1 class="entry-title"><a href="/blog/2012/06/04/redis-and-relational-data/">Re
</div>
<p>
- Using PostgreSQL, it took an average of 138.34 seconds to execute all 10,000 queries, or 13.8 milliseconds/query. Using the native bindings, that come with the psql node module, yielded an improvement and was associated with 12.6 millisecons/query. In contrast, Redis can retrieve a post and its comments in 0.067 milliseconds. Of course the above is akin to comparing apples to oranges, but it still provides a glimpse into the performance differences between Redis and PostgreSQL.
+ Using PostgreSQL, it took an average of 138.34 seconds to execute all 10,000 queries, or 13.8 milliseconds/query. Using the native bindings, that come with the psql node module, yielded an improvement and was associated with 12.6 millisecons/query. When an index was added to comments (post_id), the time dropped to 2.72 seconds, or 0.27 seconds for a post and its 10 comments. In contrast, Redis can retrieve a post and its comments in 0.067 milliseconds. Of course the above is akin to comparing apples to oranges, but it still provides a glimpse into the performance differences between Redis and PostgreSQL.
</p>
<p>
While Redis is in memory and should be fast, PostgreSQL uses caching algorithms (<a href="http://archives.postgresql.org/pgsql-hackers/2007-11/msg00562.php">LRU</a>) to keep its contents in memory. Of course, keeping everything in memory (Redis) will most likely be faster than using LRU.
View
@@ -74,19 +74,19 @@
</url>
<url>
<loc>http://liamkaufman.com/blog/2012/06/04/redis-and-relational-data/</loc>
- <lastmod>2012-06-04T14:39:29-04:00</lastmod>
+ <lastmod>2012-06-05T14:23:17-04:00</lastmod>
</url>
<url>
<loc>http://liamkaufman.com/about.html</loc>
<lastmod>2012-06-04T14:40:09-04:00</lastmod>
</url>
<url>
<loc>http://liamkaufman.com/blog/archives/</loc>
- <lastmod>2012-06-04T14:39:29-04:00</lastmod>
+ <lastmod>2012-06-05T14:23:17-04:00</lastmod>
</url>
<url>
<loc>http://liamkaufman.com/</loc>
- <lastmod>2012-06-04T14:39:29-04:00</lastmod>
+ <lastmod>2012-06-05T14:23:17-04:00</lastmod>
</url>
<url>
<loc>http://liamkaufman.com/projects.html</loc>

0 comments on commit ef148e5

Please sign in to comment.