title: Are unconverted quote records ever removed in Magento?
body: <p><strong>tl;dr: There appears to be no other out-of-box mechanism for deleting quote records which were never converted to orders.</strong></p>
  
  <p>The <code>Mage_Sales</code> module has a scheduled job to clean expired quotes, but this only deletes <code>sales_flat_quote</code> records which are marked as inactive (i.e. <code>is_active = 0</code>). To my knowledge, quotes are only marked as inactive when a quote converts to an order. If this is the case, then the quote table will only grow larger and larger.</p>
  
  <p>Ref <a href="https://github.com/benmarks/magento-mirror/blob/1.7.0.2/app/code/core/Mage/Sales/Model/Observer.php#L50"><code>Mage_Sales_Model_Observer::cleanExpiredQuotes()</code></a></p>
  
  <pre><code>class Mage_Sales_Model_Observer
  {
      //...
  
      public function cleanExpiredQuotes($schedule)
      {
          Mage::dispatchEvent('clear_expired_quotes_before', array('sales_observer' =&gt; $this));
  
          $lifetimes = Mage::getConfig()-&gt;getStoresConfigByPath('checkout/cart/delete_quote_after');
          foreach ($lifetimes as $storeId=&gt;$lifetime) {
              $lifetime *= 86400;
  
              /** @var $quotes Mage_Sales_Model_Mysql4_Quote_Collection */
              $quotes = Mage::getModel('sales/quote')-&gt;getCollection();
  
              $quotes-&gt;addFieldToFilter('store_id', $storeId);
              $quotes-&gt;addFieldToFilter('updated_at', array('to'=&gt;date("Y-m-d", time()-$lifetime)));
              $quotes-&gt;addFieldToFilter('is_active', 0);
  
              foreach ($this-&gt;getExpireQuotesAdditionalFilterFields() as $field =&gt; $condition) {
                  $quotes-&gt;addFieldToFilter($field, $condition);
              }
  
              $quotes-&gt;walk('delete');
          }
          return $this;
      }
  
      //...
  }
  </code></pre>