title: Unix domain or TCP
body: <p>I have a fairly simple Rails app that connect to Postgres server (locally). </p>
  
  <p>Uptil now, I was under the impression if not specified (socket in the database.yml) the pg client connect with postgres over TCP on a loopback interface.</p>
  
  <p>Fyi,this is how my configuration looks like.</p>
  
  <pre><code>{:adapter=&gt;"postgresql", :encoding=&gt;"unicode", :database=&gt;"scp_development"}
  </code></pre>
  
  <p>But I think I was wrong I can't sniff any packet over the loopback interface at port 5432. </p>
  
  <p><code>sudo tcpdump -nnvvXSs 1514 -i lo0 dst port 5432</code></p>
  
  <p>Which is letting me believe that it working over Unix domain socket.</p>
  
  <p>So, is there a fairly reliable way to determine ...</p>
  
  <p>Whether I'm connected to TCP socket or Unix socket?</p>