"Josh Harrison" <joshques@xxxxxxxxx> writes: > Aggregate (cost=342178.51..342178.52 rows=1 width=0) > -> Bitmap Heap Scan on person (cost=3120.72..341806.71 rows=148721 width=0) > Recheck Cond: (person_id > 1146000000::numeric) > -> Bitmap Index Scan on person_pk (cost=0.00..3083.53 rows=148721 width=0) > Index Cond: (person_id > 1146000000::numeric) ... > How does the planner choose the plan? The short answer is that it looks at the "cost" for all the reasonable plans it can come up with and picks the plan with the lowest cost. Scans which return many rows will tend to prefer bitmap index scans (when they don't do a full sequential scan of the t table) since it avoids random access. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com Ask me about EnterpriseDB's 24x7 Postgres support! ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster