title: Is there some security advantage to using pgcrypto instead of partition-level encryption?
body: <p>The document here: <a href="http://www.postgresql.org/docs/8.2/static/encryption-options.html" rel="nofollow">http://www.postgresql.org/docs/8.2/static/encryption-options.html</a> describes several approaches to encrypting data when using postgresql.</p>
  
  <p>I would like to know if there's any security advantage to encrypting specific columns using pgcrypto instead of simply encrypting the entire partition on which the database resides. It seems to me that pgcrypto is cumbersome to use(instead of just using SQL queries without having to worry about things being encrypted) so there should be a reason for its existence. Is it simply that people may not have the ability to manage the database server(shared hosts/etc...) so they would have to make-do with pgcrypto, or is there a security reason?</p>
  
  <p>In my particular case, the application code and the database are on the same host, so compromising the server itself while it is live would result in the data being leaked either way(one could look for the encryption key in the code in one case, or simply retrieve the data from the mounted volume in the other).</p>
  
  <p>Edit: I forgot to mention, also in this particular case, the data is used by the server not the client, ie, the client can't provide the key at run-time it would have to be on the server in the application code.</p>