title: Optimize performance for queries on recent rows of a large table
body: <p>I have a large table:</p>
  
  <pre><code>CREATE TABLE "orders" (
  "id" serial NOT NULL,
  "person_id" int4,
  "created" int4,
  CONSTRAINT "orders_pkey" PRIMARY KEY ("id")
  );
  </code></pre>
  
  <p>90% of all requests are about orders from the last 2-3 days by a <code>person_id</code>, like:</p>
  
  <pre><code>select * from orders
  where person_id = 1
  and created &gt;= extract(epoch from current_timestamp)::int - 60 * 60 * 24 * 3;
  </code></pre>
  
  <p>How can I improve performance?</p>
  
  <p>I know about <a href="http://www.postgresql.org/docs/9.1/static/ddl-partitioning.html" rel="nofollow">Partitioning</a>, but what about existing rows? And it looks like I need to create <code>INHERITS</code> tables manually every 2-3 days.</p>