title: Optimize query to fetch tuples from index directly
body: <p>I want to optimize a large SQL query that has around 500 SQL lines and is a little slow, it takes 1 to 5 seconds to execute in an interactive system.</p>
  
  <p>I saw this munin graph</p>
  
  <p><img src="https://i.stack.imgur.com/R6RX0.png" alt="graph2"></p>
  
  <p>That is not the same as this graph</p>
  
  <p><img src="https://i.stack.imgur.com/KipSv.png" alt="graph1"></p>
  
  <p>What I understand from the first graph (showing scans) is that the indexes are being used in <code>where</code> or <code>order by</code> sentences, only to search a tuple that matches some rules (boolean expression).</p>
  
  <p>The second graph I'm not really sure what it means by "tuple access"</p>
  
  <p>Question1: What is the meaning of "tuple access"?</p>
  
  <p>So I'm thinking that I can make an optimization step forward if I could rewrite some parts of this big query to fetch more tuples using the indexes and less sequentially, using the information in the second graph.</p>
  
  <p>Question2: Am I correct? Would it be better that the second graph show more index fetched and less sequentially read?</p>
  
  <p>Question3: In case this is correct, could you provide a SQL example in which the tuples are index-fetched opposed to one in which they are sequentially read?</p>
  
  <p>Note: In the questions, I'm only referring to the second graph</p>