title: What is the difference between #> and ->> operator in PostgreSQL?
body: <p>We can access any JSON element in PostgreSQL 9.3 using the <code>-&gt;</code> and <code>-&gt;&gt;</code> operators. Seems to me that the <code>#&gt;</code> along with <code>#&gt;&gt;</code> only provide a shorter form of writing the JSON path. Or is there a bigger picture behind the <code>#&gt;</code> operator? Does it serve a special purpose/provide any advantage over the arrow notation? Which one is the preffered method of writing paths?</p>
  
  <p>It all comes to the question: why should I use the <code>#&gt;</code> and <code>#&gt;&gt;</code> operator over the <code>-&gt;</code> and <code>-&gt;&gt;</code>?</p>
  
  <p><a href="http://www.postgresql.org/docs/9.3/static/functions-json.html" rel="noreferrer">The docs</a> are a bit enigmatic about this.</p>
  
  <p>Both queries below give the same result:</p>
  
  <pre><code>=&gt; select '{"a":[1,2,3],"b":[4,5,6]}'::json#&gt;'{a,2}';
   ?column? 
  ----------
   3
  
  =&gt; select '{"a":[1,2,3],"b":[4,5,6]}'::json-&gt;'a'-&gt;&gt;2;
   ?column? 
  ----------
   3
  </code></pre>