title: SQL query optimization (Pervasive)
body: <p>I have a PHP application that pulls order information based on a scanned/entered order number for order pulling purposes. We're using Pervasive SQL but syntax is identical to MS SQL.</p>
  
  <p>I have a couple of smaller queries used to break kit items down into component items that are called as needed, but they're simple and fast to execute. My problem is our main query that most needed information is stuffed into. It's fast for most orders since they're relatively small (1-15 items or so). My problem is with large orders (e.g. wholesale) that may end up being 100+ items.</p>
  
  <p>I realize that the more information needed the longer it will take to execute a query, but I'm hoping there is room in my query to optimize it further.</p>
  
  <p>Does anyone see anything in the following query that I can optimize to speed things up for large orders?</p>
  
  <pre><code>SELECT 
      oeordh.orduniq, 
      oeordh.customer, 
      oeordh.ordnumber, 
      oeordh.orddate, 
      oeordh.salesper1, 
      oeordd.orduniq, 
      oeordd.item, 
      oeordd.pickseq, 
      oeordd.location, 
      oeordd.origqty, 
      arcus.idcust, 
      arcus.idgrp 
  
  FROM oeordh 
      INNER JOIN oeordd ON oeordh.orduniq = oeordd.orduniq
      INNER JOIN arcus ON oeordh.customer = arcus.idcust
  
  WHERE 
      oeordh.ordnumber = '".$_POST['barcode']."' 
  
  ORDER BY oeordd.pickseq`
  </code></pre>